arachnetech / homebridge-mqttthing

A plugin for Homebridge allowing the integration of many different accessory types using MQTT.
Apache License 2.0
467 stars 104 forks source link

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

Open Emilien-Lambert opened 3 years ago

Emilien-Lambert commented 3 years ago

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 ?

washcroft commented 3 years ago

Share your topic config for this accessory

Emilien-Lambert commented 2 years ago

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"
}
washcroft commented 2 years ago

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

Emilien-Lambert commented 2 years ago

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 "=".

washcroft commented 2 years ago

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 );
Emilien-Lambert commented 2 years ago

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

washcroft commented 2 years ago

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

Emilien-Lambert commented 2 years ago

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 🤔

arachnetech commented 2 years ago

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.

rbswift commented 2 years ago

possible authentication error?