Alexwijn / SAT

The Smart Autotune Thermostat (SAT) is a custom component for Home Assistant that works with an OpenTherm Gateway (OTGW).
GNU General Public License v3.0
51 stars 12 forks source link

Use MQTT instead of socket #3

Closed enryIT closed 10 months ago

enryIT commented 1 year ago

Using direct socket cause connections issue and instabilities in both OTGW and HA, and it makes impossible to use an external OTMonitor instance. Nowadays MQTT can be used, see https://github.com/rvdbreemen/OTGW-firmware, please consider ditching socket and switch to MQTT.

Alexwijn commented 1 year ago

When we started working on the component, we considered using MQTT integration to communicate with the gateway. However, we decided against it because not everyone has access to an MQTT server, and it could make things more complicated for users who aren't as tech-savvy.

We do understand that some users may prefer to use MQTT, and we want to be as accommodating as possible. Therefore, we plan to explore the possibility of including the option to connect to the gateway directly or through MQTT in the future. This would give users the flexibility to choose the method that works best for their needs.

Of course, this is not a guarantee, as it depends on demand and feasibility. For now, we believe that connecting directly to the gateway will be the simpler option for most users, but we are open to exploring other possibilities as we continue to develop the component.

sergeantd83 commented 1 year ago

Also we found out when using both OpenTherm gateway integration and SAT causes some connectivity issues. If you use the OpenTherm Gateway integration try to remove it.

enryIT commented 1 year ago

When we started working on the component, we considered using MQTT integration to communicate with the gateway. However, we decided against it because not everyone has access to an MQTT server, and it could make things more complicated for users who aren't as tech-savvy.

We do understand that some users may prefer to use MQTT, and we want to be as accommodating as possible. Therefore, we plan to explore the possibility of including the option to connect to the gateway directly or through MQTT in the future. This would give users the flexibility to choose the method that works best for their needs.

Of course, this is not a guarantee, as it depends on demand and feasibility. For now, we believe that connecting directly to the gateway will be the simpler option for most users, but we are open to exploring other possibilities as we continue to develop the component.

I understand, keep in mind that very few users use "pure" OTGW, also read as "without MQTT", on Home Assistant.

From https://www.home-assistant.io/integrations/mqtt/ The MQTT integration was introduced in Home Assistant pre 0.7, and it's used by [42%](https://analytics.home-assistant.io/integrations) of the active installations. Its IoT class is [Local Push](https://www.home-assistant.io/blog/2016/02/12/classifying-the-internet-of-things/#classifiers) and it scores gold on our [quality scale](https://www.home-assistant.io/docs/quality_scale/). 42% on a total of all HA instances, some of them are dead, some of them have DNS blacklists like pihole/adguard that prohibits HA to send telemetry data, and whatnot. I can surely affirm that the real percentage is much more higher.

Using direct socket connection gives you only one concurrent reliable OTGW usage instance.

Also we found out when using both OpenTherm gateway integration and SAT causes some connectivity issues. If you use the OpenTherm Gateway integration try to remove it.

Using more than 1 single instance of the socket, being SAT, OTGW integration or the OTMonitor application, causes the OTGW fimware to overload, it can't keep up with the requests and simply drop some packets.

I don't have HA OTGW integration, I only use MQTT and the OTMonitor application from my PC because it displays logs and is able to record those. If I turn on this integration that uses the socket connection it interfere with OTMonitor and viceversa; that's why I proposed to ditch it and switch to only MQTT.

robertcollin commented 1 year ago

Agree, MQTT would be a really good addition here. Thanks for your hard work on this already really promising project.

Alexwijn commented 1 year ago

I'm happy to announce there are now plans to add support for it! But we are thinking of that the firmware may need to be updated, so that we get a specific topic that we can subscribe to since the current one focus more on Home Assistant. to avoid confusing and errors I think only one instance should be visible in Home Assistant (even though you can disable the other).

So stay tuned!

Alexwijn commented 1 year ago

Unfortunately after some days of hard work, the current implementation of MQTT with OTGW lacks the required data to get it working.

Another downside is that there is a slow startup because we are waiting for the required fields to get started.

So, for now we keep the socket as the main connection to OTGW. Which gives us the most control of the boiler too.

I'll close this issue since it can't be implemented in the current state. Maybe a future firmware can support multiple socket connections or we get a dedicated one for SAT to resolve the issue with OTmonitor.

enryIT commented 1 year ago

Unfortunately after some days of hard work, the current implementation of MQTT with OTGW lacks the required data to get it working.

Another downside is that there is a slow startup because we are waiting for the required fields to get started.

So, for now we keep the socket as the main connection to OTGW. Which gives us the most control of the boiler too.

I'll close this issue since it can't be implemented in the current state. Maybe a future firmware can support multiple socket connections or we get a dedicated one for SAT to resolve the issue with OTmonitor.

Which data is lacking? I can make a merge request on OTGW MQTT firmware with the missing parameters you need.

Alexwijn commented 1 year ago

Today I had a discussion about it and the conclusion was that my boiler didn't support most values that was actually reported by the pyotgw library. So all is good, gave up too soon.

I already got a proof of concept working. It uses the existing MQTT device in HA. So stay tuned!

robertcollin commented 1 year ago

Great news!

Yocee84 commented 1 year ago

I Need to uninstall the SAT. Im waiting for mqtt. The API mode is always freeze.

Alexwijn commented 1 year ago

Try the latest beta, it has MQTT support for some months now.

Alexwijn commented 10 months ago

Since support has been added a long time time ago, I close this issue. If there is any issue with it, please create a new one.