I’ve been using the template platform for sensors to create little images inside of the UI circles that change when the state of the underlying entity changes.
Those sensors don’t control the entities, however.
Is there a way to use entity_picture_template to customize any entity? It seems that the only entities that respond to the entity_picture_template are sensors.
The goal is to add the entities to an entity card in Lovelace with more than just an Icon to indicate On or Off, etc. I’d like the actual PNG file that I’ve created for on/off status to be displayed in the card instead of the mdi:icon.
are you referring to the basic entity card? This type of customization depends on the card and the basic entity card just emulates a normal card in home assistant.
If you want crazy image customization and placement, I suggest the picture elements card. You can pretty much do whatever you want.
Currently, I have binary_sensors to detect is a device_tracker is home or away solely for the purpose of adding a small circle with a picture of the person in it. When they are here, the picture is in color. When they are not here, it is black and white.
It doesn’t seem to be that I can do this with any entities other than sensors. If I add any entities card to Lovelace, they default to one of the MDI icons unless it’s a sensor.
There doesn’t seem to be, through customize.yaml, a way to use images to customize the entity icons (like the sensors in the normal UI). The problem with that is that a sensor doesn’t offer direct control of the entity that is sensed.
Pulled directly from the link I sent you in the picture element card that does exactly what you want:
IMAGE ELEMENT
CONFIGURATION VARIABLES
type
(string)(Required)image
entity
(string)(Optional)Entity to use for state_image and state_filter and also target for actions.
tap_action
(string)(Optional)none, more-info, toggle, navigate, call-service
Default value: more-info
navigation_path
(string)(Optional)Url path to navigate to (e.g. /lovelace/1)
service
(string)(Optional)Service to call (e.g. light.turn_on)
service_data
(object)(Optional)The service data to use.
image
(string)(Optional)The image to display.
camera_image
(string)(Optional)A camera entity.
state_image
(object)(Optional)State-based images
filter
(string)(Optional)Default CSS filter
state_filter
(object)(Optional)State-based CSS filters
style
(object)(Required)Position and style the element using CSS.
Default value: position: absolute, transform: translate(-50%, -50%)
But what if I have more entities
for example, light.bed_light1 and light.bed_light2
A chi solve their states in one card:
When light.bed_light1 and light.bed_light2 is OFF then image_off.jpg
When light.bed_light1 is ON and light.bed_light is OFF then image 1-ON.jpg
When light.bed_light1 is OFF and light.bed_light is ON then picture 2-ON.jpg
And finally when is ON both light.bed_light1 and light.bed_light2 then image_ON.jpg
I don’t know how to write this can anyone advise me?
Thanks
Thank you everything works I still need to resolve a fixed address for the pictures.
I have HA on Synology and /local/…/picture/xy.png doesn’t work.
Otherwise, thank you very much for your help
The sensor and card work great
I edited the card through Configuration > Lovelace-dashboards > YAML-editor.
When surrounding the states with quotes they disappear as soon as I hit ‘save’.
At the bottom I added an extra image, which is probably the image the elements are placed on. I my case just a square white rectangle. Thereafter styled the image…