Fix mysensors overwriting gateway in GATEWAYS (#4013)
GATEWAYS was a dict, so would overwrite item if key was the same. This would happen when using multiple MQTT gateways, since the device id is the same (`mqtt`). * Fix by changing GATEWAYS from dict into list. * Use hass data to store mysensors gateways instead of having GATEWAYS be a global.
This commit is contained in:
parent
0c5e077091
commit
734bd75fd3
7 changed files with 47 additions and 13 deletions
|
@ -20,7 +20,11 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
if discovery_info is None:
|
||||
return
|
||||
|
||||
for gateway in mysensors.GATEWAYS.values():
|
||||
gateways = hass.data.get(mysensors.MYSENSORS_GATEWAYS)
|
||||
if not gateways:
|
||||
return
|
||||
|
||||
for gateway in gateways:
|
||||
# Define the S_TYPES and V_TYPES that the platform should handle as
|
||||
# states. Map them in a dict of lists.
|
||||
pres = gateway.const.Presentation
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue