siod
(John Doe)
August 7, 2017, 12:38pm
1
Hi,
in my home.items I have this:
Contact TuereWg "Wohnungstür" <door-closed> (FF_Wg) {mqtt="<[mysensor:mygateway1-out/10/1/1/0/16:state:OPEN:1],<[mysensor:mygateway1-out/10/1/1/0/16:state:CLOSED:0]"}
I wonder, for testing purposes, what is the correct command if I want to switch this by just publishing through mosquitto directly. When sending directly
mosquitto_pub -d -t mysensor:mygateway1-out/10/1/1/0/16:state:OPEN:1
I get an error. What do I have to send so openhab understands it?
Dim
(Angelos)
August 7, 2017, 12:57pm
2
mosquitto_pub -t mysensor:mygateway1-out/10/1/1/0/16 -m 1
-m for message
-t for topic
Source
This part of your item config
:state:OPEN:1
will transform the MQTT message from 1 to OPEN and the Contact item will update in OH2
rgerrans
(Rgerrans)
August 7, 2017, 1:00pm
3
mosquitto_pub -d -t out/10/1/1/0/16 -m “OPEN”
Assuming you are doing a command line publish to localhost
Dim
(Angelos)
August 7, 2017, 1:08pm
4
will this work with a transformation configured (not using state:default) ? maybe yes… I will test
siod
(John Doe)
August 7, 2017, 1:10pm
5
great, this one works for me very well, thanks for your quick replies guys!
Dim
(Angelos)
August 7, 2017, 1:13pm
6
strange that it worked … i made a copy/paste mistake and I added your broker name in the topic
it should have been: mosquitto_pub -t mygateway1-out/10/1/1/0/16 -m 1
(without the mysensor:
)
siod
(John Doe)
August 7, 2017, 4:17pm
7
oh, sorry, I just did not enter the “mysensor:” part! So you are absolutely right with this one:
mosquitto_pub -t mygateway1-out/10/1/1/0/16 -m 1