libetrv icon indicating copy to clipboard operation
libetrv copied to clipboard

[Question] can I use libetr to change schedules on the thermostat depending on geofencing settings?

Open neuronflow opened this issue 3 years ago • 7 comments

Hi,

I need schedules like:

USER A home: 7:45-10:30 -> 24°C 10:30-12:00 -> 21°C 12-19:30 -> 23°C etc.

USER B home: 7:45-10:30 -> 22°C 10:30-12:00 -> 19°C 12-19:30 -> 21°C etc.

USER A + C home: 7:45-10:30 -> 23°C 10:30-12:00 -> 20°C 12-19:30 -> 18°C etc.

is it possible to achieve this using libetrv and HA? Thanks for your help_

neuronflow avatar Jan 15 '21 22:01 neuronflow

I have created a branch that has schedule feature implemented. As far as I remember only missing thing here were testing and unit tests, but this functionality should work. https://github.com/AdamStrojek/libetrv/tree/feature/schedule

For now, there is no integration with HA, I saw that there are some implementation using MQTT protocol.

AdamStrojek avatar Jan 18 '21 09:01 AdamStrojek

For now, there is no integration with HA, I saw that there are some implementation using MQTT protocol.

Thanks. Could you specify which implementation you mean?

From my understanding standard Danfoss schedules only support 3 heating periods and two temperatures? I need more finegrained control, so probably the scheduling feature is not the way to go anyway?

Do you continue development on this repo? Is it possible to control the thermostates from HA using MQTT?

neuronflow avatar Jan 18 '21 11:01 neuronflow

Here one sample implementation: https://github.com/keton/etrv2mqtt

Danfoss support only to provide two temperatures per schedule: home and away https://github.com/AdamStrojek/libetrv/blob/feature/schedule/libetrv/data_struct.py#L101 Without sending new manual temperatures it is impossible to provide more setpoint temperatures.

libetrv is mostly implemented. Currently, I'm waiting for reports about problems issues + finish a schedule feature. I plan on releasing the library to PyPI to help HA integration. Please remember, this is just a library, not ready to use integration with MQTT or HA. I do not plan to implement such a thing for now.

AdamStrojek avatar Jan 18 '21 11:01 AdamStrojek

Thanks for the reply. My plan is to write a small rest api to control the heaters depending on who is home. This way I don't need to build so much of the application logic in HA and can later migrate to another platform if I feel the need to. My plan was is HA for visualization and the presence detection.

Is there a way to detect user input on the thermostat? I want to give users the opportunity by pausing the schedule for 90minutes. Can I toggle between manual mode and scheduled mode using your api?

As posted in the other issue, a few examples on how to use the API would be real helpful.

neuronflow avatar Jan 18 '21 18:01 neuronflow

Please remember that updating eTRV take some time, if you do not perform it in the background your request can timeout

By regular pulling current status, you can retrieve the current status. Maybe there is a possibility to use BLE notifications to inform about changes, but I didn't figure it out. Right now in regular time intervals, you are forced to fetch the current status of the value. This is slow and will drain the battery. You also will not have the exact time when switching has happened.

I will think about adding some examples, but current testing CLI is a good example of how to use this library

AdamStrojek avatar Jan 18 '21 20:01 AdamStrojek

Please remember that updating eTRV take some time, if you do not perform it in the background your request can timeout

What timeout values do you recommend?

Hmm do you think it will drain a lot of battery? Assuming I do schedule updates every 30 minutes, I could check if the set_temperature is different from scheduled temperature and skip schedule updates for 60minutes. Then the manual overwrite time would be 60min + 1-29 minutes.

Yes, getting notifications about data updates would be far more efficient and would allow for more precise timings.

neuronflow avatar Jan 18 '21 22:01 neuronflow

It is hard for me to recommend any. This request should be done in a background.

About battery drain, I have no such data on how much it takes in communication mode (when eTRV status light is red)

I was looking at available services for eTRV and I don't see any notify service that would allow subscribing changes.

AdamStrojek avatar Jan 24 '21 14:01 AdamStrojek