🏡 Open source home automation that puts local control and privacy first.
Find a file
Greg Laabs 1c8b5838cd ISY994 sensor improvements (#10805)
* Fire events for ISY994 control events

This allows hass to react directly to Insteon button presses (on switches and remotes), including presses, double-presses, and long holds

* Move change event subscription to after entity is added to hass

The event handler method requires `self.hass` to exist, which doesn't have a value until the async_added_to_hass method is called. Should eliminate a race condition.

* Overhaul binary sensors in ISY994 to be functional "out of the box"

We now smash all of the subnodes from the ISY994 in to one Hass binary_sensor, and automatically support both paradigms of state reporting that Insteon sensors can do. Sometimes a single node's state represents the sensor's state, other times two nodes are used and only "ON" events are sent from each. The logic between the two forunately do not conflict so we can support both without knowing which mode the device is in.

This also allows us to handle the heartbeat functionality that certain sensors have - we simply store the timestamp of the heartbeat as an attribute on the sensor device. It defaults to Unknown on bootup if and only if the device supports heartbeats, due to the presence of subnode 4.

* Parse the binary sensor device class from the ISY's device "type"

Now we automatically know which sensors are moisture, motion, and openings! (We also reverse the moisture sensor state, because Insteon reports ON for dry on the primary node.)

* Code review tweaks

The one material change here is that the event subscribers were moved to the `async_added_to_hass` method, as the handlers depend on things that only exist after the entity has been added.

* Handle cases where a sensor's state is unknown

When the ISY first boots up, if a battery-powered sensor has not reported in yet (due to heartbeat or a change in state), the state is unknown until it does.

* Clean up from code review

Fix coroutine await, remove unnecessary exception check, and return None when state is unknown

* Unknown value from PyISY is now -inf rather than -1

* Move heartbeat handling to a separate sensor

Now all heartbeat-compatible sensors will have a separate `binary_sensor` device that represents the battery state (on = dead)

* Add support for Unknown state, which is being added in next PyISY 

PyISY will report unknown states as the number "-inf". This is implemented in the base ISY994 component, but subcomponents that override the `state` method needed some extra logic to handle it as well.

* Change a couple try blocks to explicit None checks

* Bump PyISY to 1.1.0, now that it has been published!

* Remove -inf checking from base component

The implementation of the -inf checking was improved in another branch which has been merged in to this branch already.

* Restrict negative-node and heartbeat support to known compatible types

Not all Insteon sensors use the same subnode IDs for the same things, so we need to use different logic depending on device type. Negative node and heartbeat support is now only used for leak sensors and open/close sensors.

* Use new style string formatting

* Add binary sensor detection for pre-5.x firmware

Meant to do this originally; writing documentation revealed that this requirement was missed!
2017-12-13 20:14:56 -08:00
.github Use H2 headers to split up the different sections (#6183) 2017-02-23 12:58:18 -08:00
docs Optimised images. Saved 80 KB out of 656 KB. 12.3% overall (up to 32.1% per file) (#10735) 2017-11-21 21:19:13 -08:00
homeassistant ISY994 sensor improvements (#10805) 2017-12-13 20:14:56 -08:00
script Add a caldav calendar component (#10842) 2017-12-10 17:44:28 +01:00
tests Refactor hue to split bridge support from light platform (#10691) 2017-12-10 10:15:01 -08:00
virtualization Revert gactions in Docker (#10115) 2017-10-24 07:30:24 -07:00
.coveragerc Add a caldav calendar component (#10842) 2017-12-10 17:44:28 +01:00
.dockerignore Docker cleanup. (#8226) 2017-06-30 08:07:33 -07:00
.gitattributes Ensure Docker script files uses LF line endings to support Docker for Windows. (#10067) 2017-12-06 15:00:58 +01:00
.gitignore Refactored to new global json saving and loading (#10677) 2017-11-19 19:47:55 -08:00
.gitmodules Consolidate frontend (#9915) 2017-10-24 19:36:27 -07:00
.hound.yml Add .hound.yml 2016-11-13 11:34:09 -08:00
.ignore Include .ignore file for search utilities (#5290) 2017-01-16 22:52:53 -08:00
.travis.yml Reorganize lint travis builds (#10670) 2017-11-19 17:39:24 -08:00
CLA.md Update LICENSE.md and CLA.md to reflect the new Apache 2.0 license 2017-01-28 12:12:34 -08:00
CODE_OF_CONDUCT.md Add organization docs 2017-01-22 16:21:20 -08:00
CODEOWNERS Gearbest sensor (#10556) 2017-12-05 12:32:43 +01:00
CONTRIBUTING.md Fix spelling error and update link (#8869) 2017-08-06 21:18:44 +02:00
Dockerfile Revert gactions in Docker (#10115) 2017-10-24 07:30:24 -07:00
LICENSE.md Update LICENSE.md and CLA.md to reflect the new Apache 2.0 license 2017-01-28 12:12:34 -08:00
MANIFEST.in Consolidate frontend (#9915) 2017-10-24 19:36:27 -07:00
pylintrc Add support for using credstash as a secret store (#8494) 2017-07-24 08:59:10 -07:00
README.rst Remove links to gitter (#9155) 2017-08-27 11:30:26 +02:00
requirements_all.txt ISY994 sensor improvements (#10805) 2017-12-13 20:14:56 -08:00
requirements_docs.txt Upgrade Sphinx to 1.6.5 (#10090) 2017-10-23 23:15:36 +02:00
requirements_test.txt Upgrade mypy to 0.550 (#10591) 2017-11-15 22:35:18 -08:00
requirements_test_all.txt Update Warrant (#11101) 2017-12-12 21:12:41 -08:00
setup.cfg Reorganize lint travis builds (#10670) 2017-11-19 17:39:24 -08:00
setup.py Upgrade yarl to 0.16.0 (#11078) 2017-12-11 13:52:22 +01:00
tox.ini Reorganize lint travis builds (#10670) 2017-11-19 17:39:24 -08:00

Home Assistant |Build Status| |Coverage Status| |Chat Status|
=============================================================

Home Assistant is a home automation platform running on Python 3. It is able to track and control all devices at home and offer a platform for automating control.

To get started:

.. code:: bash

    python3 -m pip install homeassistant
    hass --open-ui

Check out `home-assistant.io <https://home-assistant.io>`__ for `a
demo <https://home-assistant.io/demo/>`__, `installation instructions <https://home-assistant.io/getting-started/>`__,
`tutorials <https://home-assistant.io/getting-started/automation-2/>`__ and `documentation <https://home-assistant.io/docs/>`__.

|screenshot-states|

Featured integrations
---------------------

|screenshot-components|

The system is built using a modular approach so support for other devices or actions can be implemented easily. See also the `section on architecture <https://home-assistant.io/developers/architecture/>`__ and the `section on creating your own
components <https://home-assistant.io/developers/creating_components/>`__.

If you run into issues while using Home Assistant or during development
of a component, check the `Home Assistant help section <https://home-assistant.io/help/>`__ of our website for further help and information.

.. |Build Status| image:: https://travis-ci.org/home-assistant/home-assistant.svg?branch=master
   :target: https://travis-ci.org/home-assistant/home-assistant
.. |Coverage Status| image:: https://img.shields.io/coveralls/home-assistant/home-assistant.svg
   :target: https://coveralls.io/r/home-assistant/home-assistant?branch=master
.. |Chat Status| image:: https://img.shields.io/discord/330944238910963714.svg
   :target: https://discord.gg/c5DvZ4e
.. |screenshot-states| image:: https://raw.github.com/home-assistant/home-assistant/master/docs/screenshots.png
   :target: https://home-assistant.io/demo/
.. |screenshot-components| image:: https://raw.github.com/home-assistant/home-assistant/dev/docs/screenshot-components.png
   :target: https://home-assistant.io/components/