Skip to content

Commit

Permalink
Fix multiple gateways #12
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Sep 27, 2020
1 parent e4cd955 commit 7bd679e
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion custom_components/xiaomi_gateway3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async def async_setup(hass: HomeAssistant, hass_config: dict):
async def async_setup_entry(hass: HomeAssistant, config_entry):
config = hass.data[DOMAIN]['config']

hass.data[DOMAIN][config_entry.unique_id] = \
hass.data[DOMAIN][config_entry.entry_id] = \
gw = Gateway3(**config_entry.data, config=config)

# init setup for each supported domains
Expand Down
2 changes: 1 addition & 1 deletion custom_components/xiaomi_gateway3/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def setup(gateway: Gateway3, device: dict, attr: str):
Gateway3BinarySensor(gateway, device, attr)
])

gw: Gateway3 = hass.data[DOMAIN][config_entry.unique_id]
gw: Gateway3 = hass.data[DOMAIN][config_entry.entry_id]
gw.add_setup('binary_sensor', setup)


Expand Down
2 changes: 1 addition & 1 deletion custom_components/xiaomi_gateway3/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
def setup(gateway: Gateway3, device: dict, attr: str):
async_add_entities([Gateway3Cover(gateway, device, attr)])

gw: Gateway3 = hass.data[DOMAIN][config_entry.unique_id]
gw: Gateway3 = hass.data[DOMAIN][config_entry.entry_id]
gw.add_setup('cover', setup)


Expand Down
2 changes: 1 addition & 1 deletion custom_components/xiaomi_gateway3/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
def setup(gateway: Gateway3, device: dict, attr: str):
async_add_entities([Gateway3Light(gateway, device, attr)])

gw: Gateway3 = hass.data[DOMAIN][config_entry.unique_id]
gw: Gateway3 = hass.data[DOMAIN][config_entry.entry_id]
gw.add_setup('light', setup)


Expand Down
2 changes: 1 addition & 1 deletion custom_components/xiaomi_gateway3/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
def setup(gateway: Gateway3, device: dict, attr: str):
async_add_entities([Gateway3Entity(gateway, device, attr)])

gw: Gateway3 = hass.data[DOMAIN][config_entry.unique_id]
gw: Gateway3 = hass.data[DOMAIN][config_entry.entry_id]
gw.add_setup('remote', setup)


Expand Down
2 changes: 1 addition & 1 deletion custom_components/xiaomi_gateway3/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def setup(gateway: Gateway3, device: dict, attr: str):
Gateway3Sensor(gateway, device, attr)
])

gw: Gateway3 = hass.data[DOMAIN][config_entry.unique_id]
gw: Gateway3 = hass.data[DOMAIN][config_entry.entry_id]
gw.add_setup('sensor', setup)


Expand Down
2 changes: 1 addition & 1 deletion custom_components/xiaomi_gateway3/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
def setup(gateway: Gateway3, device: dict, attr: str):
async_add_entities([Gateway3Switch(gateway, device, attr)])

gw: Gateway3 = hass.data[DOMAIN][config_entry.unique_id]
gw: Gateway3 = hass.data[DOMAIN][config_entry.entry_id]
gw.add_setup('switch', setup)


Expand Down

0 comments on commit 7bd679e

Please sign in to comment.