LubosD / esphome-smartboiler

ESPHome component for Dražice OKHE smart boilers
20 stars 9 forks source link

Time synchronization #3

Open DarkFeniXZp opened 1 year ago

DarkFeniXZp commented 1 year ago

Thank you very much for your integration. Perhaps you can add a function to automatically set the time on the boiler when connected? After blackouts, the time on the boiler is reset, you have to manually enter it several times a day/ I will add. If the boiler, that was connected through the component, is turned off, and than turning on again, the time on it is reset. Even if it was off for a short time. So setting the time after connecting is quite necessary, otherwise each time you have to turn off manually, connect from your phone and reconnect the boiler to the HA.

pedobry commented 10 months ago

This is not very easy to do due to limited resources on ESP32. The water heater does not actually report the date - it reports only time like: 'Monday, 11:30:35" and the application use Gregorian calendar to calculate the difference between the day and time of water heater and the actual current calendar time and date. And then sends only a time difference adjustment. We don't have Gregorian calendar on the ESP.

DarkFeniXZp commented 10 months ago

I'm not very good at programming, but esphome has a time component (https://esphome.io/components/time). We can use lambdas to output the desired date format and compare the boiler time with it. Or not even compare, but forcefully transmit the current time in the required format when connecting.

pedobry commented 10 months ago

As I said.. the water heater does not accept an absolute time.. it needs a time adjustment value (difference between current time and water heater time). The water heater does not report the date. If the water heater reports "Monday, 11:30:35" and ESP would have time "Sunday, 09:10:46", you need to calculate the difference in secons (to add or substract). Also things get complicated due to timezones. Don't know if the water heater internally have them or not. I have not seen any settings about that.