Open smartroad opened 2 years ago
You can use info template to achieve this.
Suppose you have a temperature sensor entity named temp_sensor
under Home Assistant which provides temperature values under the state or any other attributes then you can use it in info_template
parameter as follows:
states[temp_sensor].state
Or
states[temp_sensor].attributes.temperature
The following example uses states[temp_sensor].attributes.temperature
to show the temperature fetched from local sensor.
wallpanel_screensaver:
...
...
info_template: '
<div id="wallpanel-screensaver-info-weather">
<table>
<tr>
<th><img id="weather-temperature-icon" src="{{ filesParentPath }}/weather-icons/thermometer.svg"/></th>
<th>{{ states[temp_sensor].attributes.temperature }}° </th>
<th><img id="weather-state-icon" src="{{ filesParentPath }}/weather-icons/{{ states[config.weather_entity].state }}-sun-{{ states["sun.sun"].state.replace("_", "-"); }}.svg"/></th>
<th>{{ states[config.weather_entity].state.replace(/(^|\s)[A-Za-zÀ-ÖØ-öø-ÿ]/g, c => c.toUpperCase()) }}</th>
</tr>
</table>
</div>
<div id="wallpanel-screensaver-info-time">{{ (new Date()).toLocaleTimeString(undefined, {hour: "2-digit", minute:"2-digit", hour12: config.hour_12}) }}</div>
<div id="wallpanel-screensaver-info-date">{{ (new Date()).toLocaleDateString(undefined, {weekday: "short", year: "numeric", month: "short", day: "numeric"}) }}</div>'
Thanks for the reply! I can't seem to get it to work, copy and pasted your example, changing temp_sensor to the name of the sensor in my instance (listed as sensor.xxx_room_temperature
) but I get an error saying:
ReferenceError: sensor is not defined
or
ReferenceError: xxx_room_temperature is not defined
if I drop the sensor.
(xxx is a person's name so am masking it here)
Here is the listing in HA:
Sorry for being dumb and unable to figure this out :(
try to use "" like this: "sensor.xxx_room_temperature". It is worked for me
I use the following and it works perfectly
{{ states["sensor name here"].state }}
Thanks for the advice!! finally had time to look at it here is what worked for me:
Hi! I was just wondering on the screen saver, is there anyway to have the temperature show the sensor I have in the room that it is in rather than the fetched outside temp?
Sorry if i have missed in the instructions!