Bugfixes random (#2270)

* Fix Z-Wave autoheal network

* Make config_per_platform handle bad config better
This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2016-06-10 22:53:31 -07:00
1 parent b60806583c
commit c9756c40e2
3 files changed
+33 -13

No files matched your search

+11 -12
View File
@@ -214,12 +214,6 @@ def setup(hass, config):
config_path=config[DOMAIN].get('config_path',
default_zwave_config_path),)
# Setup autoheal
if autoheal:
_LOGGER.info("ZWave network autoheal is enabled.")
track_time_change(hass, lambda: heal_network(None),
hour=0, minute=0, second=0)
options.set_console_output(use_debug)
options.lock()
@@ -291,24 +285,24 @@ def setup(hass, config):
dispatcher.connect(
scene_activated, ZWaveNetwork.SIGNAL_SCENE_EVENT, weak=False)
def add_node(event):
def add_node(service):
"""Switch into inclusion mode."""
NETWORK.controller.begin_command_add_device()
def remove_node(event):
def remove_node(service):
"""Switch into exclusion mode."""
NETWORK.controller.begin_command_remove_device()
def heal_network(event):
def heal_network(service):
"""Heal the network."""
_LOGGER.info("ZWave heal running.")
NETWORK.heal()
def soft_reset(event):
def soft_reset(service):
"""Soft reset the controller."""
NETWORK.controller.soft_reset()
def test_network(event):
def test_network(service):
"""Test the network by sending commands to all the nodes."""
NETWORK.test()
@@ -324,7 +318,7 @@ def setup(hass, config):
# Wait up to NETWORK_READY_WAIT_SECS seconds for the zwave network
# to be ready.
for i in range(NETWORK_READY_WAIT_SECS):
_LOGGER.info(
_LOGGER.debug(
"network state: %d %s", NETWORK.state, NETWORK.state_str)
if NETWORK.state >= NETWORK.STATE_AWAKED:
_LOGGER.info("zwave ready after %d seconds", i)
@@ -355,6 +349,11 @@ def setup(hass, config):
hass.services.register(DOMAIN, SERVICE_SOFT_RESET, soft_reset)
hass.services.register(DOMAIN, SERVICE_TEST_NETWORK, test_network)
# Setup autoheal
if autoheal:
_LOGGER.info("ZWave network autoheal is enabled.")
track_time_change(hass, heal_network, hour=0, minute=0, second=0)
hass.bus.listen_once(EVENT_HOMEASSISTANT_START, start_zwave)
return True