1 """Handle Konnected messages."""
10 from .const
import CONF_INVERSE, SIGNAL_DS18B20_NEW
12 _LOGGER = logging.getLogger(__name__)
13 HANDLERS = decorator.Registry()
16 @HANDLERS.register("state")
18 """Handle a binary sensor or switch state update."""
19 _LOGGER.debug(
"[state handler] context: %s msg: %s", context, msg)
20 entity_id = context.get(ATTR_ENTITY_ID)
21 state = bool(
int(msg.get(ATTR_STATE)))
22 if context.get(CONF_INVERSE):
28 @HANDLERS.register("temp")
30 """Handle a temperature sensor state update."""
31 _LOGGER.debug(
"[temp handler] context: %s msg: %s", context, msg)
32 entity_id, temp = context.get(SensorDeviceClass.TEMPERATURE), msg.get(
"temp")
37 @HANDLERS.register("humi")
39 """Handle a humidity sensor state update."""
40 _LOGGER.debug(
"[humi handler] context: %s msg: %s", context, msg)
41 entity_id, humi = context.get(SensorDeviceClass.HUMIDITY), msg.get(
"humi")
46 @HANDLERS.register("addr")
48 """Handle an addressable sensor update."""
49 _LOGGER.debug(
"[addr handler] context: %s msg: %s", context, msg)
50 addr, temp = msg.get(
"addr"), msg.get(
"temp")
51 if entity_id := context.get(addr):
54 msg[
"device_id"] = context.get(
"device_id")
55 msg[
"temperature"] = temp
def async_handle_addr_update(hass, context, msg)
def async_handle_state_update(hass, context, msg)
def async_handle_humi_update(hass, context, msg)
def async_handle_temp_update(hass, context, msg)
None async_dispatcher_send(HomeAssistant hass, str signal, *Any args)