[SOLVED] Binary_sensors "unknown" since recent update


Since a recent update (maybe the 2022.2.9), all my binary_sensors are now unknown. For exemple, I have this one :

  friendly_name: Alarm
  value_template: "{{ 'disarmed' != states('alarm_control_panel.home') }}"

In the developer console I get :

{{ 'disarmed' != states('alarm_control_panel.home') }} => false
{{ states('binary_sensor.alarm') }} => unknown

Sale issue for all my binary_sensors. Do I need to change something ?

Thank you !

Binary_sensors got recently the extra state ‘unknown’. After a restart/reload the binary_sensor gets the state ‘unknown’ until the first state update.

I just tried both the old and new template binary_sensor formats and both respond as expected:

- platform: template
      value_template: "{{ 'armed_away' != states('alarm_control_panel.aarlo_base_station') }}"
- binary_sensor:

  - name: test
    state: "{{ 'armed_away' != states('alarm_control_panel.aarlo_base_station') }}"

Both result in a state of ‘on’ when the state of the entity is not ‘armed_away’. I recommend looking in DevTools->States to see whether you’re using the right entity_id. It’s possible that there’s a name conflict and the name has been changed to binary_sensor.alarm_2 or something like that.

Thank you for your answers ! I finally found that my history was empty, so I deleted my database file and all is ok now !