[SOLVED] MQTT Controller Not Toggling Sonoff Basic Correctly on Raspberry Pi 4B - Bare Metal (without Docker)
-
MSR is currently running the latest-21342
I thought I would give MQTT controller a try for one of the many Sonoff devices I have in my home. My aim is to remove the HTTP Switch app in my Vera Plus and control all my devices from MSR using the MQTT controller.
I have carried out the following steps:
Flashed a new Sonoff Basic with Tasmota, configured it for MQTT and enabled it.
Installed MQTT Controller on MSR and added the basic configuration in the reactor.yaml file and re-started reactor.
The device is discovered in entities and when clicking on the attributes power_switch.on, power-switch.off, power-switch.set everything works just fine.
The problem I have is with toggle. This always works to toggle the device ON but when toggled again does not turn it OFF.I've attached my reactor.yaml file and the template which it uses. Hopefully someone can shed some light on why it won't toggle OFF.
Thanks
-
That sounds like it's not updating the status, which would be how it knows how to toggle. The unit "0" is pretty suspicious. I've only seen non-zero for this, or nothing at all, in which case you should specify
unit: ""
Also the username and password fields aren't correctly placed in your screen shot. Better to use copy/paste of the actual text, and use the fenced code block formatting for it. And no need to post the template, if it's the standard template from the
mqtt_devices
data file (and I'm assuming you didn't make a copy of it and post it intoreactor.yaml
, which is unnecessary). -
Thanks very much. I specified it as you described and toggle works just fine now.
I'll change the username and password and no, the template was not copied to the reactor.yaml file.
I started out by following the docs (see below) on how to set it up but got a bit confused. It gives an example of setting up a Shelly, but then says to use the tasmota_generic_relay template. This is how I ended up with the 0 (from channel 0).
Anyway all good now. Thanks again for the very quick reply. Looking forward to experimenting with MQTT and Tasmota to see if I can get improved reliability from my Sonoff devices.
Easy Device Configuration - Using Existing Template
As an example, let's say we have a Shelly1 configured with the topic shelly1_43DFD2 that is configured to operate as a single relay to operate a stairway light. To create an entity for this device, we can use the tasmota_generic_relay template. The template supports multiple relays, but since only one relay is configured in Tasmota, the published topics from the node will have a "unit number" (identifying which relay if more than one), so we'll specify no unit number by giving it an empty string:...other stuff
config: "mqtt://127.0.0.1:1883/"
entities:
shelly1_stairway:
name: "Stairway Light"
topic: shelly1_43DFD2
uses_template: shelly_relay
channel: 0 -
I'll get after those docs... you're not the first to be bitten.
-
T toggledbits locked this topic on