Nico00
(Nico)
February 18, 2018, 6:06pm
1
Hi there,
if set up MQTT binding in my OH2 to work with Sonoff switch (flashed firmware).
Seems to work so far, means I can switch on the Sonoff with Mosquitto client via:
mosquitto_pub -h localhost -t outside/LED/cmnd/POWER -m 1
or MQTT.fx windows application.
Unfortunately that it not working with my item:
Switch sonoff_light "LED Schalter" <light>
{ mqtt=">[mosquitto:outside/LED/cmnd/POWER:command:ON:1],
>[mosquitto:outside/LED/cmnd/POWER:command:OFF:0],
<[mosquitto:outside/LED/stat/POWER:state:default]" }
// Wifi Signal Strength
Number wifi "LED wifi: [%d %%]" (gRSSI)
{ mqtt="<[mosquitto:outside/LED/tele/STATE:state:JSONPATH($.Wifi.RSSI)]" }
//Status
String mqtt "LED Status: [%s]"
{ mqtt="<[mosquitto:outside/LED/tele/LWT:state:default]" }
The mqtt.cfg look like:
mosquitto.url=tcp://localhost:1883
mosquitto.clientId=openhab
mosquitto.user=admin
mosquitto.pwd=xxxxx
mosquitto.retain=false
mosquitto.async=true
The strange thing is that I receive all the states but sadly no reaction on the switch command.
Any idea?
regards, Nico
Nico00
(Nico)
February 18, 2018, 6:19pm
2
That is how it looks in the sitemap:
binderth
(Thomas Binder)
February 18, 2018, 8:59pm
3
Please specify “no reaction on the switch command”: both ways or just one direction?
What’s in the logs?
1 Like
Josar
(Josar)
February 18, 2018, 9:13pm
4
Which Firmware ?
Can this two lines not just be replaced by this one?
mqtt=">[mosquitto:outside/LED/cmnd/POWER:command:*:default]
Have you read this?
If you do it like described it works.
Nico00
(Nico)
February 19, 2018, 5:24am
6
If I switch the Item on the sitemaps I can see just no reaction. Neither at the sonoff or in any logs. The mqtt binding is already in debug logging mode.
Nico00
(Nico)
February 19, 2018, 5:28am
7
Hi,
Firmeware is:
SonOTA
|Program Version|5.9.1|
|Build Date & Time|2017-11-13T21:43:41|
|Core/SDK Version|2_3_0/1.5.3(aec24ac9)|
Yes, I have tried this as well before but same (no) result
mqtt=">[mosquitto:outside/LED/cmnd/POWER:command:*:default]
regards, Nico
binderth
(Thomas Binder)
February 19, 2018, 6:25am
8
There should be an entry for the switch to change! Is it not in the events.log?
And please look also for an entry like “connection with broker mosquitto…” after an oh2 start or change in mqtt.cfg - It should either indicate an established connection or a failed one.