Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore Shelly block update with cfgChanged None #113587

Merged
merged 1 commit into from Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/shelly/coordinator.py
Expand Up @@ -217,7 +217,7 @@ def _async_device_updates_handler(self) -> None:
# Check for input events and config change
cfg_changed = 0
for block in self.device.blocks:
if block.type == "device":
if block.type == "device" and block.cfgChanged is not None:
cfg_changed = block.cfgChanged

# Shelly TRV sends information about changing the configuration for no
Expand Down
12 changes: 12 additions & 0 deletions tests/components/shelly/test_coordinator.py
Expand Up @@ -68,6 +68,18 @@ async def test_block_reload_on_cfg_change(
mock_block_device.mock_update()
await hass.async_block_till_done()

# Make sure cfgChanged with None is ignored
monkeypatch.setattr(mock_block_device.blocks[DEVICE_BLOCK_ID], "cfgChanged", None)
mock_block_device.mock_update()
await hass.async_block_till_done()

# Wait for debouncer
freezer.tick(timedelta(seconds=ENTRY_RELOAD_COOLDOWN))
async_fire_time_changed(hass)
await hass.async_block_till_done()

assert hass.states.get("switch.test_name_channel_1") is not None

# Generate config change from switch to light
monkeypatch.setitem(
mock_block_device.settings["relays"][RELAY_BLOCK_ID], "appliance_type", "light"
Expand Down