I have an Atrea ventilation unit at my home with an RD5 ethernet controller.
After a bit of reverse engineering the communication between rd5 and web commands, I created a python library to make issuing commands a lot easier.
Later on, I built a HomeAsssistant custom component which I am now sharing with you after a month or two of testing.
I tried to follow all the guidelines to create a properly written component that could be eventually merged into the core of home assistant (I will appreciate any tips here ). I consider myself to be still pretty new to python though
I am testing your component on RA5 (with heaitng). Everything works! Great job and big thanks! I have a minor difference, my unit sends temperature value of the heat exchanger instead of indoor temperature sensor.
Is it possible to control the HVAC unti in HA automations?
Is it possible to get the value readings as sensors (to be recorded in InfluxDb)?
current_temperature shows the same value as supply_air_temp and also as the component’s visual (the big number inside the circle).
I believe that supply_air_temp is measured inside the unit. So if the unit comes with heating feature, that will not correspond to the real ambient temperature, when the unit is heating.
For ambient temperature measurement, there is a sensor inside the unit’s touch screen. Perhaps it should be reported by inside_temp, but in the posted status it shows 126 (unit’s touchscreen shows 22.2).
Seems like your unit uses a different memory address for the temperature. There is no official documentation for the API so I am basically reverse-engineering it all. What is the exact model of the unit?
I might be able to fix this but I need some more information for debugging from you.
Please do the following on your PC (not Home Assistant):
Install python3
Install pyatrea module with console/terminal pip “pip install pyatrea” or “pip3 install pyatrea”
Create a new file, debug.py with following content (please change IP and password to your atrea unit):
import pyatrea
atrea = pyatrea.Atrea("atrea IP","your atrea password")
status = atrea.getStatus()
if(status == False):
exit("Authentication failed")
for id, value in status.items():
print(id + " - " + atrea.getTranslation(id) + ":" + value)
Sign in to your atrea web interface through web browser
Turn on the unit and let it start so that you can see the temperatures via UI on the webpage
The script above outputs everything that is currently saved/provided by the unit, we are trying to figure out the correct addresses for the outside, inside and supply air temperatures.
Now the important step: Run the script by executing “python3 debug.py” and note down the temperatures shown in the user interface of the unit.
There should be a memory address which has the same value as temperature shown in the UI, multiplied by 10. (Example: I10202 - The TEa temperature sensor value - the air temperature of the outside or indoor air (according the unit orientation setting):82 - this corresponds to 8.2 outside temperature on my unit)
When you are done, please send me all the reported temperatures you noted down (ideally also a screenshot) and the output of the script. This will help me figure out the difference between our units.
The temperatures are easy to find it in the output since there are also explanations to different sensors.
I10207 - The indoor temperature - measured by the inbuilt sensor in theCP Touch controller:219
The temperature “Teplota pirvodu” has fluctuated between taking a screenshot and running the script
I10200 - The TU1 temperature sensor value - the air temperature after the heat exchanger - supply or exhaust air according to the unit orientation.:381
Thank you for your info and research, it was very useful.
Thanks to the output you shared I compared it with my unit output and have determined an address of which value determines which address to read for indoor temp.
It’s a bit more complicated with those descriptions, they depend on the unit type, how is it installed and depending on values of different addresses, different addresses are read for data like indoor temperature.
Have you noticed as well that Atrea handles negative temperature values in a pretty strange way? When it is minus outside, temperature sensor shows values above 6550.
I have compared the history of the sensor with weather service history and found out the following pattern:
CorrectTemp = (TempValue - 6550) * (-1)
I guess temperatures below -10, -20 etc. will have different constants than 6550 but I can’t figure that out since it was never below -10 this winter.
I am not using the outside sensor for anything in the UI or automations so I did not notice. I have no way to test it now since it is never freezing anymore over here, I will check it out in the next winter, if I remember
That being said, I just rolled out a fix that hopefully works, using your formula.
I have figured out the weird temperature trying to create some Grafana charts
BTW I admire your work of reverse engineering, I have accumulation tank which is on network and I would love create a component for it like you did for Atrea but I have no experience at all. Could you advise if it’s worth for total noob to start digging into it and if so where to start?
There are many ways how to approach reverse engineering. The first step is always to check if there is any api or a communication standard available from manufacturer, if not, see if anyone else has reverse engineered the service. If none of those are available, then its time for some reverse engineering:
Most common methods I use are (from the easiest to the hardest):
In a case of webpage like Atrea, you can open network tab in chrome, do an action like setting a temperature and see what request has been done. Check the post data etc and try to figure out the logic behind it. Reading source code, for example in js files (if available) might be helpful too.
Inspecting network traffic through fiddler as an example. If set up properly, you can also (most of the time) decrypt https traffic too. Another popular but more complicated method is doing this through wireshark.
In a case of a mobile app, you can use method 2, unless an app uses certificate pinning. If that is the case, you need to decompile an app and edit byte code directly to disable certificate pinning. That gets a lot more complicated. You can also try using some automatic tools for this if your phone is rooted, but from my experience it does not work well.
Unfortunatelly the formula for minus temperatures was not correct. This night it was freezing and the first value after 0 was -5989 (I guess that must have been when it was -1 outside). What would mean that the original value by reverse calculation was (-5989)*(-1)+6550=12448. That is completely different number than what I was getting a month ago. I am really puzzled now. Only that I figured out for sure is that the value shall not be multiplied by -1 as that reversed the trend…
I am quite new to HomeAssistant so my question might be lame, but I have installed yours atrea component, started it and set the IP and password in configuration.yaml but I dont see the atrea component anywhere. Could you give me some advice what to do to see dialogs as shown on your pictures, please?
After adding atrea to configuration.yaml and restarting your Home Assistant instance, you should be able to see climate.atrea inside Developer Tools -> States.
If you do not see atrea inside Developer Tools -> States or something is not working make sure to check Developer Tools -> Logs for any mention of Atrea.
Thanks a lot for sharing this component! I’ve tried to set it up, but it does not seem to work with my Atrea unit. I don’t have RD5 controller, but the Atrea Duplex 390 that I have has an ethernet port directly in the main unit and hosts a simple web server.
I’ve done a bit of debugging around your Python library and it looks to me that the format of /config/xml.xml of your unit is completely different from mine. I’m judging that based on the fact that the Python library is specifically looking for nodes named “RD5” in the response (init.py:75) and there are none in /config/xml.xml of my unit.
Could you please paste here an example /config/xml.xml response from your unit? I would like to compare it to mine to determine whether it makes sense to try to tweak the code you’ve already implemented or whether I’ll need to start reverse engineering from scratch.
Since the format seems to be the same beside the names of top 2 nodes, I’ll try modifying your implementation and report back on whether I could get it to work.
In addition to different nodes in xml.xml, my Atrea unit also provides translations compressed using LZW.
I have made a PR to support both, while keeping the compatibility with previously already supported formats: https://github.com/JurajNyiri/pyatrea/pull/2
This adds at least a basic support for Duplex 390. I will need to do more testing to confirm that all values are correctly represented for my unit.