Hello,
i know how to get modbus tcp data value and format them (i.e. divide10.js) and also add metadata to get the symbols like “kWh”.
If i use default widget in ui value is shown exactly as i want.
When i want to use custom widget how to access the value that is formated the same like in default?
I use at the moment:
slots:
default:
- component: Label
config:
text: =items.Sun2000_daily_energy_yield.displaystate || items.Sun2000_daily_energy_yield.state
Beiträge: 1
Registriert: Heute 14:59
Einheiten bei custom Widget anzeigen lassen ?
Beitrag von cybermailer » Heute 15:06
Hallo,
ich weiß wie man Werte transformiert und auch Einheiten hinzufügt bei
beispielsweise empfangenen Modbus Werten.
Nutze ich die Standard Widget in Openhab wird alles super angezeigt.
Was muss ich jedoch tun wenn ich mir ein custom Widget baue dort bekomme ich die Werte zwar rein auch
umgerechnet aber die Einheit fehlt. Die Nachkommastellen passen auch nicht ganz.
So greife ich derzeit auf die Variablem im custom Widget zu:
Code: Alles auswählen
slots:
default:
- component: f7-row
slots:
default:
- component: f7-col
config:
width: 70
slots:
default:
- component: Label
config:
text: dzt. Produktion
- component: f7-col
config:
width: 30
slots:
default:
- component: Label
config:
text: =items.Sun2000_power_current.displaystate || items.Sun2000_power_current.state
If i check the output of:
items.Sun2000_power_current
i get:
{ “state”: “12.45747”, “displayState”: “12.46 MWh” }
But i’m not able to get displaystate only state version.
SOLVED:
displaystate instead of displayState