Rollershutter doesn’t store its state as OPEN/CLOSED, it uses PercentType (i.e. a number between 0 and 100).
Frankly, I’m surprised this is working at all as Rollershutter can only take UP/DOWN, STOP/MOVE, or an integer between 0 and 100. It shouldn’t accept OPEN/CLOSED at all so I’m pretty sure if you looked in the logs you will see errors every time it receives a message on the status topic. So to answer your question about how it is capturing the status…it isn’t capturing the state. You are using the wrong states to drive this Item type.
Furthermore, case matters so if you are posting “open” and “closed” instead of “OPEN” and “CLOSED” it would fail anyway, assuming that Rollershutter could take OPEN/CLOSED in the first place. Contact is the correct Item Type to receive OPEN/CLOSED and to use with the default garagedoor icons.
Are you sure you are using a Switch to put the Item on your sitemap? That would not give you up and down arrows. It would give you a toggle. A Setpoint will give you the up/down arrows, not a switch.
I’ve no experience with Rollershutter so I don’t know what sort of changes to the Item’s state occurs when it receives UP and DOWN commands. But I’m pretty sure this is not a good way to do this. The only way I would use RollerShutter is if your opener reported a percent number showing how far up or down the opener is rather than just OPEN and CLOSED.
Here is how I’ve implemented it (note, I have a lot of things I want to happen when the opener is commanded to open so I use a proxy Item and rule (NOTE: I’ve simplified these to just include one of my openers, these rules are a bit more generic in my setup and handle all of my entry points):
Theory of Operation:
- Use a proxy item to control the garage door so we can intercept the command and check the status of things and and an alert
- Use a Contact to represent the state of the opener
- Additional requirements, generate an alert if the opener changes state and noone is home or it is night time, generate an alert if the door is left open more than an hour
Items: (note there are some Items in the Rules below that are not listed here, more on those later)
// Controls the opener
Switch aGarageOpener1 "Garage Door Opener 1"
// Status of the opener
Contact vGarageOpener1 "Garage Door Opener 1 is [MAP(en.map):%s]"
<door> (gDoorSensors)
{ mqtt="<[mosquitto:entry_sensors/main/garage/door1:state:default]" }
String GarageOpener1_Cmd
{ mqtt=">[mosquitto:entry_sensors/main/garage/door1/cmd:state:*:default]" }
Switch vGarageOpener1_Timer
(gDoorsTimers)
{ expire="1h,command=OFF" }
DateTime vGarageOpener1_LastUpdate "Garage Door Opener 1 [%1$tm/%1$td %1$tH:%1$tM]"
<clock> (gDoorsLast)
Rules:
rule "Garage Opener 1 Triggered"
when
Item aGarageOpener1 received command
then
GarageOpener1_Cmd.sendCommand("TRIGGER") // Any message will cause the opener to trigger on my system
// Send an alert if the controller is offline
if(vNetwork_Cerberos.state == OFF) {
aAlert.sendCommand("Attempting to trigger the garage opener but the controller is offline!")
}
end
rule "Keep track of when the Garage Door was opened"
when
Item vGarageOpener1 changed from CLOSED to OPEN or
Item vGarageOpener1 changed from OPEN to CLOSED
then
// Update the last time the door was opened
vGarageOpener1_LastUpdate.postUpdate(new DateTimeType)
// Set/cancel a timer
if(vGarageOpener1.state == OPEN) vGarageOpener1_Timer.sendCommand(ON)
else vGarageOpener1_Timer.sendCommand(OFF)
// Log the change and alert if no one is home and/or it is night time
val StringBuilder msg = new StringBuilder
msg.append("Garage door opener was")
msg.append(if(vGarageOpener1.state == OPEN) " opened" else " closed")
var alert = false
if(vTimeOfDay.state.toString == "NIGHT" || vTimeOfDay.state.toString == "BED") {
alert = true
msg.append(" and it is night")
}
if(vPresent.state == OFF){
alert = true
msg.append(" and no one is home")
}
if(alert){
msg.append("!")
aAlert.sendCommand(msg.toString)
}
logInfo("Entry", msg.toString)
end
rule "Timer expired for Garage Door 1"
when
Item vGarageOpener1_Timer received command OFF
then
aAlert.sendCommand("Garage door has been open for over an hour!"
// reschedule the timer if it is night time
if(vTimeOfDay.state.toString == "NIGHT" || vTimeOfDay.state == "BED") {
vGarageOpener1_Timer.sendCommand(ON)
}
end
Sitemap:
Switch item=aGarageOpener1 icon="garagedoorclosed" mappings=[ON=Open] visibility=[vGarageOpener1 == CLOSED]
Switch item=aGarageOpener1 icon="garagedooropen" mappings=[ON=Close] visibility=[vGarageOpener1 == OPEN]
In your case since you can actually command the opener to OPEN or CLOSE instead of the opener acting like a pushbutton like mine, you might use a String Item instead of a Switch and continue to use the Rollershutter/Setpoint to command the opener.
The key takeaway from the above sitemap though is that you will notice that I use the visibility tag based on the door sensos’s state and use a special icon and mappings based on that state. To do this you will need to make a copy of the garage door icons and change their name like I did above.