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

Short-lived toggles broken after 2024.5.0 update #117781

Open
silamon opened this issue May 20, 2024 · 0 comments
Open

Short-lived toggles broken after 2024.5.0 update #117781

silamon opened this issue May 20, 2024 · 0 comments

Comments

@silamon
Copy link
Contributor

silamon commented May 20, 2024

The problem

This is an issue for an issue that was originally reported at home-assistant/frontend#20807.
Bisecting brought me to #114709, which somehow has changed the order of events coming through on the websocket in this case.

Reproduction example:

  1. Create a new Toggle Helper "Toggle 1" (e.g. input_boolean.toggle_1)
  2. Create a new automation "Test Toggle Off" (e.g. automation.test_toggle_off) with the following:
trigger:
- platform: state
  entity_id:
  - input_boolean.toggle_1
  to: 'on'
condition: []
action:
- service: input_boolean.turn_off
  metadata: {}
  data: {}
  target:
    entity_id:
    - input_boolean.toggle_1
mode: single
  1. Create a sample dashboard:
views:
  - title: Home
    cards:
      - type: vertical-stack
        cards:
          - type: entities
            entities:
              - entity: input_boolean.toggle_1
                secondary_info: last-changed
              - entity: automation.test_toggle_off
                secondary_info: last-triggered
          - type: logbook
            entities:
              - entity: input_boolean.toggle_1

Given version 2024.4.4, the toggle in the frontend would be turned off after turning on. (Note that the automation turns it off immediately). In version 2024.5.0, the toggle in the frontend remains on, although refreshing the frontend will show it off.

The logbook card also shows events in a different order as reported in the original issue indicating that the persisting of events has changed as well.

What version of Home Assistant Core has the issue?

2024.5.0

What was the last working version of Home Assistant Core?

2024.4.4

What type of installation are you running?

Home Assistant OS

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Websocket messages from 2024.4

{"type":"call_service","domain":"input_boolean","service":"turn_on","service_data":{"entity_id":"input_boolean.toggle_1"},"id":44}

[
  {"type":"event","event":{"c":{"input_boolean.toggle_1":{"+":{"s":"on","lc":1716192010.891781,"c":{"parent_id":null,"user_id":"c4e0d7e7ab604fcdbbde18031e3fff11","id":"01HYAG7RMBPDQYA0BQ5ANF2E24"}}}}},"id":3},
  {"id":44,"type":"result","success":true,"result":{"context":{"id":"01HYAG7RMBPDQYA0BQ5ANF2E24","parent_id":null,"user_id":"c4e0d7e7ab604fcdbbde18031e3fff11"}}},
  {"type":"event","event":{"c":{"automation.test_toggle_off":{"+":{"lu":1716192010.89481,"c":{"parent_id":"01HYAG7RMBPDQYA0BQ5ANF2E24","id":"01HYAG7RME8SQJ4B2E5HJ94EM1"},"a":{"last_triggered":"2024-05-20T08:00:10.894773+00:00","current":1}}}}},"id":3},
  {"type":"event","event":{"c":{"input_boolean.toggle_1":{"+":{"s":"off","lc":1716192010.896959,"c":{"parent_id":"01HYAG7RMBPDQYA0BQ5ANF2E24","user_id":null,"id":"01HYAG7RME8SQJ4B2E5HJ94EM1"}}}}},"id":3},
  {"type":"event","event":{"c":{"automation.test_toggle_off":{"+":{"lu":1716192010.897191,"a":{"current":0}}}}},"id":3}
]

{"id":40,"type":"event","event":{"events":[
  {"when":1716192010.891781,"state":"on","entity_id":"input_boolean.toggle_1","icon":"mdi:toggle-switch-variant","context_user_id":"c4e0d7e7ab604fcdbbde18031e3fff11","context_domain":"input_boolean","context_service":"turn_on","context_event_type":"call_service"},
  {"when":1716192010.896959,"state":"off","entity_id":"input_boolean.toggle_1","icon":"mdi:toggle-switch-variant","context_event_type":"automation_triggered","context_domain":"automation","context_name":"test toggle off","context_message":"triggered by state of input_boolean.toggle_1","context_source":"state of input_boolean.toggle_1","context_entity_id":"automation.test_toggle_off"}
]}}

---
Websocket messages from 2024.5

{"type":"call_service","domain":"input_boolean","service":"turn_on","service_data":{"entity_id":"input_boolean.toggle_1"},"id":44}

[
  {"type":"event","event":{"c":{"automation.test_toggle_off":{"+":{"lu":1716193307.893035,"c":{"parent_id":"01HYAHFB7KQQAHJQY1F11FNJVQ","id":"01HYAHFB7M058B1MEGKQXCHMYS"},"a":{"last_triggered":"2024-05-20T08:21:47.892999+00:00","current":1}}}}},"id":3},
  {"type":"event","event":{"c":{"input_boolean.toggle_1":{"+":{"s":"off","lc":1716193307.896118,"c":{"parent_id":"01HYAHFB7KQQAHJQY1F11FNJVQ","user_id":null,"id":"01HYAHFB7M058B1MEGKQXCHMYS"}}}}},"id":3},
  {"type":"event","event":{"c":{"automation.test_toggle_off":{"+":{"lu":1716193307.896411,"a":{"current":0}}}}},"id":3},
  {"type":"event","event":{"c":{"input_boolean.toggle_1":{"+":{"s":"on","lc":1716193307.89205,"c":{"parent_id":null,"user_id":"c4e0d7e7ab604fcdbbde18031e3fff11","id":"01HYAHFB7KQQAHJQY1F11FNJVQ"}}}}},"id":3},
  {"id":44,"type":"result","success":true,"result":{"context":{"id":"01HYAHFB7KQQAHJQY1F11FNJVQ","parent_id":null,"user_id":"c4e0d7e7ab604fcdbbde18031e3fff11"}}}
]

{"id":40,"type":"event","event":{"events":[
  {"when":1716193307.896118,"state":"off","entity_id":"input_boolean.toggle_1","icon":"mdi:toggle-switch-variant","context_event_type":"automation_triggered","context_domain":"automation","context_name":"test toggle off","context_message":"triggered by state of input_boolean.toggle_1","context_source":"state of input_boolean.toggle_1","context_entity_id":"automation.test_toggle_off"},
  {"when":1716193307.89205,"state":"on","entity_id":"input_boolean.toggle_1","icon":"mdi:toggle-switch-variant","context_user_id":"c4e0d7e7ab604fcdbbde18031e3fff11","context_domain":"input_boolean","context_service":"turn_on","context_event_type":"call_service"}
]}}

Additional information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant