diff --git a/homeassistant/components/influxdb/__init__.py b/homeassistant/components/influxdb/__init__.py index 72871c75fc4..4fd6eb58fdd 100644 --- a/homeassistant/components/influxdb/__init__.py +++ b/homeassistant/components/influxdb/__init__.py @@ -218,7 +218,7 @@ def _generate_event_to_json(conf: dict) -> Callable[[Event], dict[str, Any] | No 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 diff --git a/tests/components/influxdb/test_init.py b/tests/components/influxdb/test_init.py index 27b9ac82ade..78648852803 100644 --- a/tests/components/influxdb/test_init.py +++ b/tests/components/influxdb/test_init.py @@ -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",