If mFi sensors are identified but not fully assigned they can
have no tag value, and mficlient throws a ValueError to signal this.
This patch handles that case by considering such devices to always
be STATE_OFF.
* Clean-up, ordering, constants, and extend of schema
* Put REQUIREMENTS back and re-add line breaks
* Clean-up, ordering, constants, and extend of schema
* Extend platform
The default configuration of the mFi controller generates self-signed
certificates which are valid for short periods of time, and which are
regnerated on start or as needed. This makes requests mad. Since most
people will be using the self-signed certificates anyway, add options
to let them choose non-TLS, or unverified connections if they want/need.
This bumps the mficlient requirement to 0.3.0 for proper handling of
verify=False.
The exception we were catching incorrectly referenced the client variable
in local scope instead of the module. Also, if we fail to connect we can
get a requests exception, so catch and handle that as well.
Most of the mFi sensors are able to reasonably provide accurate
readings to a tenth of a unit or so. This patch rounds them for
better display in the UI. Normally, I would expect this to be a view
action instead of altering the actual data emitted, but since these
values are reasonable for sensor precision, we're not really losing
anything. I followed the model from the openweathermap component, which
rounds for readability in the backend.
When we update the mFi server for the state of a switch, the new
state is not always reported immediately if we update right after
the action (the server is not RESTful).
This patch adds some internal target-state handling to report the
desired state on the next poll, allowing any subsequent polls to
override that state.
Also, bump the version requirement for mficlient to 0.2.2 to absorb
a bug fix.