home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.9k stars 30.97k forks source link

Race Condition with Select entity. #97022

Open ryanm101 opened 1 year ago

ryanm101 commented 1 year ago

The problem

I have an automation to stop my battery from charging during peak rates.

alias: Charge Solar Battery From PV Only
description: ""
mode: single
trigger:
  - platform: state
    entity_id:
      - select.solar_imported_power_daily
    to: peak
action:
  - service: select.select_option
    data:
      option: Maximize Self Consumption
    target:
      entity_id: select.solaredge_i1_storage_default_mode
  - service: select.select_option
    data:
      option: Disabled
    target:
      entity_id: select.solaredge_i1_ac_charge_policy

Every so often (indeterminate number of days) the automation fails..

The trace is as follows:

Executed: 21 July 2023 at 09:00:00
----
Executed: 21 July 2023 at 09:00:00
Result:
result: false
message: value 'unavailable' is non-numeric and treated as False
----
Executed: 21 July 2023 at 09:00:11
Result:
params:
  domain: select
  service: select_option
  service_data:
    option: Disabled
    entity_id:
      - select.solaredge_i1_ac_charge_policy
  target:
    entity_id:
      - select.solaredge_i1_ac_charge_policy
running_script: false

I believe this is cause by another script i have running at 0900 that changes the state of the select to peak it's almost like if the CPU cycles align just right then the state has not finished changing by the time the automation triggered by the state change looks at the value. I expect this setup to work as this automation is trigged by the change of state not on a timer.

This was working say pre-march time I think BUT it is possible i just never noticed / the race was just never hit.

What version of Home Assistant Core has the issue?

2023.7.2

What was the last working version of Home Assistant Core?

No response

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

trace automation.charge_solar_battery_from_pv_only_2 2023-07-21T08_00_00.351235+00_00.txt

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment πŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

ryanm101 commented 1 year ago

Still an issue

home-assistant[bot] commented 1 year ago

Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (select) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `select` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign select` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


select documentation select source (message by IssueLinks)

issue-triage-workflows[bot] commented 10 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment πŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

ryanm101 commented 10 months ago

yet again not stale.. i have workarounds in place.

issue-triage-workflows[bot] commented 7 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment πŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

ryanm101 commented 7 months ago

yet again not stale.. i have workarounds in place.

issue-triage-workflows[bot] commented 4 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment πŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

ryanm101 commented 4 months ago

still an issue

issue-triage-workflows[bot] commented 1 month ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment πŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

ryanm101 commented 1 month ago

still an issue