MacWyznawca / homebridge-mqtt-switch-tasmota

Plugin to HomeBridge optimized to work with firmware Sonoff-Tasmota, MQTT.
MIT License
57 stars 18 forks source link

Accessories always appear as 'OFF' after reboot/restart Homebridge #20

Open EdelHert opened 6 years ago

EdelHert commented 6 years ago

I recently switched from HAP-NodeJS to Homebridge and love it so far (so many possibilities..!!), but I cannot get this plugin to work correctly just yet.

The story: When I start Homebridge de accessories appear in the IOS Home app, but always as 'OFF'. After I click on them the status changes to 'ON' (and nothing happens since the physical lights were on already. After I click on the icon again the status and the physical light turns off and everything works fine!

So my question is: Why do they appear off on restart of Homebridge (while the actual switch is on) en how can I change that. Somehow the status of the switch (Sonoff Default) is not read correctly..

Thanks in advance and many thanks for this great plugin!


I just found out that, while using the newest 'index.js file downloaded from this page and copied to the Pi, every time I close the Home app on my iPhone (double press homebutton and swipe up) and open it again the status of the accessories are 'Off' again, while the status of the other plugins are shown correctly, so somehow it just does not read the status of the sonoff accessories at all with this plugin. While HAP-NodeJS works fine (so it's probably not the Tasmota firmware on the devices). Using the 'index.js' file from the 'sudo npm install -g homebridge-mqtt-switch-tasmota' command does seem to read (or remembers) the last state until reboot/restart of Homebridge.

imaxi96 commented 6 years ago

Hello :-)

I have the same problem... Did you find a solution?

Thanks!

felipetng commented 5 years ago

Any solution?

matej commented 5 years ago

Try using startCmd and sending the same topic as in statusSet with an empty startParameter. That should trigger the Sonoff to send out a statusSet and update the value to the currently active state.

E.g.,

{
    "accessory": "mqtt-switch-tasmota",
    "name": "Name",
    "url": "mqtt://my-ip",
    "topics": {
        "statusGet": "stat/lights/POWER1",
        "statusSet": "cmnd/lights/POWER1",
        "stateGet": "tele/lights/STATE"
    },
    "onValue": "ON",
    "offValue": "OFF",
    "startCmd": "cmnd/lights/POWER1",
    "startParameter": ""
}