Issue with NC contacts (Alarm) since certain HA update

Hello,

I’m having issues with NC contacts mounted onto the windows in our house. Since one of the recent updates (a couple of months ago) it started to generate false positives.

This night it happened again. 5 minutes before 1am all the knx analog contacts triggered an alarm which causes the lights in our master bedroom to turn on. It’s now the third time this happens in the recents months and I don’t have a clue how to troubleshoot, resolve or find the root cause.

most of the magnetic contacts have their own KNX interface coupled on the bus. Since multiple KNX modules are being used I think it’s safe to rule out that it could be a KNX issue.

The only think I can add is that is was working fine for over two years and that I’m feeling that HA is doing a reset or generating a false positive at some point. My best guess is that HA reads out the states of the sensors and creates the false positive.

the config (not changed in years)

/config/knx_binary_sensor.yaml

# Magnetic Contacts
- name: schuifraam
  state_address: '2/5/4'
  device_class: window
- name: achterdeur
  state_address: '3/5/0'
  device_class: door
- name: voordeur
  state_address: '1/5/6'
  device_class: door
- name: garagepoort
  state_address: '4/5/0'
  device_class: garage_door
- name: tuinhuis
  state_address: '11/5/1'
  device_class: door
- name: atelier tuindeur
  state_address: '12/5/0'
  device_class: door
- name: atelier straatdeur
  state_address: '12/5/1'
  device_class: door

for each sensor I have a seperate automation that triggers the HA night Alarm

alias: "[security] [mag] voordeur change"
description: ""
trigger:
  - entity_id: binary_sensor.voordeur
    platform: state
    to: "on"
  - entity_id: binary_sensor.voordeur
    platform: state
    to: "off"
condition:
  - condition: or
    conditions:
      - condition: state
        entity_id: alarm_control_panel.home_alarm
        state: armed_away
      - condition: state
        entity_id: alarm_control_panel.home_alarm
        state: armed_night
      - condition: state
        entity_id: alarm_control_panel.home_alarm
        state: triggered
action:
  - data:
      message: Voordeur werd zopas geopend
      title: Alarm
    service: notify.notify
  - data:
      message: Voordeur werd zopas geopend
      title: Alarm
    service: persistent_notification.create
  - entity_id: alarm_control_panel.home_alarm
    service: alarm_control_panel.alarm_trigger

When the HA night alarm is triggered it turns on the lights

alias: "[security] [triggered] night alarm action"
description: ""
trigger:
  - entity_id: alarm_control_panel.home_alarm
    from: armed_night
    platform: state
    to: triggered
condition: []
action:
  - scene: scene.night_alarm
  - data:
      colour: red
      message: Nachtalarm is zopas afgegaan!
      title: Alarm
    service: notify.notify
  - data:
      message: Nachtalarm is zopas afgegaan!
      title: Alarm
    service: persistent_notification.create

and the corresponding scene

- id: '1582200584648'
  name: night alarm actions
  entities:
    light.dressing:
      friendly_name: Dressing
      state: 'on'
      supported_features: 0
    light.master_bedroom:
      friendly_name: Master Bedroom
      state: 'on'
      supported_features: 0
    light.master_bedroom_dimmer:
      brightness: 255
      friendly_name: Master Bedroom Dimmer
      state: 'on'
      supported_features: 1
    light.overloop:
      friendly_name: Overloop
      state: 'on'
      supported_features: 0
    light.spot_beesten:
      friendly_name: Spot Beesten
      state: 'on'
      supported_features: 0
    light.spot_tuinhuis:
      friendly_name: Spot Tuinhuis

It all starts at the false positive trigger, all magnetic contacts are opened at the same time when we are a sleep and I’m pretty sure it’s not caused by a ghost :slight_smile:

Help is welcome,
thank you
Stijn

You are triggering when the the binary sensor changes to on or to off.

If your sensor drops out (becomes “unavailable”) it will trigger your automation when it reconnects.

Change the triggers to this instead:

trigger:
  - entity_id: binary_sensor.voordeur
    platform: state
    from: "off"
    to: "on"

This will prevent unavailable to off or even unavailable to on triggering the alarm.

You can see if that happend in the history of your sensors (either all knx sensors are unavailable or none is so it doesn’t really matter which triggered for that special case).

Correct,

