mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Merge pull request #127 from andythigpen/mysensors-config
Update mysensors component to read debug, persistence values.
This commit is contained in:
commit
cd2b9ce975
@ -32,6 +32,8 @@ from homeassistant.const import (
|
||||
STATE_ON, STATE_OFF)
|
||||
|
||||
CONF_PORT = "port"
|
||||
CONF_DEBUG = "debug"
|
||||
CONF_PERSISTENCE = "persistence"
|
||||
|
||||
ATTR_NODE_ID = "node_id"
|
||||
ATTR_CHILD_ID = "child_id"
|
||||
@ -81,9 +83,17 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
_LOGGER.error("Missing required key 'port'")
|
||||
return False
|
||||
|
||||
gateway = mysensors.SerialGateway(port, sensor_update)
|
||||
gateway.start()
|
||||
persistence = config.get(CONF_PERSISTENCE, True)
|
||||
|
||||
gateway = mysensors.SerialGateway(port, sensor_update,
|
||||
persistence=persistence)
|
||||
gateway.metric = is_metric
|
||||
gateway.debug = config.get(CONF_DEBUG, False)
|
||||
gateway.start()
|
||||
|
||||
if persistence:
|
||||
for nid in gateway.sensors:
|
||||
sensor_update('sensor_update', nid)
|
||||
|
||||
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP,
|
||||
lambda event: gateway.stop())
|
||||
|
Loading…
x
Reference in New Issue
Block a user