Possible to change state of entity?

Once again, I need your help. As I mentioned in my first post, I have poor programming skills. I’m currently trying to change the state of an entity in an automation. The state ‘wash’ exists. The sensor changes from ‘idle’ to ‘wash’ when I manually trigger it. What is the error in this code?

trigger:
  - platform: state
    entity_id:
      - input_boolean.start
    from: "off"
    to: "on"
condition: []
action:
  - service: homeassistant.update_entity
    target:
      entity_id: sensor.152832116377692_progress
    data:
      state: wash
mode: single

When I test this, the following error message appears: extra keys not allowed @ data[‘state’]. Got None

Thank you so far.

There is no data. update_entity tells the entity to update itself, you can’t force it to accept a state it does not have. Show how you defined sensor.152832116377692_progress

And please, format your code

1 Like

I didn’t define the sensor in the code at all. And it only has ICON and Friendly_Name as attributes. Do I need to define it in the code? And if yes, as what? Thank you very much for your help.

Where does it come from ?

from my dishwasher

The integration of the washing machine only provides the option to turn it on, but there is no option to start it. When I start it manually, the sensor switches from ‘Ready’ to ‘Washing’."

Setting the sensor won’t help with that. A sensor is well, only a sensor, not a command.

So it is currently not possible to implement the start. right ?

Not the way you try it. You have to see in the integration of your dishwasher if there is a way to start it.

there is no. i will start an issue on github. maype it will help me and other.

Nevertheless, thank you very much.

Although I agree with comments above about command vs. state… if you need a solution then there is the HACS ‘entities’ script

pmazz/ps_hassio_entities: Python script to handle state and attributes of existing sensors and entities (github.com)