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
72.81k stars 30.51k forks source link

Automation did not start with error not a valid value for dictionary value @ data['entity_id'] #99728

Closed smartmatic closed 1 year ago

smartmatic commented 1 year ago

The problem

I've created an automation but the automation is not executed

What version of Home Assistant Core has the issue?

2023.8.4

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

Automation

Link to integration documentation on our website

https://www.home-assistant.io/docs/automation/

Diagnostics information

No response

Example YAML snippet

alias: "Büro: Luftreiniger steuern"
description: ""
trigger:
  - platform: time_pattern
    hours: /1
condition:
  - condition: time
    after: "09:00:00"
    before: "18:00:00"
  - condition: state
    entity_id: binary_sensor.workday_sensor
    state: "on"
  - condition: numeric_state
    entity_id: sensor.luftqualitatssensor_buero_voc
    above: 200
action:
  - type: turn_on
    device_id: 7382748ec60f4c56f3eb9d4d11fa31b5
    entity_id: 87d7d41fa52db5911fa4a0ca8c511f08
    domain: fan
  - delay:
      hours: 0
      minutes: 30
      seconds: 0
      milliseconds: 0
  - type: turn_off
    device_id: 7382748ec60f4c56f3eb9d4d11fa31b5
    entity_id: 87d7d41fa52db5911fa4a0ca8c511f08
    domain: fan
mode: single

Anything in the logs that might be useful for us?

Logger: homeassistant.components.automation.buro_luftreiniger_steuern
Source: helpers/script.py:420
Integration: Automatisierung (documentation, issues)
First occurred: 13:35:49 (1 occurrences)
Last logged: 13:35:49

Büro: Luftreiniger steuern: Error executing script. Invalid data for device at pos 1: not a valid value for dictionary value @ data['entity_id']

Additional information

No response

tdejneka commented 1 year ago

not a valid value for dictionary value @ data['entity_id']

The error message claims that the value of entity_id (87d7d41fa52db5911fa4a0ca8c511f08) is not valid.

Re-create the automation's two Device Actions or, better yet, use two service calls instead (fan.turn_on and fan.turn_off).

smartmatic commented 1 year ago

Is it possible to display the device name instead of entity_id in yaml?

tdejneka commented 1 year ago

Have you tried what I suggested?

smartmatic commented 1 year ago

Yes, it seems using a service in actions solves the issue. I could manually test the automation without log errors.

smartmatic commented 1 year ago

Ticket can be closed. Thank you for the support.

jf-navica commented 1 year ago

Just got the same error in 2023.10.1. The error message is not really intuitive since HA lets us choose the following (device is an Inovelli ZW36 light and fan switch) from the action drop down. Maybe fan action shouldn't be listed?

image

kramttocs commented 1 year ago

@joostlek Please reopen this issue as it's a valid defect. While the service approach works, the Device action should also work. I am seeing this with a Treatlife DS03 fan/light combo switch. The Device actions for the lights work as expected whereas the fan generates the error in this ticket.

joostlek commented 1 year ago

Please create a separate issue. Otherwise this issue will become a never ending story with everyone with a slightly related problem.

joostlek commented 1 year ago

I think I see some PRs saying that this will be changed in 2023.11 as there are now check if automations are incorrect, checkout #102766. Please check if you experience the same next week (or if you feel special, you can try the beta later today) and if you have issues, please create a new issue

kramttocs commented 1 year ago

Thanks @emontnemery and @joostlek

emontnemery commented 1 year ago

I don't agree to close this issue yet, we should understand the root cause. I'd expect this to happen only if the device was replaced or removed from Home Assistant.

I suspect there's something else happening here, it's strange everyone is having problems specifically with combined fan +lights.

Please feel free to contact me on discord, I'm @emontnemery there too.

Otherwise, please add some more background here:

kramttocs commented 1 year ago

I am not positive about the OP but my situation is the same as @jf-navica.

They are using an Inovelli ZW36 light and fan switch I am using a Treatlife DS03 light and fan switch

Mine is a new device (in use for a week) with no previous automations or anything tied to it. Uses the Tuya-Local integration. From the dashboard or device itself I am able to control both the light and fan with no observed issues. I am also able to control the light via Device > Action in the automation. The fan options (on/off) show but they are the ones that generate the errors:

image

Using the Services for Fan do work (as the OP also confirmed).

Worth noting that the actions to Increase / Decrease the fan speed aren't present though doubt that is directly related.

I can also confirm that looking in the yaml for the automation I see the entity id change depending upon if I choose a Light action or a Fan action. So it does appear that it's correctly realizing there are two entities under that device.

jf-navica commented 1 year ago
  • What's the brand and model of the device not working?

Inovelli ZW36

  • What integration is providing the device in Home Assistant?

Z-Wave JS

  • Did the automation first work, and then it stopped working? If it worked at first, was something changed when it stopped working?

Automation never worked. I was controlling that fan via AppDaemon but decided to try through a local automation instead.

emontnemery commented 1 year ago

the actions to Increase / Decrease the fan speed aren't present

There's no such device action for fans, there's only turn on, turn off and toggle, so that's expected 👍

emontnemery commented 1 year ago

@kramttocs, @jf-navica Thanks for the input! I found the problem now, this will be fixed in Home Assistant Core 2023.11.0 👍