return False
// Setup all devices from config
gateways = []
conf_gateways = config[DOMAIN][CONF_GATEWAYS]
for index, gway in enumerate(conf_gateways):
device = gway[CONF_DEVICE]
persistence_file = gway.get(
CONF_PERSISTENCE_FILE,
hass.config.path("mysensors{}.pickle".format(index + 1)))
baud_rate = gway.get(CONF_BAUD_RATE)
tcp_port = gway.get(CONF_TCP_PORT)
in_prefix = gway.get(CONF_TOPIC_IN_PREFIX)
out_prefix = gway.get(CONF_TOPIC_OUT_PREFIX)
ready_gateway = setup_gateway(
device, persistence_file, baud_rate, tcp_port, in_prefix,
out_prefix)
if ready_gateway is not None:
gateways.append(ready_gateway)
if not gateways:
_LOGGER.error(
"No devices could be setup as gateways, check your configuration")
After Change
return gateway
// Setup all devices from config
gateways = {}
conf_gateways = config[DOMAIN][CONF_GATEWAYS]
for index, gway in enumerate(conf_gateways):
device = gway[CONF_DEVICE]
persistence_file = gway.get(
CONF_PERSISTENCE_FILE,
hass.config.path("mysensors{}.pickle".format(index + 1)))
baud_rate = gway.get(CONF_BAUD_RATE)
tcp_port = gway.get(CONF_TCP_PORT)
in_prefix = gway.get(CONF_TOPIC_IN_PREFIX)
out_prefix = gway.get(CONF_TOPIC_OUT_PREFIX)
ready_gateway = setup_gateway(
device, persistence_file, baud_rate, tcp_port, in_prefix,
out_prefix)
if ready_gateway is not None:
gateways[id(ready_gateway)] = ready_gateway
if not gateways:
_LOGGER.error(
"No devices could be setup as gateways, check your configuration")