New user configuring v2.4.x with sonoff switches using Paper UI - Help appreciated

Hi all

Yes, I’m a newbie… (Barry) an IT tech for 30 years starting with PDP-11’s then AS/400’s but now mostly Wintel systems and networks.

That said, I’ve never been a unix guy…

My goal. To control sonoff switches using openhab2 using the Paper UI for configuration wherever possible.

So I got me a Pi 3 and gave it a go…
So far I have got openhabian with openhab 2.4 loaded and running.
I have mosquitto loaded and running and what I understand to be the very new 2.4.x MQTT binding loaded.
I can connect to mosquitto using MQFX on a PC.
I have two sonoff switches which I have flashed with Tasmota. I have these connected to wifi and communicating with the mosquitto MQTT on the Pi.

I now need to understand how to bring these elements together.

I thought by loading all the default choices… (Pi,openhabian,mosqitto,MQTT2.4.x) I would be taking the easy vanilla route… however, clearly most information out there is based on old 1.x bindings and configuration files.

I’d like to find a step by step guide of information based around the 2.4 MQTT binding and ideally config thru Paper UI, hopefully relationg to how to tie to and control sonoffs.

Can you point me at anything that will help ?

Thank you
Barry

As it’s MQTT2, there is auto discovery option.
First step is to create a mqtt bridge.
Go to Paper UI -> Inbox.
If there isn’t a MQTT Bridge yet, click “+” and select MQTT Thing Binding.
If no Bridge is found, add it manually by selecting “manually add thing” or “add manually”, both do the same.
Select “MQTT Broker” to create the broker connection manually.
As Tasmota provides auto discovery (hass) since ~version 6.3, maybe the next step is working with auto discovery :slight_smile:
If not, use inbox->mqtt->add manually-> generic mqtt thing to setup a thing per device or one thing for all devices.
Finally, define channels for the thing(s)

Here, using openHAB 2.5.0-SNAPSHOT (Build #1485) and Tasmota 6.3.1 on my devices, the Auto-Discovery does not work for me…

There is no step by step guide on this but these links helped me understanding it a lot more.

Information on configuring the (v1 MQTT Binding)

Blog post about new MQTT binding very handy

Topic of someone migrating Sonoff (4ch switches) form MQTT v1 binding to MQTT v2 binding

Hi - Thanks for the input so far, all much appreciated.

I have the MQTT broker Thing setup and a Thing to represent a sonoff

Auto discovery does not appear to work (Has anyone made this work?)

I’m adding the channels, but would appreciate any assistance on creating correct MQTT State and Command entries

This is an information page from one of the sonoffs

Program Version 6.4.1(basic)
Build Date & Time 2018-12-24T14:43:30
Core/SDK Version 2_4_2/2.2.1(cfd48f3)
Uptime 0T00:35:45
Flash write Count 33 at 0xFA000
Boot Count 14
Restart Reason Software/System restart
Friendly Name 1 SONOFFS26-01
AP1 SSId (RSSI) XXXXXX (26%)
Hostname SONOFFS26-01
IP Address x.x.x.x
Gateway 192.168.0.10
Subnet Mask 255.255.255.0
DNS Server 192.168.0.3
MAC Address 84:F3:EB:3E:61:7C
MQTT Host 192.168.0.28
MQTT Port 1883
MQTT User openhabian
MQTT Client DVES_3E617C
MQTT Topic sonoff_s26_01
MQTT Group Topic sonoffs
MQTT Full Topic cmnd/sonoff_s26_01/
MQTT Fallback Topic cmnd/DVES_3E617C_fb/
Emulation None
mDNS Discovery Disabled

In your case i would add the following


hope it helps

1 Like

Please use

%prefix%/%topic%/

for full topic

Thank you all for your excellent help…

I now have smartphone control of my garage doors and a few other bits…

These sonoffs are great little devices… not sure I would trust the current capacity of their switching, but great for low-ish current devices.

1 Like

Thank you for the sonoff info! I’ve been looking for days!

I am a complete noob in the area of home automation and I came here with the same problem as brivett.

I created the thing and as you suggested I added a channel to it with

stat/SmartPlug01/POWER
and
cmnd/SmartPlug01/POWER

The Thing is shown as “ONLINE” unter Configuration > Things, however, in the Paper UI unter Control, where I can see the thing with the channel I created, clicking on the toggle-switch next to it does not affect anything.

If I use mqtt-test-tools on my phone or mqtt.fx on my PC, I can switch on and off the plug with cmnd/SmartPlug01/POWER ON respectively OFF and I will receive status updates with a subscription to stat/SmartPlug01/POWER

I have no idea whatsoever on how to diagnose this issue…

Which version of openHAB and MQTT binding are you using?
If openHAB 2.4 with MQTT 2 you just migth need to restart.
Otherwise please checked which messages you recieve FROM openHAB on the MQTT tools, that should give you a clue what is wrong.

Hello Opus,

sorry, forgot to mention that:

I use OpenHAB2.4 and the new MQTT binding, and I did restart the whole Raspberry PI I am running on without any success.

Otherwise please checked which messages you recieve FROM openHAB on the MQTT tools, that should give you a clue what is wrong.

What do you mean with MQTT tools? Are you talking about MQTT.fx and/or the iPhone-App that I used for testing (It’s called MQTTool)? Or do you mean any specific Mosquitto tools?
I was hoping to find some kind of status monitor for the Mosquitto server on the command line, showing a list of connected clients and maybe the incoming publishes, but did not tinf anything.

However, the Raspi is turned off currently and I will continue testing on the weekend.

I was talking about MQTT.fx. Using such you should see a message from your openHAB instance when switching the Power channel (you need to subscribe to that topic or better to all messages).
You did not mention the MQTT Broker Thing, which acts as a bridge, however I think your Generic MQTT Thing would not show online without it.

Thanks for your help!

I did not mention it but I created tha MQTT Broker Thing but yes, I also created that.

I did not think of the OpenHAB being an MQTT-client itselft. I will try to subscribe to it in MQTT.fx and see what I can see there.

By the way - the switch in the “Control”-Section of the paperUI also does not reflect the actual status of the plug.