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
69.66k stars 28.83k forks source link

Automation entity state does not match actual state #119711

Open labatt opened 2 weeks ago

labatt commented 2 weeks ago

The problem

Mobile App Version: 2024.6.2-full

I have an automation that triggers when my phone goes to wireless charging. I just upgraded from 2023.12.2 to 2024.6.1 (and then 2024.6.2).

sensor.sm_g973u_charger_type changes to wireless when I'm using Developer Tools > State and view the state. It also shows correctly when I look in the mobile app settings.

However, within the automation, the same sensor shows as blank/none. The automation does correctly pick up the transition from discharging to charging and starts but the criteria that it needs to be set to wireless fails. This worked prior to the upgrade.

Not sure if it's a mobile app or core issue.

What version of Home Assistant Core has the issue?

2024.6.2

What was the last working version of Home Assistant Core?

2024.12.2

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Mobile App

Link to integration documentation on our website

https://www.home-assistant.io/integrations/mobile_app/

Diagnostics information

None

Example YAML snippet

condition:
  - condition: and
    conditions:
      - condition: state
        state: wireless
        entity_id: sensor.sm_g973u_charger_type
        for:
          hours: 0
          minutes: 0
          seconds: 0
      - condition: state
        entity_id: switch.bedroom_fan
        state: 'off'
      - condition: time
        after: '23:00:00'
        before: '03:30:00'
        weekday:
          - sat
          - fri
          - thu
          - wed
          - tue
          - mon
          - sun

Anything in the logs that might be useful for us?

Chris Phone Charger Type changed to none
2:45:27 PM - 8 minutes ago
Chris Phone Is Charging was unplugged
2:45:27 PM - 8 minutes ago
Chris Phone Battery State changed to discharging
2:45:27 PM - 8 minutes ago
Chris Phone Charger Type changed to wireless
2:45:19 PM - 9 minutes ago
Chris Phone Is Charging was plugged in
2:45:19 PM - 9 minutes ago
Chris Phone Battery State changed to charging

Additional information

This is from the trace:

Executed: June 14, 2024 at 2:45:19 PM Result: result: false conditions/0 Executed: June 14, 2024 at 2:45:19 PM Result: result: false conditions/0/entity_id/0 Executed: June 14, 2024 at 2:45:19 PM Result: result: false state: none wanted_state: wireless

home-assistant[bot] commented 2 weeks ago

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

Code owner commands Code owners of `mobile_app` 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 mobile_app` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


mobile_app documentation mobile_app source (message by IssueLinks)

labatt commented 2 weeks ago

By the way.. debug log shows wireless (this isn't from the automation run above but I just wanted to make sure the log was showing the correct info):

2024-06-14 15:06:34.501 DEBUG (MainThread) [homeassistant.components.mobile_app.webhook] Received webhook payload from SM-G973U for type update_sensor_states: [{'unique_id': 'sleep_segment', 'state': 25920000.0, 'type': 'sensor', 'icon': 'mdi:sleep', 'attributes': {'end': 1718370223652, 'start': 1718344303652, 'status': 'successful'}}, {'unique_id': 'battery_level', 'state': 38, 'type': 'sensor', 'icon': 'mdi:battery-charging-30', 'attributes': {}}, {'unique_id': 'battery_state', 'state': 'charging', 'type': 'sensor', 'icon': 'mdi:battery-plus', 'attributes': {'options': ['charging', 'discharging', 'full', 'not_charging']}}, {'unique_id': 'is_charging', 'state': True, 'type': 'binary_sensor', 'icon': 'mdi:power-plug', 'attributes': {}}, {'unique_id': 'charger_type', 'state': 'wireless', 'type': 'sensor', 'icon': 'mdi:power-plug', 'attributes': {'options': ['ac', 'usb', 'wireless', 'dock', 'none']}}, {'unique_id': 'battery_temperature', 'state': 22.5, 'type': 'sensor', 'icon': 'mdi:battery', 'attributes': {}}, {'unique_id': 'battery_power', 'state': 0.0, 'type': 'sensor', 'icon': 'mdi:battery-minus', 'attributes': {'current': -0.000752,