mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Konnected: Pass hass_config to load_platform (#18027)
This commit is contained in:
parent
5910161202
commit
6f8ac7f5c9
@ -156,7 +156,7 @@ async def async_setup(hass, config):
|
|||||||
|
|
||||||
# Initialize devices specified in the configuration on boot
|
# Initialize devices specified in the configuration on boot
|
||||||
for device in cfg.get(CONF_DEVICES):
|
for device in cfg.get(CONF_DEVICES):
|
||||||
ConfiguredDevice(hass, device).save_data()
|
ConfiguredDevice(hass, device, config).save_data()
|
||||||
|
|
||||||
discovery.async_listen(
|
discovery.async_listen(
|
||||||
hass,
|
hass,
|
||||||
@ -172,10 +172,11 @@ async def async_setup(hass, config):
|
|||||||
class ConfiguredDevice:
|
class ConfiguredDevice:
|
||||||
"""A representation of a configured Konnected device."""
|
"""A representation of a configured Konnected device."""
|
||||||
|
|
||||||
def __init__(self, hass, config):
|
def __init__(self, hass, config, hass_config):
|
||||||
"""Initialize the Konnected device."""
|
"""Initialize the Konnected device."""
|
||||||
self.hass = hass
|
self.hass = hass
|
||||||
self.config = config
|
self.config = config
|
||||||
|
self.hass_config = hass_config
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_id(self):
|
def device_id(self):
|
||||||
@ -237,11 +238,11 @@ class ConfiguredDevice:
|
|||||||
self.hass.data[DOMAIN][CONF_DEVICES][self.device_id] = device_data
|
self.hass.data[DOMAIN][CONF_DEVICES][self.device_id] = device_data
|
||||||
|
|
||||||
discovery.load_platform(
|
discovery.load_platform(
|
||||||
self.hass, 'binary_sensor',
|
self.hass, 'binary_sensor', DOMAIN,
|
||||||
DOMAIN, {'device_id': self.device_id})
|
{'device_id': self.device_id}, self.hass_config)
|
||||||
discovery.load_platform(
|
discovery.load_platform(
|
||||||
self.hass, 'switch', DOMAIN,
|
self.hass, 'switch', DOMAIN,
|
||||||
{'device_id': self.device_id})
|
{'device_id': self.device_id}, self.hass_config)
|
||||||
|
|
||||||
|
|
||||||
class DiscoveredDevice:
|
class DiscoveredDevice:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user