I have an issue where my ceiling fans sometimes get set to zero when I open the openhab app on android. I posted about it here. I finally figured out what exactly was causing it, but I am not sure how to remedy it in my sitemap.
The problem is that sometimes, but not often, the value can get set to something outside the range… For example, through a manual method the fan might get set to 20 (which is still low). However, when you load the sitemap and look at it because 20 doesn’t match a known mapping it seems to default to ‘Off’ and then update it into the off position.
Is there a way to properly handle this in the sitemap or do I need to write some rules that force the fan into certain exact values if they are in a range? Or other ideas?
item file :
Dimmer MasterBedroomFanLoadLevelStatus " Fan status [%d]"
String FanStatus
site map file :
Frame label=“Master Bedroom” {
Selection item=FanStatus label=“Fan Status %s” icon=“fan_ceiling” mappings=[OFF=“Off”,LOW=“Low”,MEDIUM=“Medium”, HIGH=“High”]
}
rule file :
rule "Fan status"
when
Item FanStatus changed
then
if (FanStatus.state==OFF) {
MasterBedroomFanLoadLevelStatus.sendCommand(0)
}
if (FanStatus.state==LOW) {
MasterBedroomFanLoadLevelStatus.sendCommand(33)
}
if (FanStatus.state==MEDIUM) {
MasterBedroomFanLoadLevelStatus.sendCommand(66)
}
if (FanStatus.state==HIGH) {
MasterBedroomFanLoadLevelStatus.sendCommand(100)
}
end