jheling / freeathome

Free@Home component for Home Assistant
103 stars 37 forks source link

Event based temperature correction #90

Closed steffenaxer closed 3 years ago

steffenaxer commented 3 years ago

Hi, does anybody know if it is possible to change the temperature correction value of a thermostat? I know, that the AP sends a message "RtcTemperatureCorrection". And from the backup *.pro file I can investigated that there is a parameter which stores the information: `

   </parameter>`

Not all of the available inputs of a thermostat have been revealed till now. Maybe we could give a try to find out together the impact of all available inputs:

idp0000 = idp0001 = idp0002 = idp0003 = idp0004 = idp000F = idp0010 = idp0011 = Eco mode idp0012 = On/Off idp0013 = idp0014 = idp0015 = idp0016 = Target temperatur idp0017 = idp0018 = idp0019 = idp001A =

My long term objective would be to adjust the temperature corrcetion depending on the current outside temperature, which would be a realy cool feature.

Best, Steffen

Tho85 commented 3 years ago

The backup files are not very telling when it comes to identifying input and output datapoints. If you dump your free@home configuration via HA as described here, you get a much more complete XML file. Here's a snippet of a room controller I have, and there you can find name attributes for all input/output datapoints and parameters.

As you can see, the temperature correction is indeed a parameter that needs to be changed. Changing a parameter is not yet supported by this custom component. However, it would be possible to implement a custom service like freeathome.set_parameter that takes a device serial number, channel id, parameter id and a target value. This should allow to set the temperature correction. But again, this is not yet implemented.

(BTW, the datapoints themselves are not very useful as they may differ from device to device. The combination of function IDs and pairing IDs is key to understand a device's functionality. See the documentation from ABB's REST API.)

steffenaxer commented 3 years ago

Thank you @Tho85! I knew that we had the possibiility to create those dumps but had forgotten how to do it. Your dump and the mentioned approach sounds applicable. I will provide a PR that allows to set parameters. I will use the mentioned design pattern - looks very clear to me.

steffenaxer commented 3 years ago

Do you think, setting a datapoint is equal to setting a parameter? There is offically not pairingId for setting paramters (e.g. the RtcTemperatureCorrection) . While being in the free@home webinterface, haveing monitoring (free@home monitor) enabled, I can see that the webinterface sends 0x27 (RtcTemperatureCorrection). 0x27 looks like the internal pairingId for changing the temperature correction value. I had things already implemented to use this "new" pairingId , but had out of the box no way how to trigger (send) a new temperature correction.

steffenaxer commented 3 years ago

Ok, already found out that pfreeathome.py collects available dataPoints by inputs and output. So we need probably to parse also parameters in order have them fully loaded.

steffenaxer commented 3 years ago

Next update. I'm quite close to have a running version:

2021-02-07 13:41:29 DEBUG (MainThread) [custom_components.freeathome.fah.pfreeathome] received parameter ABBXXXXXXXXX/ch0000/pm0001 = -1.6

I'm able to read information and keep devices and their parameters updated. I used the same design pattern @Tho85 has used for the dataPoints. Each device may have parameters that are registerd per device class. paramterIds are centrally stored in constans, like it is done for the pairingIds.

In order to have things seperated, we will have a update_parameter(self, param, value) so that we are not mixing things with datapoints.

Will now start to add a service, which allows to change the parameter for a thermostat from HA.

Best, Steffen

steffenaxer commented 3 years ago

Bingo... the safe is open :)

2021-02-07 16:51:04 INFO (MainThread) [custom_components.freeathome.fah.pfreeathome] set_datapoint ABBXXXXXXXXX/ch0000 idp0016 21.00
2021-02-07 16:51:04 INFO (MainThread) [custom_components.freeathome.fah.pfreeathome] method response: True
2021-02-07 16:51:04 INFO (MainThread) [custom_components.freeathome.fah.pfreeathome] set_parameter ABBXXXXXXXXX/ch0000 pm0001 -0.51
2021-02-07 16:51:04 INFO (MainThread) [custom_components.freeathome.fah.pfreeathome] method response: True

We required a certain version of "send_rpc_iq". But it was easy to guess the right remote interface. RemoteInterface.setParameter did the job.

steffenaxer commented 3 years ago

Ok, we have a first trial version (see #91). Feel free to check out my fork The current version allows us to set the temperature correction via an entity service, similar to the cover device. You can test service by the help of the developer tools --> freeathome.thermostat_temperature_correction --> select your climate device...Feedback appreciated :)

Tho85 commented 3 years ago

Nice! Maybe you could open a draft pull request so that we can discuss things there?

steffenaxer commented 3 years ago

Done have a look at #91

steffenaxer commented 3 years ago

Ok. I think this issue is fixed. Thanks @Tho85 @EnricoBilla for review and support!