ReactHass is a tiny Home Assistant helper around homeassistant_api.
pip install reacthass
from reacthass import Reactor
hass = Reactor('HOME ASSISTANT URL', 'YOUR TOKEN')
if hass.when_value_reached('sensor.temperature', 30, value_type='number'):
hass.get_domain('fan').turn_on(entity_id='fan.fan')- Home Assistant states are strings, so numeric checks use
value_type='number'. get_entities_name('light')returns full entity IDs likelight.kitchen.- The async API mirrors the sync API.
If you want to keep the sensor record in the database you might add to your configuration.yaml:
recorder:
include:
entities:
- sensor.testSee the /examples folder.
This package is built on top of HomeAssistantAPI