MrAsterisco / homebridge-hisense-tv

A Homebridge plugin to control RemoteNow-compatible HiSense TVs.
MIT License
21 stars 8 forks source link

V3.0.0 - replace python mqtt script with mqtt.js #62

Closed LeLunZ closed 2 months ago

LeLunZ commented 4 months ago

changes should already be reflacted in the README

MrAsterisco commented 4 months ago

Hey @LeLunZ ! It seems you're still working on this PR, so I converted it to a draft to avoid accidental merges. Please let me know when you'd like for me to review 😊 Thank you for pushing this forward!

LeLunZ commented 3 months ago

Well finally done... Saw that the homebridge-plugin-template migrated to esmodules so i included that. Also removed the comment from above to put it here again:

From my side this is finally done ;)

@MrAsterisco if you have the time and want to take a look at the code please do. I am not that skillful in writing README files so if you find any weird wordings there please tell me :)

I also released the first v3.0.0 beta so that this is testable while in review.


Furthermore just some information about the changes: Changes in homekit are now mostly triggered reactive based. (Means we only do polling if 100% necessary. For every other state updates, we get mqtt messages and then update the homekit state based on that)

For normal TVs we can never fully remove polling, because they shut down their mqtt server if turned off. The mqtt client could do the polling itself, but I didn't change the interval (60 seconds) to something lower, as its probably more resource intensive than just opening the socket for a very short time???


Also regarding the previously known issues:

Switching input to "TV" might not work properly. Home will not display any error, but the next TV state refresh will bring the input back to the previous one (which is also the one displayed on the TV).

Is now fixed. That was a problem with always creating the mqtt client (when publishing), where the connection probably wasn't 100% there or stable. Now when pressing a input it always works as the mqtt connection is now always open :)

  • Making changes to the TV state (turning on/off, changing input) while the Home app is opened will not trigger a live update. This is theoretically supported by the plugin, but it seems to not work properly.. Just switching to another app and then going back to Home will trigger a refresh.

Is now also fixed with the migration to the newer homebridge version and the reactive approach of updating states.