#Automation format issue

1 messages · Page 1 of 1 (latest)

tight oracle
#

I have an automation that gets a podcast url from a sensor and streams it. It was working fine up until recently until i noticed it starting send a blank url to the media device. I noticed in developers tools template editor it works fine when formatted like in first example below but when the automation is saved its dropping the "Friend')['url'] }}}" part onto new line. When i try the second example in the developer tools template editor it doesnt retrieve the url. Anyone know why this is happening/a way to keep the format like the first example in the automation? Thanks

      media:
        media_content_id: >-
          {{ state_attr('sensor.latest_podcasts_url', 'Conan O’Brien Needs A Friend')['url'] }}}
        media_content_type: music
        metadata: {}
        media_content_id: >-
          {{ state_attr('sensor.latest_podcasts_url', 'Conan O’Brien Needs A
          Friend')['url'] }}}
        media_content_type: music
        metadata: {}
steel lava
#

Are you sure the apostrophe in O'Brien isn't causing a problems with your single quotes?
Just to be safe, I would use double quotes for the entity and attribute IDs, etc.

solar dustBOT
#

To format your text as code, enter three backticks on the first line, press Enter for a new line, paste your code, press Enter again for another new line, and lastly three more backticks.
```yaml
example: here
```
Don't forget you can edit your post rather than repeatedly posting the same thing.

sonic spade
#

But O'Brien is indeed suspicious.

tight oracle
#

The strange thing is that it was working fine for weeks and the only thing that changed would have been updating home assistant. I hadnt touched the automation code, just went from working to one day i noticed it wasnt working anymore.

sonic spade
#

Than the whole automation and the trace can really help 🙂