The idea was when we choose to leave a window or sliding door open and something or somebody closes it when the night alarm is on that we trigger the alarm as well.

When I think about it, normally we don’t leave anything open (except for the sliding window door to cool down during the night). but when it’s already open it’s unlikely that a thief will close it :slight_smile:

I still believe that something changed to the KNX integration that triggers the false positive so maybe it’s worth looking into this in case another HA user has a different scenerio where the ON to OFF needs to work. (could be a bug?)

Thank you already for the value info and time to read through this issue. I will make the necessary changes and reply in one or two months to this thread if it is resolved or not.

Kr,
Stijn

If you want both triggers, then do this to prevent the return from an unavailable state triggering the automation:

trigger:
  - entity_id: binary_sensor.voordeur
    platform: state
    from: "off"
    to: "on"
  - entity_id: binary_sensor.voordeur
    platform: state
    from: "on"
    to: "off"
1 Like

Has there even been an unavailable state? If so, have a look at your logs why that happened.

If it’s causing from an unavailable state I can probably fix the problem when using the optional “from” field and putting the value “on” in it.

Any idea which log I could check to find more information from following trigger?

Thank you Tom! could probably fix the issue.

Yes that is a good idea. But it’s curating the symptoms, not the cause.
Have a look here if it was unavailable: Open your Home Assistant instance and show your history panel.
See the logs here: Open your Home Assistant instance and show your Home Assistant logs.

1 Like

Thank you Farmio,

For some reason the hardest part for me was finding the log files back. since the system is already up for a long term I forgot how easy it was to find them back!

The root cause seems to be a disconnect on the KNX tunneling device, why this happens i’m not sure yet but I can see from the timestamps that HA is able to reconnect immediatly. This reconnection reads out the NC states of the magnetic contacts causing to trigger the automation.

Thanks a lot Farmio and tom_l for such a quick solution to this annoying problem.

Now I can literally again sleep better at night :slight_smile:

I give an update in a couple of months anyway

Greetings
Stijn

