AtomBaf / homebridge-mqtt-tasmota

Homebridge handler for tasmota/MQTT devices
MIT License
5 stars 5 forks source link

Homebridge not updating current state #5

Closed Ogge66 closed 2 years ago

Ogge66 commented 2 years ago

First of all, thank you for a great plugin. Very easy to add all of my devices, naming, index etc.

But something I haven’t figured out is how to sync the device statuses. Lets say I use the wall switch or have a timer set up in the tasmota web interface then it wont change the status in HomeKit. I can see in the logs that MQTT is sending from the tasmota device but nothing is received in homebridge.

Is this a known bug/limitation or am I just missing something obvious?

Thank you!

AtomBaf commented 2 years ago

Thanks for your feedback. As you're clearly pointing out, this is a more like a limitation I haven't figure out. You can see for instance (here)[https://github.com/AtomBaf/homebridge-mqtt-tasmota/blob/master/src/switch.js#L19] that an assumption is made on the initial state of the system when the first connection is made.

However, I don't have in my own setup the typical thing you're describing: a timer. What exactly tasmota is publishing when a timer-based event is triggered ? If you can send the mqtt message log, I would modify the code to handle this message as well. It seems easy to applicate. I can do it on my own, but not sure if it would help if you have a different version/setup/device on your own tasmota.

Thx again for your help in understanding these things.

AtomBaf commented 2 years ago

FYI, I tested some timer on my own setup and the state of the tasmota switch is correctly reflected in homebridge/homekit after a timer event. Did I miss something about your query?

Ogge66 commented 2 years ago

Hi,

Thank you for the quick reply, much appreciated! The main issue is that it doesn’t update when I use the physical wall switch. The timers I can just program in the home-app instead of in the tasmota web-interface

In the Homebridge-log it doesn't detect my action when I press the button which I can see in the Tasmota-console. Here I press off in the home-app and then I use the wall switch button (Sonoff T1 touch) to turn the lights back on. But in Homebridge it doesn't detect that action.

Homebridge log: [1/9/2022, 6:57:35 PM] [Tvättstugan Belysning korridor] Set Power: false [1/9/2022, 6:57:35 PM] [Tvättstugan Belysning korridor] Updated CurrentPower: OFF

Tasmota console log: 18:57:35 MQT: stat/tasmota_FF740F/RESULT = {"POWER":"OFF"} 18:57:35 MQT: stat/tasmota_FF740F/POWER = OFF 18:57:46 MQT: stat/tasmota_FF740F/RESULT = {"POWER":"ON"} 18:57:46 MQT: stat/tasmota_FF740F/POWER = ON

I need to log on to my Synology to find the logs for the timers I had earlier today to verify that it's acting the same or if I'm misstaken.

Thank you!

Please let me know if I can contribute to your support in any way.

AtomBaf commented 2 years ago

I maybe won't be very helpful, but as far as I can see, the code is explicitly listening to the stat/XXX/RESULT topic. https://github.com/AtomBaf/homebridge-mqtt-tasmota/blob/e9de22c821d8d351873862d72896e6d41729cb94/src/switch.js#L13 Any message from this topic is then handled and parsed to update the state of the accessory. https://github.com/AtomBaf/homebridge-mqtt-tasmota/blob/e9de22c821d8d351873862d72896e6d41729cb94/src/switch.js#L46

Maybe one hint: do you have in your accessory definition an index set? As you can see in the code, if this is true, then the parsing function will expect POWER1 instead of POWER to be published in the mqtt message by the tasmota device. I did some trials on effectively tasmota is publishing a POWER message and not POWER1 if the device is a simple switch. This could be the cause of your problem which I would solve easily.

Let me know your config, and if you can grap it, all the MQTT messages published during your test case.

AtomBaf commented 2 years ago

Finally got it and fixed it. Thx for your patience and feedback.

Ogge66 commented 2 years ago

Hi

Wow, that was quick! And with this update all devices status are also synced when Homebridge is restarted! Thank you so much!

11 jan. 2022 kl. 09:55 skrev AtomBaf @.***>:

Finally got it and fixed it. Thx for your patience and feedback.

— Reply to this email directly, view it on GitHub https://github.com/AtomBaf/homebridge-mqtt-tasmota/issues/5#issuecomment-1009726863, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJUGBSO3USEOV5JFVQUTVEDUVPV6PANCNFSM5LRYZIEQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.

Ogge66 commented 2 years ago

And how can I Donate a contribution for this?

Best regards Oscar

11 jan. 2022 kl. 10:37 skrev Oscar Ekström @.***>:

Hi

Wow, that was quick! And with this update all devices status are also synced when Homebridge is restarted! Thank you so much!

11 jan. 2022 kl. 09:55 skrev AtomBaf @. @.>>:

Finally got it and fixed it. Thx for your patience and feedback.

— Reply to this email directly, view it on GitHub https://github.com/AtomBaf/homebridge-mqtt-tasmota/issues/5#issuecomment-1009726863, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJUGBSO3USEOV5JFVQUTVEDUVPV6PANCNFSM5LRYZIEQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.

AtomBaf commented 2 years ago

Thx Oscar, this is not necessary to donate, but if you'd like to, this is much appreciated. Updated to version 0.4.6

Ogge66 commented 2 years ago

Hi Fabien

Well you saved me a lot of hazzle and headache so I sent you 10 Euros anyway.

Thank you very much!

Best regards Oscar

11 jan. 2022 kl. 12:28 skrev AtomBaf @.***>:

Thx Oscar, this is not necessary to donate, but if you'd like to, this is much appreciated. Updated to version 0.4.6

— Reply to this email directly, view it on GitHub https://github.com/AtomBaf/homebridge-mqtt-tasmota/issues/5#issuecomment-1009871092, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJUGBSKG25FFMHIABTYV7FDUVQH5DANCNFSM5LRYZIEQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.