I got the pi3 running openhab2 with mosquitto.
After reading a lot, i finally manage to control the LED on my Wemos d1mini and NodeMCU boards from the Pi via MQTT over WiFi
Im runnig HOMIE framework on the nodes.
So far, if I type in pi console:
mosquitto_pub -t 'devices/home/light/on/set' -m true
The LED turn on
mosquitto_pub -t 'devices/home/light/on/set' -m false
The LED turn off
so far so good!
Now im trying to put a switch on openhab2
Here is my config:
mqtt.cfg
mqtt:mosquitto.url=tcp://localhost:1883
mqtt:mosquitto.clientId=openhab
mqtt-eventbus.cfg
broker=mosquitto
demo.sitemap
sitemap demo label="Main Menu" {
Switch icon="present" label="lamp1" item=lamp1
Switch icon="present" label="lamp2" item=lamp2
Switch icon="present" label="lamp3" item=lamp3
Switch icon="present" label="lamp4" item=lamp4
}
demo.item
Switch lamp1 { mqtt=">[mosquitto:devices/home/light/on/set:command:on:true],>[mosquitto:devices/home/light/on/set:command:off:false]"}
Switch lamp2 { mqtt=">[mosquitto:devices/home/light/on/set:command:on:1],>[mosquitto:devices/home/light/on/set:command:off:0]"}
Switch lamp3 { mqtt=">[openhab:devices/home/light/on/set:command:on:true],>[openhab:devices/home/light/on/set:command:off:false]"}
Switch lamp4 { mqtt=">[openhab:devices/home/light/on/set:command:on:1],>[openhab:devices/home/light/on/set:command:off:0]"}
None of the combinations above worked so far. The requests won’t go to the nodes. Appreciate any advices. Need help for better debug this.
Thank you!