Howdy, I’m picking up some openHAB experience for the first time and my project is to track and actuate a sliding door.
I’ve programmed a MQTT server that responds with a door status as either 0 (open), 1 (close), or 2 (ajar if neither 0 or 1). If the door is open or closed the proper status shows up without issue, when the door is neither open or closed there is no update and I see the following error in the console:
[ERROR] [o.o.c.s.ScriptExecutionThread :50 ] - Error during the execution of rule ‘Convert Door’: The name ‘PARTIAL’ cannot be resolved to an item or type.
I understand the OnOffType that is in use doesn’t have a “PARTIAL” state, what is the best way of incorporating the response of 2 to show as Partial in the sliding door status?
Thanks for any inputs
Specifics:
OH1.8
items -
Group All
Switch Relay1 “Slider Door” (All) {mqtt=">[mqttbroker:openhab/slider/doorswitch:command:ON:PRESSURE],>[mqttbroker:openhab/slider/doorswitch:command:OFF:RELEASE]"}
Number itm_slider_dist “Slider Dist [%d]” (All) {mqtt="<[mqttbroker:openhab/slider/doorstatus:state:default]"}
String itm_my_slider_door “Slider Door Status [MAP(en.map):%s]” (All)
sitemap -
sitemap demo label=“Slider Door”
{
Frame label=“Slider”
{
Text item=itm_my_slider_door label="Slider Door Status [%s]"
Switch item=Relay1 mappings=[ON=“OPEN”, OFF=“CLOSE”]
}
}
rules -
rule "Convert Door"
when
Item itm_slider_dist received update
then
if(itm_slider_dist.state == 1)
{ itm_my_slider_door.state = CLOSED }
if(itm_slider_dist.state == 0)
{ itm_my_slider_door.state = OPEN }
if(itm_slider_dist.state == 2)
{ itm_my_slider_door.state = PARTIAL }
end
en.map -
CLOSED=closed
OPEN=open
PARTIAL=undefined