Hi Folks,
I have an OpenHAB 2.1 installation on Debian from the stable repo, and it seems to have an issue with Contact items.
I have items set like this:
Contact MS4_Door "MultiSensor 4 Door Contact [%s]" <door> (gMS0) {mqtt="<[MQTT:sensors-out/14/0/1/0/2:command:MAP(01toOPENCLOSED.map)]"}
With the transformation map like this:
1=OPEN
0=CLOSED
Which when the MQTT broker receives a message from the sensor on the correct topic with a payload of 0 or 1, produces a log message like this:
2017-08-15 18:09:13.777 [WARN ] [b.core.events.EventPublisherDelegate] - given command is NULL, couldn't post command for 'MS4_Door'
Trying to debug using the console produces this:
openhab> smarthome:send MS4_Door OPEN
Error: Command 'OPEN' is not valid for item 'MS4_Door'
Valid command types are:
RefreshType: REFRESH
Yet when I create a rule like this:
rule "Test"
when
Item TestPoint changed
then
if(TestPoint.state == ON) {
MS4_Door.sendCommand(OPEN)
} else {
MS4_Door.sendCommand(CLOSED)
}
end
…and activate it using the “TestPoint” switch on my sitemap, it seems to work fine:
2017-08-15 18:15:21.651 [ItemCommandEvent ] - Item 'TestPoint' received command ON
2017-08-15 18:15:21.658 [ItemStateChangedEvent ] - TestPoint changed from OFF to ON
2017-08-15 18:15:21.664 [ItemCommandEvent ] - Item 'MS4_Door' received command OPEN
2017-08-15 18:15:21.668 [ItemStateChangedEvent ] - MS4_Door changed from NULL to OPEN
I don’t understand why a rule can interact correctly with this item but neither the console nor the MQTT binding seem to be able to. Am I missing something or is this a bug?