Skip to content

Commit

Permalink
Handle state is None in InfluxDB (home-assistant#79609)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdegat01 authored Oct 4, 2022
1 parent 9c97ebb commit 051374d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion homeassistant/components/influxdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def event_to_json(event: Event) -> dict[str, Any] | None:
state: State | None = event.data.get(EVENT_NEW_STATE)
if (
state is None
or state.state in (STATE_UNKNOWN, "", STATE_UNAVAILABLE)
or state.state in (STATE_UNKNOWN, "", STATE_UNAVAILABLE, None)
or not entity_filter(state.entity_id)
):
return None
Expand Down
2 changes: 1 addition & 1 deletion tests/components/influxdb/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ async def test_event_listener_states(
"""Test the event listener against ignored states."""
handler_method = await _setup(hass, mock_client, config_ext, get_write_api)

for state_state in (1, "unknown", "", "unavailable"):
for state_state in (1, "unknown", "", "unavailable", None):
state = MagicMock(
state=state_state,
domain="fake",
Expand Down

0 comments on commit 051374d

Please sign in to comment.