Hi All,
I’m quite new to openhab so please be patient. I’m very impressed by the functionality and ease of getting started. So thumbs up to all the developers and people involved
I am monitoring the temperature in all my rooms. Whenever the current temperature (IST) is more then 2 degrees below the wanted temperature (SOLL) I want to receive an email.
So for each room I have a pair of Numbers which are read from KNX:
Number Heating_Temp_WZ “Wohnzimmer [%.1f °C]” (Heating) { knx = “<3/1/1”}
Number Heating_Temp_WZ_Soll “Wohnzimmer Soll [%.1f °C]” (Heating) { knx = “3/1/11+<3/1/21”}
This is my approach:
rule “Room too cold”
when
Item Heating changed
then
var changedTemperatures = Heating.members.filter(x|x.changedSince(now.minusSeconds(30))).map[it]
changedTemperatures.forEach [ room |
logInfo(“Heating”, "room too cold: " + room.name) // --> “Heating_Temp_WZ”
var sollName = ( room.name + "_Soll") as String
logInfo("Heating", "name: " + sollName) // --> "Heating_Temp_WZ_Soll"
// FIXME: how to get from sollName to item?
var soll = sollName.state as DecimalType
var ist = room.state as DecimalType
logInfo("Heating", "soll:" + soll + " ist:" + ist)
if ( soll.floatValue - ist.floatValue > 2.0) {
logInfo("Heating", "sending email")
}
]
end
Of course I could harcode the pairs in my rule file. But there must be a smarter way reusing the already defined items?!
Any hints?
Thanks a lot
Karl