homebridge-mqttthing icon indicating copy to clipboard operation
homebridge-mqttthing copied to clipboard

Sonoff mini bad "Set On" command cmnd/sonoff/POWER = true

Open Emilien-Lambert opened this issue 4 years ago • 10 comments

Hello,

I have a Sonoff mini and I installed homebridge-mqtthing on homebridge.

To activate the sonoff I have to do cmnd/tasmota_16E79A/POWER ON. But when I put the Set On cmnd/tasmota_16E79A/POWER the logs show cmnd/tasmota_16E79A/POWER = true If I replace true with ON in the settings there is still the "=" sign and the command doesn't pass.

Can you help me please ?

Emilien-Lambert avatar Oct 27 '21 19:10 Emilien-Lambert

Share your topic config for this accessory

washcroft avatar Nov 09 '21 16:11 washcroft

Configuration in HomeBridge :

{
    "type": "switch",
    "name": "Test",
    "url": "mqtt://10.0.0.87:1883",
    "username": "test",
    "password": "test",
    "topics": {
        "getOn": "stat/tasmota_16E79A/POWER",
        "setOn": "cmnd/tasmota_16E79A/POWER"
    },
    "onValue": "ON",
    "offValue": "OFF",
    "accessory": "mqttthing"
}

Emilien-Lambert avatar Nov 10 '21 08:11 Emilien-Lambert

That should work fine, can you share the logs that are output with this config - also the logs from the tasmota web console?

washcroft avatar Nov 10 '21 10:11 washcroft

For that, I have to reconfigure a Snonoff, I will try to do it quickly but as described in my problem and Djaytek issue one here url The problem is that the send command contains an "=".

In the HomeBridge logs we can see the command cmnd/tasmota_16E79A/POWER = ON And in the tasmota web console the command cmnd/tasmota_16E79A/POWER = ON does absolutely nothing. While the command cmnd/tasmota_16E79A/POWER ON activates the sonoff.

Ideally, it would be possible to check or uncheck a box to use or not use the "=".

Emilien-Lambert avatar Nov 10 '21 10:11 Emilien-Lambert

The '=' is just for logging/display purposes - the '=' isn't actually sent via MQTT. That's why I'm more interested in what your tasmota console says.

https://github.com/arachnetech/homebridge-mqttthing/blob/master/libs/mqttlib.js#L39:

if( config.logMqtt ) {
    log( 'Publishing MQTT: ' + topic + ' = ' + messageString );
}
mqttClient.publish( topic, messageString, config.mqttPubOptions );

washcroft avatar Nov 10 '21 11:11 washcroft

Hello, sorry to have taken so long I reconfigured a Sonoff with the same problem.

Here are the logs of the HomeBridge interface, don't hesitate to ask me if you need more information

image

In the Tasmota web console nothing happens when I activate the device from HomeKit

Emilien-Lambert avatar Nov 17 '21 10:11 Emilien-Lambert

I would say there is something wrong with your MQTT/Tasmota config, because those logs indicate values "ON" and "OFF" are being published to topic "cmnd/tasmota_FEA1D3/POWER", but your Tasmota isn't listening or responding to them

washcroft avatar Nov 17 '21 13:11 washcroft

I don't understand, in the Tasmota web console the command cmnd/tasmota_16E79A/POWER ON works perfectly. And with MQTT Explorer on my computer, I can see the request arriving in the broker perfectly.

When I activate the switch in HomeKit and trigger the logs above, MQTT Explorer does not see anything

For me the broker and Tasmota are well configured but homebridge-mqttthing seems not to send the request correctly 🤔

Emilien-Lambert avatar Nov 17 '21 18:11 Emilien-Lambert

Check that everything's pointing at the same MQTT server too. I'd suggest pointing an independent MQTT client (e.g. mosquitto_sub) at your MQTT server too - that way you can see exactly what is being published and determine where the problem is.

arachnetech avatar Nov 28 '21 16:11 arachnetech

possible authentication error?

rbswift avatar Jan 16 '22 01:01 rbswift