It is impossible to deduce dimension in sitemap for the item.
It was not possible to compare the state of the item as a number, the rules for the comparison of the state of the item and the number do not work in the rules.
Settings:
/var/lib/openhab2/jsondb/org.eclipse.smarthome.core.items.Item.json
"Temperature_8302000000000000": {
"class": "org.eclipse.smarthome.core.items.ManagedItemProvider$PersistedItem",
"value": {
"groupNames": [
"gHome"
],
"itemType": "Number:Dimensionless",
"tags": [],
"label": "Bedroom",
"category": "temperature"
}
},
/etc/openhab2/sitemaps/my.sitemap
sitemap my label="My home automation" {
// Спальня
Frame label="Спальня сенсоры" {
// Text item=Temperature_8302000000000000 label="Bedroom [%.1f °C]" valuecolor=[Mobile1_LastUpdate=="Uninitialized"="gray",>=25="orange", >=15="green", 0="white", <15="blue"]
// Text item=Temperature_8302000000000000 valuecolor=[Mobile1_LastUpdate=="Uninitialized"="gray",>=25="orange", >=15="green", 0="white", <15="blue"]
Text item=Temperature_8302000000000000 label="Bedroom1 [%s °C]"
Text item=Humidity_8302000000000000 valuecolor=[Mobile1_LastUpdate=="Uninitialized"="gray",>=25="orange", >=15="green", 0="white", <15="blue"]
Text item=PPM_8502000000000000 valuecolor=[Mobile4_LastUpdate=="Uninitialized"="gray",>=25="orange", >=15="green", 0="white", <15="blue"]
Text item=Voltage_8502000000000000 labelcolor=[LowPower_8502000000000000==ON="red"] valuecolor=[LowPower_8502000000000000==OFF="green"]
Text item=Mobile4_LastUpdate valuecolor=[Mobile4_LastUpdate=="Uninitialized"="gray",>=25="orange", >=15="green", 0="white", <15="blue"]
//Switch item=LowPower_8502000000000000
Text item=Voltage_8302000000000000 labelcolor=[LowPower_8302000000000000==ON="red"] valuecolor=[LowPower_8502000000000000==OFF="green"]
Text item=Mobile1_LastUpdate valuecolor=[Mobile1_LastUpdate=="Uninitialized"="gray",>=25="orange", >=15="green", 0="white", <15="blue"]
//Switch item=LowPower_8302000000000000
}
}
/etc/openhab2/rules/my.rules
rule "Records when device mobile1 was last seen"
when
Item Temperature_8302000000000000 received update or
Item Humidity_8302000000000000 received update or
Item Voltage_8302000000000000 received update
then
logInfo("Records when device mobile1 was last seen", "Temperature_8302000000000000.state=" + Temperature_8302000000000000.state)
postUpdate(Mobile1_LastUpdate, new DateTimeType())
if (Temperature_8302000000000000.state < 40){
logInfo("Records when device mobile1 was last seen", "Temperature_8302000000000000.state=" + Temperature_8302000000000000.state , " IF")
}
end
/var/log/openhab2/openhab.log
2019-07-05 10:42:53.583 [INFO ] [ds when device mobile1 was last seen] - BEGIN
2019-07-05 10:42:53.584 [INFO ] [ds when device mobile1 was last seen] - Temperature_8302000000000000.state=16.0
2019-07-05 10:42:53.585 [INFO ] [ds when device mobile1 was last seen] - END
From the log you can see that the comparison test does not work
if (Temperature_8302000000000000.state <40)
If you add a comparison with the dimension:
if (Temperature_8302000000000000.state <40 | ° C)
I get the error:
2019-07-05 10: 35: 48.644 [ERROR] [ntime.internal.engine.RuleEngineImpl] —Rule 'Records when the device mobile1 was last seen: Can not compare incompatible units
.