philippoo66 / optolink-splitter

Splitter for Viessmann Optolink connection
GNU General Public License v3.0
13 stars 3 forks source link

Setting Available and Unavailable via MQTT #30

Closed FransOv closed 5 days ago

FransOv commented 1 week ago

As it is now, whenever Optolink-Switch stops, whether intentionally or because the RasPi or the service encounters a problem, the latest values are displayed in Home Assistant as if nothing is amiss. MQTT has the "Last Will and Testament" (LWT) functionality for this. In short this defines a message to be sent when the connection between the MQTT broker and the MQTT clients is lost or interrupted for some time and when it is started up again. It would be nice if this LWT functionality was added to Optolink-Switch. If you don't have time for this I'm willing to give it a try.

philippoo66 commented 1 week ago

sounds like a good idea! since you seem to have alread dealt with, it would be nice if you could implement! to me it is currently not clear how to trigger that last will e.g. when the process gets killed.

FransOv commented 1 week ago

I'll try it next week. It looks rather simple, set a few parameters at connect and publish a message in the on_connect and on_disconnect callbacks.

FransOv commented 1 week ago

I made the changes to mqqt_util.py (only three lines) and created a pull request. I also changed the py program in the Wiki on Home_assistant that generates the Home Assistant entities to include an availability_topic for each sensor and control.

FransOv commented 5 days ago

Pull request https://github.com/philippoo66/optolink-splitter/pull/32 submitted

philippoo66 commented 5 days ago

great, thank you! merged.

it would be great if you could usually work with the develop branch because I'm afraid now the develop branch is behind main. As far as I remember main was up to date witch develop, so we can merge main into develop, but we need to compare...