How to change an attribute of an entity within an automation

I have what may be a strange question, but believe me, there is a reason. I am curious if there is syntax that I can use to change the value of an attribute string in an entity.

Here is the context. I am using the Alexa media player service within Home Assistant. I am using SharpTools.io as my dashboard/ui (Can’t say enough great things about that tool. So much easier to use than Lovelace and am able to create a fantastic tablet). Within SharpTools IO, they have a media tile that allows you to show album art. Working great, except, when you pause or stop music, the attribute “entity_picture” (which is a url for album art) stays to be what the last song played - till you play another song. Under developer tools within HA, I am able to set the value of that attribute (or any attribute) manually. Works great. I would love to have a way to change the album art to something else when the media player is stopped or paused.

I have been looking and trying various yaml syntax within an automation, but only getting errors.

Any thoughts out there?

There is a hacs solution for it
pmazz/ps_hassio_entities: Python script to handle state and attributes of existing sensors and entities (github.com)
But do note… as soon as the entity gets an update via HA …it will be set back

1 Like

THANK YOU!

Took me a little while to get it up and running (mostly because I am still new to yaml and have challenges with the syntax … and spacing)… but once I got it working it worked like a charm.

Also - regarding your note… I totally want the entity to be updated by HA … will happen when the music plays again.

Problem Solved! Thanks again!

Great and agree with the not-really-easy part… but when you get it … it is great, I use this in quite a few cases actually.
If you are now fine, do mark my post for solution so others can benefit from that in searching :slight_smile:

I am new to the community. I looked around and even searched how to mark it as a solution, but couldn’t see anything. I did find this by someone posted elsewhere… Marking a topic as solved?. In this article it is mentioned that the option isn’t always turned on. I think it may be because I didn’t originally put the question under a category. (I wasn’t certain where to put it under). Would love to mark it. If I am missing something, let me know. Thanks again!

Sigh…did not know this…anyhow… thanks and most important: it worked :slight_smile:

Can someone tell me if this is still in HACS? Because I can’t find it: