fzonno
(Francesco)
March 12, 2019, 8:24pm
1
hi
i have a sonoff and i want to command it from openhab by rasberry pi.
This is the configuration of the sonoff:
mqtt.cfg:
# URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883
localbroker.url=tcp:the ip of the raspberry:1883
# Optional. User id to authenticate with the broker.
localbroker.user=openhabian
# Optional. Password to authenticate with the broker.
localbroker.pwd=the password
sonoff.items
Switch LivingRoom_Light "Interruttore WiFi Sonoff" <light> (LR,gLight)
{ mqtt=">[localbroker:cmnd/sonoffSERCAM/POWER:command:*:default],
<[localbroker:stat/SONOFFsercam/POWER:state:default]" }
sonoff.sitemap
sitemap sonoff label="Sonoff" {
Frame label="Sonoff" {
Switch item=LivingRoom_Light
}
}
I have the following add on:
MQTT Action
MQTT Binding 2,4
MQTT Persistence
JSONPath Transformation
The problem is that from openhab i am not able to control the sonoff.
Can you hlep me ?
opus
(Jürgen Baginski)
March 12, 2019, 8:32pm
2
Please read in Here.
You are doing the same mistake by using the syntax of the MQTT 1 binding while having the MQTT 2.4 binding installed.
fzonno
(Francesco)
March 12, 2019, 9:13pm
3
ok
i followed the topic and i changed the sonoff.item so:
Switch LivingRoom_Light "Interruttore WiFi Sonoff" <light> (LR,gLight)
{channel="mqtt:topic:b7bb37dc:Power1"}
but i continue to have problem to command by the bottom of openhab the sonoff.
I report the images of my openhan
fzonno
(Francesco)
March 12, 2019, 9:32pm
4
Now by MQTT.fx i am able to se the message that the switch of openhab send but the sonoff don’t change the status
H102
(CM6.5 H102)
March 12, 2019, 11:54pm
5
fzonno:
i followed the topic and i changed the sonoff.item so:
Switch LivingRoom_Light "Interruttore WiFi Sonoff" <light> (LR,gLight)
{channel="mqtt:topic:b7bb37dc:Power1"}
but i continue to have problem to command by the bottom of openhab the sonoff.
If using files try changing the item channel to:
Switch LivingRoom_Light "Interruttore WiFi Sonoff" <light> (LR,gLight)
{channel="mqtt:topic:localbroker:b7bb37dc:power1"}
You may need to post your Things file if the above doesn’t work.
fzonno
(Francesco)
March 13, 2019, 5:26am
6
Thanks Now it work.
I want to command a sonoff dual but in this way i command only 1 exit.
Can you help me?
opus
(Jürgen Baginski)
March 13, 2019, 5:28am
7
You have created a channel for Power1, do the same for Power2.
fzonno
(Francesco)
March 13, 2019, 7:11am
8
I did bur it doesn’t work
opus
(Jürgen Baginski)
March 13, 2019, 10:23am
9
These are the configs of my two switches of the Sonoff dual
fzonno
(Francesco)
March 13, 2019, 5:18pm
10
this is the result
when i push one also the other turn on but i setted the interlock.
I command the same
fzonno
(Francesco)
March 13, 2019, 6:28pm
13
this is my sonoff.items
Switch LivingRoom_Light "Interruttore WiFi Sonoff" <light> (LR,gLight)
{channel="mqtt:topic:b7bb37dc:Power1"}
But i must create another file for the second switch?
The other problem is i can only turn off but not turn on
fzonno
(Francesco)
March 13, 2019, 8:02pm
14
can you show me your configuration please?
opus
(Jürgen Baginski)
March 13, 2019, 8:04pm
15
Sorry, but I do not understand. When pushing Power1 to On the second light switches to On also? What do you try to say by:" but i setted the interlock"?
You need another item for Power2, it can be setup in the same file as the other item(s).
Does the switch not toggle to OFF or does the sitemap icon stay in the ON position?
I did my item config by files, but the screencopy of PaperUI shows the result.
My items config for Power1 is basically the same as yours, I have a second one for Power2
opus
(Jürgen Baginski)
March 13, 2019, 8:09pm
16
BTW: You do not need the MQTT action and persistence binding.
fzonno
(Francesco)
March 13, 2019, 8:12pm
17
The cases are:
1)sonoff has the 1 switch to on. If i push on the switch in openhab it works (the switch go to off)
2)sonoff has the 1 switch to off. if i push on the switch in openhab the switch go first to on and then to off.
opus
(Jürgen Baginski)
March 13, 2019, 8:14pm
18
Could you post the log entries you are getting in the case 2.)
fzonno
(Francesco)
March 13, 2019, 8:25pm
19
now the sonoff.items:
Switch LivingRoom_Light "Interruttore WiFi Sonoff" <light> (LR,gLight)
{channel="mqtt:topic:b7bb37dc:Power1"}
Switch LivingRoom_Light "Interruttore 2 WiFi Sonoff" <light> (LR,gLight)
{channel="mqtt:topic:b7bb37dc:Power2"}
and in openhab
before to switch from openhab to on the log viewer is
after i switch to on the 1 and the 2 go to on
opus
(Jürgen Baginski)
March 13, 2019, 8:31pm
20
You have both items with the SAME name!
You have to have each item with an unique name!
Can’t say if that solves all the problems.
Please, when showing logs copy and paste only the needed lines!