mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Fix deconz allow_clip_sensor and allow_deconz_groups options (#25811)
This commit is contained in:
parent
ecddeb2dd1
commit
8b6ddc22a5
@ -63,12 +63,12 @@ class DeconzGateway:
|
|||||||
@property
|
@property
|
||||||
def allow_clip_sensor(self) -> bool:
|
def allow_clip_sensor(self) -> bool:
|
||||||
"""Allow loading clip sensor from gateway."""
|
"""Allow loading clip sensor from gateway."""
|
||||||
return self.config_entry.data.get(CONF_ALLOW_CLIP_SENSOR, True)
|
return self.config_entry.options.get(CONF_ALLOW_CLIP_SENSOR, True)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def allow_deconz_groups(self) -> bool:
|
def allow_deconz_groups(self) -> bool:
|
||||||
"""Allow loading deCONZ groups from gateway."""
|
"""Allow loading deCONZ groups from gateway."""
|
||||||
return self.config_entry.data.get(CONF_ALLOW_DECONZ_GROUPS, True)
|
return self.config_entry.options.get(CONF_ALLOW_DECONZ_GROUPS, True)
|
||||||
|
|
||||||
async def async_update_device_registry(self):
|
async def async_update_device_registry(self):
|
||||||
"""Update device registry."""
|
"""Update device registry."""
|
||||||
|
@ -31,14 +31,17 @@ SENSOR = {
|
|||||||
|
|
||||||
|
|
||||||
ENTRY_CONFIG = {
|
ENTRY_CONFIG = {
|
||||||
deconz.const.CONF_ALLOW_CLIP_SENSOR: True,
|
|
||||||
deconz.const.CONF_ALLOW_DECONZ_GROUPS: True,
|
|
||||||
deconz.config_flow.CONF_API_KEY: "ABCDEF",
|
deconz.config_flow.CONF_API_KEY: "ABCDEF",
|
||||||
deconz.config_flow.CONF_BRIDGEID: "0123456789",
|
deconz.config_flow.CONF_BRIDGEID: "0123456789",
|
||||||
deconz.config_flow.CONF_HOST: "1.2.3.4",
|
deconz.config_flow.CONF_HOST: "1.2.3.4",
|
||||||
deconz.config_flow.CONF_PORT: 80,
|
deconz.config_flow.CONF_PORT: 80,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ENTRY_OPTIONS = {
|
||||||
|
deconz.const.CONF_ALLOW_CLIP_SENSOR: True,
|
||||||
|
deconz.const.CONF_ALLOW_DECONZ_GROUPS: True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
async def setup_gateway(hass, data, allow_clip_sensor=True):
|
async def setup_gateway(hass, data, allow_clip_sensor=True):
|
||||||
"""Load the deCONZ binary sensor platform."""
|
"""Load the deCONZ binary sensor platform."""
|
||||||
@ -47,7 +50,7 @@ async def setup_gateway(hass, data, allow_clip_sensor=True):
|
|||||||
loop = Mock()
|
loop = Mock()
|
||||||
session = Mock()
|
session = Mock()
|
||||||
|
|
||||||
ENTRY_CONFIG[deconz.const.CONF_ALLOW_CLIP_SENSOR] = allow_clip_sensor
|
ENTRY_OPTIONS[deconz.const.CONF_ALLOW_CLIP_SENSOR] = allow_clip_sensor
|
||||||
|
|
||||||
config_entry = config_entries.ConfigEntry(
|
config_entry = config_entries.ConfigEntry(
|
||||||
1,
|
1,
|
||||||
@ -56,6 +59,7 @@ async def setup_gateway(hass, data, allow_clip_sensor=True):
|
|||||||
ENTRY_CONFIG,
|
ENTRY_CONFIG,
|
||||||
"test",
|
"test",
|
||||||
config_entries.CONN_CLASS_LOCAL_PUSH,
|
config_entries.CONN_CLASS_LOCAL_PUSH,
|
||||||
|
ENTRY_OPTIONS,
|
||||||
)
|
)
|
||||||
gateway = deconz.DeconzGateway(hass, config_entry)
|
gateway = deconz.DeconzGateway(hass, config_entry)
|
||||||
gateway.api = DeconzSession(loop, session, **config_entry.data)
|
gateway.api = DeconzSession(loop, session, **config_entry.data)
|
||||||
|
@ -39,14 +39,17 @@ SENSOR = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ENTRY_CONFIG = {
|
ENTRY_CONFIG = {
|
||||||
deconz.const.CONF_ALLOW_CLIP_SENSOR: True,
|
|
||||||
deconz.const.CONF_ALLOW_DECONZ_GROUPS: True,
|
|
||||||
deconz.config_flow.CONF_API_KEY: "ABCDEF",
|
deconz.config_flow.CONF_API_KEY: "ABCDEF",
|
||||||
deconz.config_flow.CONF_BRIDGEID: "0123456789",
|
deconz.config_flow.CONF_BRIDGEID: "0123456789",
|
||||||
deconz.config_flow.CONF_HOST: "1.2.3.4",
|
deconz.config_flow.CONF_HOST: "1.2.3.4",
|
||||||
deconz.config_flow.CONF_PORT: 80,
|
deconz.config_flow.CONF_PORT: 80,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ENTRY_OPTIONS = {
|
||||||
|
deconz.const.CONF_ALLOW_CLIP_SENSOR: True,
|
||||||
|
deconz.const.CONF_ALLOW_DECONZ_GROUPS: True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
async def setup_gateway(hass, data, allow_clip_sensor=True):
|
async def setup_gateway(hass, data, allow_clip_sensor=True):
|
||||||
"""Load the deCONZ sensor platform."""
|
"""Load the deCONZ sensor platform."""
|
||||||
@ -59,7 +62,7 @@ async def setup_gateway(hass, data, allow_clip_sensor=True):
|
|||||||
|
|
||||||
session = Mock(put=asynctest.CoroutineMock(return_value=response))
|
session = Mock(put=asynctest.CoroutineMock(return_value=response))
|
||||||
|
|
||||||
ENTRY_CONFIG[deconz.const.CONF_ALLOW_CLIP_SENSOR] = allow_clip_sensor
|
ENTRY_OPTIONS[deconz.const.CONF_ALLOW_CLIP_SENSOR] = allow_clip_sensor
|
||||||
|
|
||||||
config_entry = config_entries.ConfigEntry(
|
config_entry = config_entries.ConfigEntry(
|
||||||
1,
|
1,
|
||||||
@ -68,6 +71,7 @@ async def setup_gateway(hass, data, allow_clip_sensor=True):
|
|||||||
ENTRY_CONFIG,
|
ENTRY_CONFIG,
|
||||||
"test",
|
"test",
|
||||||
config_entries.CONN_CLASS_LOCAL_PUSH,
|
config_entries.CONN_CLASS_LOCAL_PUSH,
|
||||||
|
ENTRY_OPTIONS,
|
||||||
)
|
)
|
||||||
gateway = deconz.DeconzGateway(hass, config_entry)
|
gateway = deconz.DeconzGateway(hass, config_entry)
|
||||||
gateway.api = DeconzSession(hass.loop, session, **config_entry.data)
|
gateway.api = DeconzSession(hass.loop, session, **config_entry.data)
|
||||||
|
@ -62,14 +62,17 @@ SWITCH = {
|
|||||||
|
|
||||||
|
|
||||||
ENTRY_CONFIG = {
|
ENTRY_CONFIG = {
|
||||||
deconz.const.CONF_ALLOW_CLIP_SENSOR: True,
|
|
||||||
deconz.const.CONF_ALLOW_DECONZ_GROUPS: True,
|
|
||||||
deconz.config_flow.CONF_API_KEY: "ABCDEF",
|
deconz.config_flow.CONF_API_KEY: "ABCDEF",
|
||||||
deconz.config_flow.CONF_BRIDGEID: "0123456789",
|
deconz.config_flow.CONF_BRIDGEID: "0123456789",
|
||||||
deconz.config_flow.CONF_HOST: "1.2.3.4",
|
deconz.config_flow.CONF_HOST: "1.2.3.4",
|
||||||
deconz.config_flow.CONF_PORT: 80,
|
deconz.config_flow.CONF_PORT: 80,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ENTRY_OPTIONS = {
|
||||||
|
deconz.const.CONF_ALLOW_CLIP_SENSOR: True,
|
||||||
|
deconz.const.CONF_ALLOW_DECONZ_GROUPS: True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
async def setup_gateway(hass, data, allow_deconz_groups=True):
|
async def setup_gateway(hass, data, allow_deconz_groups=True):
|
||||||
"""Load the deCONZ light platform."""
|
"""Load the deCONZ light platform."""
|
||||||
@ -78,7 +81,7 @@ async def setup_gateway(hass, data, allow_deconz_groups=True):
|
|||||||
loop = Mock()
|
loop = Mock()
|
||||||
session = Mock()
|
session = Mock()
|
||||||
|
|
||||||
ENTRY_CONFIG[deconz.const.CONF_ALLOW_DECONZ_GROUPS] = allow_deconz_groups
|
ENTRY_OPTIONS[deconz.const.CONF_ALLOW_DECONZ_GROUPS] = allow_deconz_groups
|
||||||
|
|
||||||
config_entry = config_entries.ConfigEntry(
|
config_entry = config_entries.ConfigEntry(
|
||||||
1,
|
1,
|
||||||
@ -87,6 +90,7 @@ async def setup_gateway(hass, data, allow_deconz_groups=True):
|
|||||||
ENTRY_CONFIG,
|
ENTRY_CONFIG,
|
||||||
"test",
|
"test",
|
||||||
config_entries.CONN_CLASS_LOCAL_PUSH,
|
config_entries.CONN_CLASS_LOCAL_PUSH,
|
||||||
|
ENTRY_OPTIONS,
|
||||||
)
|
)
|
||||||
gateway = deconz.DeconzGateway(hass, config_entry)
|
gateway = deconz.DeconzGateway(hass, config_entry)
|
||||||
gateway.api = DeconzSession(loop, session, **config_entry.data)
|
gateway.api = DeconzSession(loop, session, **config_entry.data)
|
||||||
|
@ -75,14 +75,17 @@ SENSOR = {
|
|||||||
|
|
||||||
|
|
||||||
ENTRY_CONFIG = {
|
ENTRY_CONFIG = {
|
||||||
deconz.const.CONF_ALLOW_CLIP_SENSOR: True,
|
|
||||||
deconz.const.CONF_ALLOW_DECONZ_GROUPS: True,
|
|
||||||
deconz.config_flow.CONF_API_KEY: "ABCDEF",
|
deconz.config_flow.CONF_API_KEY: "ABCDEF",
|
||||||
deconz.config_flow.CONF_BRIDGEID: "0123456789",
|
deconz.config_flow.CONF_BRIDGEID: "0123456789",
|
||||||
deconz.config_flow.CONF_HOST: "1.2.3.4",
|
deconz.config_flow.CONF_HOST: "1.2.3.4",
|
||||||
deconz.config_flow.CONF_PORT: 80,
|
deconz.config_flow.CONF_PORT: 80,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ENTRY_OPTIONS = {
|
||||||
|
deconz.const.CONF_ALLOW_CLIP_SENSOR: True,
|
||||||
|
deconz.const.CONF_ALLOW_DECONZ_GROUPS: True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
async def setup_gateway(hass, data, allow_clip_sensor=True):
|
async def setup_gateway(hass, data, allow_clip_sensor=True):
|
||||||
"""Load the deCONZ sensor platform."""
|
"""Load the deCONZ sensor platform."""
|
||||||
@ -91,7 +94,7 @@ async def setup_gateway(hass, data, allow_clip_sensor=True):
|
|||||||
loop = Mock()
|
loop = Mock()
|
||||||
session = Mock()
|
session = Mock()
|
||||||
|
|
||||||
ENTRY_CONFIG[deconz.const.CONF_ALLOW_CLIP_SENSOR] = allow_clip_sensor
|
ENTRY_OPTIONS[deconz.const.CONF_ALLOW_CLIP_SENSOR] = allow_clip_sensor
|
||||||
|
|
||||||
config_entry = config_entries.ConfigEntry(
|
config_entry = config_entries.ConfigEntry(
|
||||||
1,
|
1,
|
||||||
@ -100,6 +103,7 @@ async def setup_gateway(hass, data, allow_clip_sensor=True):
|
|||||||
ENTRY_CONFIG,
|
ENTRY_CONFIG,
|
||||||
"test",
|
"test",
|
||||||
config_entries.CONN_CLASS_LOCAL_PUSH,
|
config_entries.CONN_CLASS_LOCAL_PUSH,
|
||||||
|
ENTRY_OPTIONS,
|
||||||
)
|
)
|
||||||
gateway = deconz.DeconzGateway(hass, config_entry)
|
gateway = deconz.DeconzGateway(hass, config_entry)
|
||||||
gateway.api = DeconzSession(loop, session, **config_entry.data)
|
gateway.api = DeconzSession(loop, session, **config_entry.data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user