Hi,
When I use stateformat with this I get the nice value of the temperature
{sprintf("%.1f °C", ReadingsVal($name,"temperature",0))}
When I do is stateformat: temp_temperature, I get the icon form the devstateicon.
I try to combine this in stateformat, but than the icon still works but the value not. Then it prints the code and not the output. Any idea how to solve this?
stateFormat temp_temperature \
{sprintf("%.1f °C", ReadingsVal($name,"temperature",0))}
This should work:
stateFormat {sprintf("temp_temperature %.1f °C", ReadingsVal($name,"temperature",0))}
Almost.
The state give temp_temperature and the right valuu. Only in device overview I only see the icon and not the temperature value
l Buitentemp
Internals:
FUUID 5ea0a3e9-f33f-5f49-c5f5-18406003d534a0e8
LASTInputDev mqtt2
MSGCNT 9112
NAME Buitentemp
NR 23
STATE temp_temperature 10.9 °C
TYPE dummy
mqtt2_MSGCNT 9112
mqtt2_TIME 2021-10-17 22:13:29
READINGS:
2021-10-17 22:13:28 humidity 62.00
2021-10-17 22:13:28 temperature 10.90
Attributes:
devStateIcon humidity.*:humidity2 temperature.*:temp_temperature
event-min-interval .*:300
event-on-change-reading .*
group Klimaat
mqttSubscribe temperature:topic={"oregon/ch3/temperature"} humidity:topic={"oregon/ch3/humidity"}
room Buiten
stateFormat {sprintf("temp_temperature %.1f °C", ReadingsVal($name,"temperature",0))}
Each icon has to have it's own line in STATE. So this should work:
{sprintf("temp_temperature\n %.1f °C", ReadingsNum($name,"temperature",0))}
Other option - use "set magic":
attr DEVICE stateFormat temp_temperature\
[$name:temperature:r1]°C
I used the last one, and that works, thnx