- Platform information: Windows 10 Prof
- Hardware: CPUArchitecture/RAM/storage i686/16GB
- OS: what OS is used and which version Windows 10 Prof
- openHAB version: 2.4
- Issue of the topic: please be detailed explaining your issue
Ok, I know I am a newbie, but after three weeks of studying, it would look like I could figure it out. But, no, I was wrong. It probably is simple, but it eludes me.
What I am trying to do, is to turn a light on whenever the temperature goes below 30° and off again when the temperature goes above 33°. I believe I have the temperature set right, but I can only get it to work sometimes, and then only one way.
I think I have used the code fences correctly, but again, I could have messed it up. Any help would be much appreciated.
- Items configuration related to the issue
Number:Temperature WC_PWS_Temperature
"Temperature [%.0f %unit%]"
<temperature>
{ channel="weathercompany:weather:local:pwsObservations#currentTemperature" }
- Rules code related to the issue
var Number WC_PWS_Temperature
var Number currentTemperature
rule "Loginfo every 10 minutes"
when
Time cron "0 */10 * ? * *"
then
if(currentTemperature > 33){
OfficeDeskLight.sendCommand(OFF)
}
logInfo("currentTemperature", "> 33° = OFF " + WC_PWS_Temperature)
if(currentTemperature < 30){
OfficeDeskLight.sendCommand(ON)
}
logInfo("currentTemperature", "> 30° " + WC_PWS_Temperature)
logInfo("Minute", "Another 10 minutes has passed.")
end
- Services configuration related to the issue
- If logs where generated please post these here using code fences:
2019-10-22 20:00:00.004 [INFO ] [home.model.script.currentTemperature] - > 33° = OFF WC_PWS_Temperature (Type=NumberItem, State=27 °F, Label=Temperature, Category=temperature)
2019-10-22 20:10:00.389 [INFO ] [home.model.script.currentTemperature] - > 30° WC_PWS_Temperature (Type=NumberItem, State=27 °F, Label=Temperature, Category=temperature)
2019-10-22 20:10:00.389 [INFO ] [g.insteonplm.InsteonPLMActiveBinding] - Item: OfficeDeskLight got command ON