#Automation stopped working and can't be edited anymore

1 messages · Page 1 of 1 (latest)

cold fiber
#

So I noticed that the automation controlling my hot water stopped working (at least partially, the part to prevent cold water still kind of worked).
When I went to check, there was only empty background where the edit screen with the sections is on other automations.
I checked the automations.yaml and the code is still there.

I'm gonna add the contents of this automation, but first I wanted to check whether maybe the syntax for the (value_) templates changed:

  - condition: or
    conditions:
    - condition: template
      value_template: '{{ state_attr(''sensor.electricity_price'',''next_16h_min_price'')
        == state_attr(''sensor.electricity_price'',''current'').total }}'

I cannot remember all those double ' and when I copy the expression into the template section in dev tools it throws an error until I change them to normal ones.

I definitely noticed something "went missing" in my last condition which explains the automation's behaviour, but I don't know why the editing is broken.

soft dome
#

I would try creating that condition in a new automation and checking the YAML, it seems wrong to me.

#

The double 's are normal however.

cold fiber
#

I slapped the full automations.yaml into a yaml validator (yesterday)- as "yaml" it should be correct...
but the whole buiseness with the ' and '' is super weird..
I checked my oldest backup of the file, and that looks a bit different, it still has some " instead of the ' and ' where now '' stands (in some of the conditions)...

"Sadly it also only has the broken" last condition (which is kind of reversed... it's supposed to catch when there is no valid price level, not if the price level is part of [1,2,3,4] ....

soft dome
#

Well the last condition has no actions, so it'll catch things but not do anything. And you also have defaults, is that intentional?

cold fiber
#

The last condition should throw me a notification as error iirc. No default is probably intentional, it should only act on specific changes of the price levels...

soft dome
#

Well the default actions are sending notifications and so on. Not the last choice.

cold fiber
#

Eh... I mean either: changes from from [1,2,3,4] to another out of [1,2,3,4] OR the value is bogged OR do nothing (default)
But from the "bogged value" conditions things got lost somehow... I'm trying to find a backup atm to restore it... in case I forgot something that was also there...
Wait I misunderstood.... I have defaults... o-O

soft dome
#

Oh wait, can you check if there are tab characters in the YAML? It should use spaces. When I opened it there are tabs, but that could be an artefact of it being sent across.

#

There's also something that looks like inconsistent indentation with the last service, but maybe I broke something when I opened it 🤪

cold fiber
#

No tab symbols (as faar as I can tell/search for, my editors turn the tab into spaces automatically...
both last services are indented the same for me... not sure how that stuff can change ...

#

but it could be that this default somehow got in there... because the service is basically what should happen as result of the last condition

soft dome
#

I think the best thing to do would be to create the automation again in the UI and then delete the broken one, then you can make sure things are set up as you intended, and you'll be able to see traces when it next runs and figure out what is going wrong 😁

cold fiber
#

I can see the traces actually (well the last 4-5). But the editing is really weird...
It would be great to find out what corrupted this... Because on the 20th it looks like it worked (got notifications and heating from previous conditions)...

Okay. Changing the the automation back to having "{{ }}" on the outside and inside only single ' seems to have fixed it. Or maybe it was also just deleting that "default" and moving the actions up to the error condition.
I added a "not" in there now for it to make sense. but previously it was probably handled differently... (something missing after that line)...

soft dome