2022-08-18 00:55:04.625 WARNING (KNX Interface) [xknx.log] Received DisconnectRequest from tunnelling sever.
2022-08-18 00:55:04.655 ERROR (MainThread) [homeassistant.helpers.template_entity] TemplateError('ValueError: Template error: float got invalid input 'unavailable' when rendering template '{{ (states('sensor.water')|float * 1000) | round(0) }}' but no default was specified') while processing template 'Template("{{ (states('sensor.water')|float * 1000) | round(0) }}")' for attribute '_attr_native_value' in entity 'sensor.water_consumption_l'
2022-08-18 00:55:04.662 ERROR (MainThread) [homeassistant.helpers.template_entity] TemplateError('ValueError: Template error: float got invalid input 'unavailable' when rendering template '{{ (states('sensor.waterarcus')|float / 1000 + 16.402) | round(0) }}' but no default was specified') while processing template 'Template("{{ (states('sensor.waterarcus')|float / 1000 + 16.402) | round(0) }}")' for attribute '_attr_native_value' in entity 'sensor.water_consumption_m3'
2022-08-18 00:55:04.664 ERROR (MainThread) [homeassistant.helpers.template_entity] TemplateError('ValueError: Template error: float got invalid input 'unavailable' when rendering template '{{ (states('sensor.elektriciteit')|float / 1000) | round(0) }}' but no default was specified') while processing template 'Template("{{ (states('sensor.elektriciteit')|float / 1000) | round(0) }}")' for attribute '_attr_native_value' in entity 'sensor.electricity_consumption_kwh'
2022-08-18 00:55:10.692 ERROR (MainThread) [homeassistant.components.mobile_app.notify] Requested entity was not found. This message is generated externally to Home Assistant.
2022-08-18 00:55:11.004 ERROR (MainThread) [homeassistant.components.mobile_app.notify] Requested entity was not found. This message is generated externally to Home Assistant.
2022-08-18 00:55:11.008 ERROR (MainThread) [homeassistant.components.mobile_app.notify] Requested entity was not found. This message is generated externally to Home Assistant.
2022-08-18 00:55:11.020 ERROR (MainThread) [homeassistant.components.mobile_app.notify] Requested entity was not found. This message is generated externally to Home Assistant.
2022-08-18 00:55:11.028 ERROR (MainThread) [homeassistant.components.mobile_app.notify] Requested entity was not found. This message is generated externally to Home Assistant.
2022-08-18 00:55:11.034 ERROR (MainThread) [homeassistant.components.mobile_app.notify] Requested entity was not found. This message is generated externally to Home Assistant.
2022-08-18 00:55:11.078 ERROR (MainThread) [homeassistant.components.mobile_app.notify] Requested entity was not found. This message is generated externally to Home Assistant.
2022-08-18 00:55:11.293 WARNING (MainThread) [xknx.log] Error: KNX bus did not respond in time (2.0 secs) to GroupValueRead request for: 4/6/23
2022-08-18 00:55:11.294 WARNING (MainThread) [xknx.log] Could not sync group address '4/6/23' (Water - Value)
2022-08-18 00:55:11.547 ERROR (MainThread) [homeassistant.components.mobile_app.notify] Requested entity was not found. This message is generated externally to Home Assistant.
2022-08-18 00:55:11.790 WARNING (MainThread) [xknx.log] Error: KNX bus did not respond in time (2.0 secs) to GroupValueRead request for: 4/6/50
2022-08-18 00:55:11.792 WARNING (MainThread) [xknx.log] Could not sync group address '4/6/50' (gasmeter - Value)
2022-08-18 00:55:11.793 ERROR (MainThread) [homeassistant.components.mobile_app.notify] Requested entity was not found. This message is generated externally to Home Assistant.
2022-08-18 00:55:11.851 ERROR (MainThread) [homeassistant.components.mobile_app.notify] Requested entity was not found. This message is generated externally to Home Assistant.
2022-08-18 00:55:11.882 ERROR (MainThread) [homeassistant.components.mobile_app.notify] Requested entity was not found. This message is generated externally to Home Assistant.
2022-08-18 00:55:11.892 ERROR (MainThread) [homeassistant.components.mobile_app.notify] Requested entity was not found. This message is generated externally to Home Assistant.
2022-08-18 00:55:11.914 ERROR (MainThread) [homeassistant.components.mobile_app.notify] Requested entity was not found. This message is generated externally to Home Assistant.
2022-08-18 00:55:11.940 ERROR (MainThread) [homeassistant.components.mobile_app.notify] Requested entity was not found. This message is generated externally to Home Assistant.
2022-08-18 00:55:11.949 ERROR (MainThread) [homeassistant.components.automation.security_notify_alarm_triggered] [security] [triggered] notify: Error executing script. Invalid data for call_service at pos 1: extra keys not allowed @ data['colour']
2022-08-18 00:55:11.953 ERROR (MainThread) [homeassistant.components.automation.security_notify_alarm_triggered] Error while executing automation automation.security_notify_alarm_triggered: extra keys not allowed @ data['colour']
2022-08-18 00:55:11.968 ERROR (MainThread) [homeassistant.components.automation.security_night_alarm_activated] [security] [triggered] night alarm action: Error executing script. Invalid data for call_service at pos 2: extra keys not allowed @ data['colour']
2022-08-18 00:55:11.971 ERROR (MainThread) [homeassistant.components.automation.security_night_alarm_activated] Error while executing automation automation.security_night_alarm_activated: extra keys not allowed @ data['colour']
2022-08-18 00:55:12.202 ERROR (MainThread) [homeassistant.components.automation.security_mag_tuinhuis] [security] [mag] tuinhuis change: Error executing script. Unexpected error for call_service at pos 3: 'triggered'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 447, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 680, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 930, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/alarm_control_panel/__init__.py", line 197, in async_alarm_trigger
await self.hass.async_add_executor_job(self.alarm_trigger, code)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/manual/alarm_control_panel.py", line 350, in alarm_trigger
if not self._trigger_time_by_state[self._active_state]:
KeyError: 'triggered'
2022-08-18 00:55:12.212 ERROR (MainThread) [homeassistant.components.automation.security_mag_tuinhuis] While executing automation automation.security_mag_tuinhuis
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 521, in async_trigger
await self.action_script.async_run(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1513, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 405, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 449, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 472, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 447, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 680, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 930, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/alarm_control_panel/__init__.py", line 197, in async_alarm_trigger
await self.hass.async_add_executor_job(self.alarm_trigger, code)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/manual/alarm_control_panel.py", line 350, in alarm_trigger
if not self._trigger_time_by_state[self._active_state]:
KeyError: 'triggered'
2022-08-18 00:55:12.239 ERROR (MainThread) [homeassistant.components.automation.security_mag_garagepoort] [security] [mag] garagepoort change: Error executing script. Unexpected error for call_service at pos 3: 'triggered'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 447, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 680, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 930, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/alarm_control_panel/__init__.py", line 197, in async_alarm_trigger
await self.hass.async_add_executor_job(self.alarm_trigger, code)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/manual/alarm_control_panel.py", line 350, in alarm_trigger
if not self._trigger_time_by_state[self._active_state]:
KeyError: 'triggered'
2022-08-18 00:55:12.243 ERROR (MainThread) [homeassistant.components.automation.security_mag_achterdeur] [security] [mag] achterdeur change: Error executing script. Unexpected error for call_service at pos 3: 'triggered'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 447, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 680, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 930, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/alarm_control_panel/__init__.py", line 197, in async_alarm_trigger
await self.hass.async_add_executor_job(self.alarm_trigger, code)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/manual/alarm_control_panel.py", line 350, in alarm_trigger
if not self._trigger_time_by_state[self._active_state]:
KeyError: 'triggered'
2022-08-18 00:55:12.248 ERROR (MainThread) [homeassistant.components.automation.security_mag_atelier_straatdeur_change] [security] [mag] atelier straatdeur change: Error executing script. Unexpected error for call_service at pos 3: 'triggered'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 447, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 680, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 930, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/alarm_control_panel/__init__.py", line 197, in async_alarm_trigger
await self.hass.async_add_executor_job(self.alarm_trigger, code)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/manual/alarm_control_panel.py", line 350, in alarm_trigger
if not self._trigger_time_by_state[self._active_state]:
KeyError: 'triggered'
2022-08-18 00:55:12.252 ERROR (MainThread) [homeassistant.components.automation.security_mag_voordeur] [security] [mag] voordeur change: Error executing script. Unexpected error for call_service at pos 3: 'triggered'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 447, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 680, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 930, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/alarm_control_panel/__init__.py", line 197, in async_alarm_trigger
await self.hass.async_add_executor_job(self.alarm_trigger, code)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/manual/alarm_control_panel.py", line 350, in alarm_trigger
if not self._trigger_time_by_state[self._active_state]:
KeyError: 'triggered'
2022-08-18 00:55:12.258 ERROR (MainThread) [homeassistant.components.automation.security_mag_garagepoort] While executing automation automation.security_mag_garagepoort
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 521, in async_trigger
await self.action_script.async_run(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1513, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 405, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 449, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 472, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 447, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 680, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 930, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/alarm_control_panel/__init__.py", line 197, in async_alarm_trigger
await self.hass.async_add_executor_job(self.alarm_trigger, code)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/manual/alarm_control_panel.py", line 350, in alarm_trigger
if not self._trigger_time_by_state[self._active_state]:
KeyError: 'triggered'
2022-08-18 00:55:12.262 ERROR (MainThread) [homeassistant.components.automation.security_mag_achterdeur] While executing automation automation.security_mag_achterdeur
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 521, in async_trigger
await self.action_script.async_run(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1513, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 405, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 449, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 472, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 447, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 680, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 930, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/alarm_control_panel/__init__.py", line 197, in async_alarm_trigger
await self.hass.async_add_executor_job(self.alarm_trigger, code)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/manual/alarm_control_panel.py", line 350, in alarm_trigger
if not self._trigger_time_by_state[self._active_state]:
KeyError: 'triggered'
2022-08-18 00:55:12.263 ERROR (MainThread) [homeassistant.components.automation.security_mag_atelier_straatdeur_change] While executing automation automation.security_mag_atelier_straatdeur_change
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 521, in async_trigger
await self.action_script.async_run(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1513, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 405, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 449, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 472, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 447, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 680, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 930, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/alarm_control_panel/__init__.py", line 197, in async_alarm_trigger
await self.hass.async_add_executor_job(self.alarm_trigger, code)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/manual/alarm_control_panel.py", line 350, in alarm_trigger
if not self._trigger_time_by_state[self._active_state]:
KeyError: 'triggered'
2022-08-18 00:55:12.266 ERROR (MainThread) [homeassistant.components.automation.security_mag_voordeur] While executing automation automation.security_mag_voordeur
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 521, in async_trigger
await self.action_script.async_run(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1513, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 405, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 449, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 472, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 447, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 680, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 930, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/alarm_control_panel/__init__.py", line 197, in async_alarm_trigger
await self.hass.async_add_executor_job(self.alarm_trigger, code)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/manual/alarm_control_panel.py", line 350, in alarm_trigger
if not self._trigger_time_by_state[self._active_state]:
KeyError: 'triggered'
2022-08-18 00:55:12.287 ERROR (MainThread) [homeassistant.components.automation.security_mag_schuifraam] [security] [mag] schuifraam change: Error executing script. Unexpected error for call_service at pos 3: 'triggered'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 447, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 680, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 930, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/alarm_control_panel/__init__.py", line 197, in async_alarm_trigger
await self.hass.async_add_executor_job(self.alarm_trigger, code)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/manual/alarm_control_panel.py", line 350, in alarm_trigger
if not self._trigger_time_by_state[self._active_state]:
KeyError: 'triggered'
2022-08-18 00:55:12.290 ERROR (MainThread) [homeassistant.components.automation.security_mag_schuifraam] While executing automation automation.security_mag_schuifraam
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 521, in async_trigger
await self.action_script.async_run(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1513, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 405, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 449, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 472, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 447, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 680, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 930, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/alarm_control_panel/__init__.py", line 197, in async_alarm_trigger
await self.hass.async_add_executor_job(self.alarm_trigger, code)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/manual/alarm_control_panel.py", line 350, in alarm_trigger
if not self._trigger_time_by_state[self._active_state]:
KeyError: 'triggered'

Would you have whatever came before that in the logs too? My intention is to track down that issue in the Knx Integration.
Which interface are you using?

Weinzierl KNX IP router 751

logs

I tried finding back the xknx.log through SSH and webui but currently unsuccesful. Maybe I need to add it to the HA config first (according the docs)

logger:
  default: warning
  logs:
    # For most debugging needs `xnx.log` and one of `xknx.knx` or `xknx.telegram` are a good choice.
    xknx: debug  # sets the level of all loggers
    xknx.log: debug  # provides general information (connection, etc.)
    xknx.raw_socket: debug  # logs incoming UDP frames in raw hex format
    xknx.knx: debug  # logs incoming and outgoing KNX/IP frames at socket level
    xknx.telegram: debug  # logs telegrams before they are being processed at device level or sent to an interface
    xknx.state_updater: debug  # provides information about the state updater

Then the question will still be where to find it.

Also we can find back multiple KNX disconnects but as long as the HA alarm is not in “Armed Night” I did not encounter any other problems with the reconnection and reinitialization.

Thank you
Stijn

There is only one log file - everything goes there. These options just change which logger (eg xknx.knx) writes there with according log level (default is info, debug will log more).
You can find eg these in the files you uploaded:

2022-08-17 20:05:03.837 WARNING (KNX Interface) [xknx.log] Received DisconnectRequest from tunnelling sever.

In a healthy Installation you should have 0 disconnects (except when you update or reboot some network gear).

If you have a look at your logs you’ll see they are full of timeouts, connection errors and

… took longer than the scheduled update interval

from various different integrations.

Something seems to be blocking your HA event loop (I guess) from time to time rendering other integrations broken.
Could you do a diagnostic download for eg. the knx integration (3-dot-menu): Open your Home Assistant instance and show your integrations.

Hi Matthias,

at this link you will find the knx diagnostics dpaste: 5QCXLHCK8

the daikin integration is doing great despites the errors, I have 4 daikin units all connecting over WIFI.

thanks to taking a look at it!

Do you happen to use HA in a Windows Hyper-V VM?

I did but I changed recently to virtualbox. A recent windows update broke the KNX connection and I was not able to use the integration anymore. I moved to virtualbox, removed Hyper-V and now it works again.

I believe that I already had the knx disconnections before the windows update on Hyper-V too. (I mirgated to virtualbox on the 3th of August. One thing I’m planning to do is migrate from the old ASRock Beebox computer that is running the VM to more recent hardware but this is something I still need to determine and plan once I know what hardware can suits my environment the best.

I can try to expedite this to rule out the current hardware and check the logs from the new system. One thing I already know for sure is that it won’t be running on windows again. Windows updates is just not reliable enough to use with HA.

Thanks
Stijn

1 Like