Automation to set a state

Yes, from quite a long way back.

I’ll give the restore a go first.

I renamed automations.yaml to automations.yaml.bk, restarted HA, got HA restarted in safe mode, created a blank automations.yaml, restarted HA and it’s fixed! Automations created in the visual editor will now save.

Thank you! :smiley:

So now you need to post the contents of your backup of automations.yaml - and we’ll see if we can spot what was wrong that was causing it to break.

It’s at post 9. The separate automations within it work if loaded separately but with them both loaded together they don’t work.

Yeah but it might be something else in the automation file that is causing the problem, eg a duplicate automation - perhaps 2 automations with the same ID even if they are different automations.

I had just the two. It’s taken me no time to rebuild them though the one to stop the battery discharging has morphed into two as I couldn’t find a way to code for an entity state to be ‘not’. The two now look for ‘changed to Charging’ in one and ‘changed from Charging’ in the other.

condition:
  not:
    - condition: state
      entity_id: sensor.some_sensor
      state: charging

Something like that.

1 Like

Doh! Thanks again.

I would recommend double checking the state in the states page in developer tools, because you are looking for “Charging” and typically states are in lowercase in Home Assistant, unless you have set them yourself from something like a Template sensor.

Yes, ‘Charging’ it is.

1 Like