Is it possible to use the entity picture of a sensor in another sensor?
Maybe something like this customization (which is not working):
sensor.xyz:
entity_picture: '{{ states.sensor.abc.attributes.entity_picture }}'
Is it possible to use the entity picture of a sensor in another sensor?
Maybe something like this customization (which is not working):
sensor.xyz:
entity_picture: '{{ states.sensor.abc.attributes.entity_picture }}'
Hi @mbonani
Maybe I don’t understand your question properly, so sorry if this is the case.
It is possible to customize the icon you want for your items. There is a property for that: icon
For example:
chromecast_radio:
name: 'Select speakers:'
options:
- Kitchen
- Playroom
- Living room
initial: Kitchen
icon: mdi:speaker-wireless
To find suitable MDI icons this info is interesting.
Thank you for the message. I know and already use the icon customization in my config.
What I’m trying to do is use the entity picture from a weather sensor as the entity picture of another sensor, just to save space on the display.
Following the examples from this post Map device “state” to an icon I was able to do what I wanted, kinda.
Sensors:
- platform: worldclock
name: "Local Time"
time_zone: America/New_York
- platform: worldclock
name: "Chicago Clock"
time_zone: America/Chicago
- platform: worldclock
name: "Los Angeles Clock"
time_zone: America/Los_Angeles
- platform: darksky
api_key: !secret darksky_key
update_inverval:
minutes: 5
monitored_conditions:
- summary
- icon
- platform: darksky
api_key: !secret darksky_key
update_inverval:
minutes: 5
name: chicago
latitude: 41.878132
longitude: -87.628796
monitored_conditions:
- summary
- icon
- platform: darksky
api_key: !secret darksky_key
update_inverval:
minutes: 5
name: los_angeles
latitude: 34.050908
longitude: -118.263446
monitored_conditions:
- summary
- icon
- platform: template
sensors:
local_time_template:
value_template: "{{ states('sensor.local_time') }}"
icon_template: >
{% if is_state('sensor.dark_sky_icon', 'clear-day') %}
mdi:weather-sunny
{% elif is_state('sensor.dark_sky_icon', 'clear-night') %}
mdi:weather-night
{% elif is_state('sensor.dark_sky_icon', 'rain') %}
mdi:weather-rainy
{% elif is_state('sensor.dark_sky_icon', 'snow') %}
mdi:weather-snowy
{% elif is_state('sensor.dark_sky_icon', 'sleet') %}
mdi:weather-snowy-rainy
{% elif is_state('sensor.dark_sky_icon', 'wind') %}
mdi:weather-windy-variant
{% elif is_state('sensor.dark_sky_icon', 'fog') %}
mdi:weather-fog
{% elif is_state('sensor.dark_sky_icon', 'cloudy') %}
mdi:weather-cloudy
{% elif is_state('sensor.dark_sky_icon', 'partly-cloudy-day') or is_state('sensor.dark_sky_icon', 'partly-cloudy-night') %}
mdi:weather-partlycloudy
{% elif is_state('sensor.dark_sky_icon', 'hail') %}
mdi:weather-hail
{% elif is_state('sensor.dark_sky_icon', 'thunderstorm') %}
mdi:weather-lightning
{% else %}
mdi:help-circle
{% endif %}
chicago_template:
value_template: "{{ states('sensor.chicago_clock') }}"
icon_template: >
{% if is_state('sensor.chicago_icon', 'clear-day') %}
mdi:weather-sunny
{% elif is_state('sensor.chicago_icon', 'clear-night') %}
mdi:weather-night
{% elif is_state('sensor.chicago_icon', 'rain') %}
mdi:weather-rainy
{% elif is_state('sensor.chicago_icon', 'snow') %}
mdi:weather-snowy
{% elif is_state('sensor.chicago_icon', 'sleet') %}
mdi:weather-snowy-rainy
{% elif is_state('sensor.chicago_icon', 'wind') %}
mdi:weather-windy-variant
{% elif is_state('sensor.chicago_icon', 'fog') %}
mdi:weather-fog
{% elif is_state('sensor.chicago_icon', 'cloudy') %}
mdi:weather-cloudy
{% elif is_state('sensor.chicago_icon', 'partly-cloudy-day') or is_state('sensor.chicago_icon', 'partly-cloudy-night') %}
mdi:weather-partlycloudy
{% elif is_state('sensor.chicago_icon', 'hail') %}
mdi:weather-hail
{% elif is_state('sensor.chicago_icon', 'thunderstorm') %}
mdi:weather-lightning
{% else %}
mdi:help-circle
{% endif %}
los_angeles_template:
value_template: "{{ states('sensor.los_angeles_clock') }}"
icon_template: >
{% if is_state('sensor.los_angeles_icon', 'clear-day') %}
mdi:weather-sunny
{% elif is_state('sensor.los_angeles_icon', 'clear-night') %}
mdi:weather-night
{% elif is_state('sensor.los_angeles_icon', 'rain') %}
mdi:weather-rainy
{% elif is_state('sensor.los_angeles_icon', 'snow') %}
mdi:weather-snowy
{% elif is_state('sensor.los_angeles_icon', 'sleet') %}
mdi:weather-snowy-rainy
{% elif is_state('sensor.los_angeles_icon', 'wind') %}
mdi:weather-windy-variant
{% elif is_state('sensor.los_angeles_icon', 'fog') %}
mdi:weather-fog
{% elif is_state('sensor.los_angeles_icon', 'cloudy') %}
mdi:weather-cloudy
{% elif is_state('sensor.los_angeles_icon', 'partly-cloudy-day') or is_state('sensor.los_angeles_icon', 'partly-cloudy-night') %}
mdi:weather-partlycloudy
{% elif is_state('sensor.los_angeles_icon', 'hail') %}
mdi:weather-hail
{% elif is_state('sensor.los_angeles_icon', 'thunderstorm') %}
mdi:weather-lightning
{% else %}
mdi:help-circle
{% endif %}
Groups:
world_clock:
name: "World Clock"
entities:
- sensor.local_time_template
- sensor.chicago_template
- sensor.los_angeles_template
This resulted in the following card:
I want to use entity pictures instead of icons, but I still haven’t found a way. Well, back to the drawing board.