laetificat / haanna

Plugwise Anna API to use in conjunction with Home Assistant.
MIT License
5 stars 5 forks source link

anna -> adam support? #1

Closed riemers closed 4 years ago

riemers commented 5 years ago

Hi there fellow leidenaar :)

I bought some plugwise equipment and it works pretty nice. Then noticed there was no component for it :( then i saw your hanna component and i was 'hey this might work'.

Only to find out that adam is a bit different since it allows for more zones (uses toms for radiators, lisa's for thermostat screens and floors for floor heating)

Is there anyway we can incooperate this too? haadam or haaplugheat? Don't mind to show my face since your in the same city πŸ‘

riemers commented 5 years ago

If you only have 1 lisa, then this already works the same:

location_id = root.find("appliance[type='zone_thermostat']/location").attrib['id']
#location_id = root.find("appliance[type='thermostat']/location").attrib['id']

Just change thermostat to zone_thermostat. However this will bork i presume when adding multiple.

As reference, there are more types you can get out of it:

thermostatic_radiator_valve (tom)
zone_thermostat (lisa)
heater_central (boiler)
gateway (Adam) (general gateway information)
open_therm_gateway (OpenTherm Gateway)

Noticed you had a ping for a 404 seems it has this one http://192.168.1.38/cache/gateways;ping

riemers commented 5 years ago

image

This is from my adam. Only missing is a pulldown to set away/home/etc. Presume you can set that for all too in some way.

frankhommers commented 5 years ago

This would be great to have this with more than one Plugwise Lisa!

laetificat commented 5 years ago

Hello, thank you for your interest in this project. I've been very busy lately so sorry for the late response (the recent activity actually triggered me to check up on this project again).

Implementing multiple devices is something I can take a look at, at least for the lisa's if I can find them. The ping endpoint is a great tip and I will implement that for sure.

riemers commented 5 years ago

Well since you live in the same city (i presume) i can always help out with the hardware for testing if that would help you out.

riemers commented 5 years ago

No rush yet, but if you have some spare time i can always drop by with an adam and a lisa. I should really go get myself multiple lisas and valves so i can get the data out and see what is different. In all fairness i think that this component might even support then both making the anna name maybe not the right one. But that is the least of the issues. Did see updates on the pypi, all little things help.

@CoMPaTech unless you have some time, i see you live around utrecht.. i sometimes visit nieuwegein, is around the corner.

laetificat commented 5 years ago

@riemers I do not have much spare time now or in the near future, I'll try my best to be more active on this project but life tend to get in the way sometimes. The API is not set up to handle multiple devices and zones, this plays a huge part in the Adam software. It is possible to refactor the code into supporting the Adam and I think that is the correct way to move this project forward to but it will be a huge task. Regarding the name, I think it should be more generic like Plugwise Python API or something once Adam is supported.

riemers commented 5 years ago

Agreed, i'll get some devices more for in my house to play around. You could also just add compatech to your repo for the time being since he helped too. In case your too busy, this way we all try to help out. (i got 2 kids, i know how busy stuff can be)

laetificat commented 5 years ago

I added compatech to the repo, thanks for the tip!

riemers commented 5 years ago

@CoMPaTech this one is still open, i'll leave it here for the future. My valves are not ok for plugwise floor heating so i first need to get those replaced (some weird dimensions)

riemers commented 5 years ago

Took longer then expected, but i now have a lisa/adam/floor and a tom. So i think pretty much the whole stack sort of speak. @CoMPaTech i know you would want to take a look at it, is there any data specific you want? Outputs of certain things? Always good to have.

ghost commented 5 years ago

I installed Adam, Lisa and a Tom last weekend and would love to have the thermostat in HA! I'll also be glad to help with testing and supplying information, and if I can find time will look into help in development of the plugin. I don't really have experience with Python yet, but it might be a good way to learn something about it :)

frankhommers commented 5 years ago

Yeah, I also have Adam HA in production for quite a while now. It manages multiple zones. Only thing I am missing is nice Home Assistant integration ;-)

CoMPaTech commented 5 years ago

Is there any XML exposed like our Smile's (the boiler device behind Anna) have? i.e. 192.168.x.y/core/domain_objects and accompanying /core/rules /core/appliances' and maybe something like/#zones/...`

The way we control Anna, from @laetificat 's findings is by reading the XML and posting accordingly what change we need from inspecting what the browser interfaces. I.e. reading is just interpreting said XML, writing is compromised by inspecting the network traffic from the browser.

XMaarten commented 4 years ago

@CoMPaTech I have a Adam as well, and I attached a couple of XML files for you. My living room uses a floor radiator valve, with a separate zone thermostat because the valve itself is in a different room, and three rooms with conventional radiators.

Below the XML files: rules.txt appliances.txt domain_objects.txt locations.txt

riemers commented 4 years ago

@CoMPaTech @bouwew a new year new chances.. i would really like to see Adam support. What would be required to make a start, do you need details? The devices? Do you need a adam to test with etc?

Wait, i can do better. Found a shop that is willing to donate a adam, lisa, floor, tom for support in HA. You can always make a PR later to HA and mention the shop (since it is nice gesture) Only question would be, does it have extra benefit for either @CoMPaTech or @bouwew since they have a anna now. πŸ™β€β™‚

bouwew commented 4 years ago

@XMaarten @riemers I quickly looked at the XML-data provided. I see quite a few similarities with the data in the Anna XML-files. It shouldn't be too difficult to create something. My main question is, what would you like to see in HA as a start? Meaning what data/values would you like to see? Next, what kind of programming would you want to be able to do? Can you share picture from the App that you are using?

bouwew commented 4 years ago

@riemers being practical, I have floor-heating downstairs and radiators upstairs. In my house there is an Intergas CV-ketel that is the heat-source.

I could put up a Lisa and a Tom in my bathroom. And also an Adam is needed, I see in the docs that the Anna can be connected to the Adam as well. So, yes, I would be interested to experiment with these parts and try to integrate them into HA.

riemers commented 4 years ago

In that case, drop me a mail at riemers@binkey.nl so we can talk, or just on discord Riemers

4426

bouwew commented 4 years ago

@XMaarten can you please capture the XML at /core/direct_objects as well? If that path is on your Adam?

XMaarten commented 4 years ago

@bouwew What I would like to do is to see and control the temperature of the four different rooms I have. I attached the direct_objects and a screenshot of the Plugwise app.

direct_objects.txt plugwise

bouwew commented 4 years ago

@XMaarten One more question: which hardware items are in your system and how many?

XMaarten commented 4 years ago

@bouwew The temperature of the living room is measured by the thermostat, and the radiator valve (Floor) controls the floor warming. The valve is not in the living room itself so the temperature measured of the floor warming can not be used, I added a separate thermostat for measuring the temperature in the living room. Besides the living room I have two sleeping rooms and a bathroom controlled by their own radiator valve (Tom), which measure their own temperature in the room, so four rooms in total.

riemers commented 4 years ago

That’s why we have a Lisa too. That measures the temperature and allows control of a floor.


Van: XMaarten notifications@github.com Verzonden: Sunday, January 12, 2020 1:24:16 PM Aan: laetificat/haanna haanna@noreply.github.com CC: Erik-jan Riemers riemers@binkey.nl; Mention mention@noreply.github.com Onderwerp: Re: [laetificat/haanna] anna -> adam support? (#1)

@bouwewhttps://github.com/bouwew The temperature of the living room is measured by the thermostat, and the radiator valve (Floor) controls the floor warming. The valve is not in the living room itself so the temperature measured of the floor warming can not be used, I added a separate thermostat for measuring the temperature in the living room. Besides the living room I have two sleeping rooms and a bathroom controlled by their own radiator valve (Tom), which measure their own temperature in the room, so four rooms in total.

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/laetificat/haanna/issues/1?email_source=notifications&email_token=AAFGQOLMVRR3BJDEJSPUU7LQ5MDXBA5CNFSM4GZBAHZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIWYWDQ#issuecomment-573410062, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAFGQOPYFEC3UHS3ABME7K3Q5MDXBANCNFSM4GZBAHZQ.

bouwew commented 4 years ago

@XMaarten I need you to be more specific to be able to make sense of the data in the XML-files. 1x Adam HA I would assume? 1x thermostat - Plugwise / other brand, what type (OpenTherm or on/off), connected to the Adam? 1x Floor 3x Tom Anything else?

XMaarten commented 4 years ago

I am sorry. 1x Adam HA, connected to the boiler with on/off, I need to replace my boiler to a OpenTherm one. 1x Floor (radiator valve for the living room) 1x Lisa (thermostat / sensor for the living room) 3x Tom (for sleepingrooms and bathroom)

Lisa is not connected to anything else, it is only used as temperature sensor for the Adam, to measure the temperature in the living room.

bouwew commented 4 years ago

Great, thanks!

bouwew commented 4 years ago

I had a detailed look at the XML-data, my first impression is that there will be several climate-entities, 4 in XMaartens system, instead of 1 for the Anna in my system, each with the possibility to set presets and activate a weekly schedule. Is it possible to create your own weekschedule per "thermostat"? And is it possible to create more than one schedule per "thermostat"? Or can there be only one weekschedule per "thermostat"?

XMaarten commented 4 years ago

Yeah, that is possible, you can give each room its own schedule.

bouwew commented 4 years ago

And what about my question about having more than one schedule per room? Possible? Or not?

XMaarten commented 4 years ago

You can define schedules in the plugwise app and specify what schedule is applicable to which room. So yes, you can define multiple schedules.

frankhommers commented 4 years ago

I can help with test data as well. I have 4 rooms defined here 3 lisa's, 4 plugs and 1 adam-ha. Tell me what you need ;-)

riemers commented 4 years ago

@bouwew will be sponsered with some hardware from https://hashop.nl so he has all the devices to play about. Does not hurt to give the xml's too so he has some more different ones too. He has some personal items on his agenda, when that has settled he can take a swing at the code part.

frankhommers commented 4 years ago

Ah I'll wait from specific requests from @bouwew then.

bouwew commented 4 years ago

@XMaarten I'm working with your files, I think you have defined 2 weekschedules for K's bedroom, correct? Both with the same name: K. Would you mind if I set a rule to use different names for different schedules? That will make my (programming) life much easier :)

About the progress, this is the present output of my code:

{'95395fb15c814a1f8bba88363e4a5833': 'zone_thermostat', 'e4fe90f9b4c44887b09f8640e828eb3b': 'thermostatic_radiator_valve', '450d49ef2e8942f78c1242cdd8dfecd0': 'thermostatic_radiator_valve', 'bc9e18756ad04c3f9f35298cbe537c8e': 'thermostatic_radiator_valve', '77ad7c755e0b477ebb1dc1361252832b': 'thermostatic_radiator_valve', '412c73075c4040058118e65cde1f0be9': 'heater_central'}
95395fb15c814a1f8bba88363e4a5833 zone_thermostat
{'6d42c3e3fa384294ad76780120eb7a88': 'Living room'}
Living room
{'home': 20.0, 'asleep': 17.0, 'away': 15.0, 'vacation': 15.0, 'no_frost': 10.0}
{'Living room': True}
e4fe90f9b4c44887b09f8640e828eb3b thermostatic_radiator_valve
{'75ab287de4194550bec50477f46525be': 'Bedroom 1'}
Bedroom M******
{'home': 20.0, 'asleep': 17.0, 'away': 15.0, 'vacation': 15.0, 'no_frost': 10.0}
None
450d49ef2e8942f78c1242cdd8dfecd0 thermostatic_radiator_valve
{'fc8b90f96c76416a81fea1921e16827c': 'Bedroom 2'}
Bedroom K***
{'home': 20.0, 'asleep': 17.0, 'away': 15.0, 'vacation': 15.0, 'no_frost': 10.0}
{'K***1': False, 'K***2': True}
bc9e18756ad04c3f9f35298cbe537c8e thermostatic_radiator_valve
{'6d42c3e3fa384294ad76780120eb7a88': 'Living room'}
Living room
{'home': 20.0, 'asleep': 17.0, 'away': 15.0, 'vacation': 15.0, 'no_frost': 10.0}
{'Living room': True}
77ad7c755e0b477ebb1dc1361252832b thermostatic_radiator_valve
{'01bc059aef734090bfad1d01c9145ca0': 'Bathroom'}
Bathroom
{'home': 20.0, 'asleep': 17.0, 'away': 15.0, 'vacation': 15.0, 'no_frost': 10.0}
{'Bathroom': True}
412c73075c4040058118e65cde1f0be9 heater_central
{}

First I'm trying to find all the devices that are present in the system and that I'm interested in. I also collect the ID's which I can use to find linked information. You can see the Lisa, the 4 Tom's and the heating device. There are more but of no interest at the moment.

Next I'm trying to find the locations that you have defined in your home and their real names. For instance I see Bedroom 1 and Bedroom M** in the various files, these two are linked. I assume the name Bedroom 1 is created by the system itself and you have entered the name Bedroom M**. Is my assumption correct?

Next, I'm finding the presets for each location (I still need to add the status for each preset, active or not)

Finally, I'm finding the defined weekschedules for each location and their status active (True) or not (False). As you can see, I've renames the schedules named K*** to K***1 and K***2.

More to follow...

XMaarten commented 4 years ago

I guess I forgot to obfuscate some names from the XML, sorry.

I have no objection against using unique names in the different schedules, and I don't care that much about the schedules anyway. Most important for me is the view the current and the set temperature, and adjust the set temperature as needed, I can always use the plugwise app to define the schedules. If you ask me, I would just leave them out.

riemers commented 4 years ago

I would ignore schedules, those you setup in a adam/anna. Sure it would be nice, but do not forget that both those devices have a learning pattern that they use to get the ideal temperature in a correct manor. It takes about 2 weeks for the system to work optimal. Those kind of logic is not present as of now in HA. Temperature up/down and to set the modes "vacation/away/sleeping" etc would be the first step.

bouwew commented 4 years ago

Ok, great :)

My goal is to create the same functionality as is now present in the Plugwise Anna code, as far as this is possible. And, if possible, support both Anna/Smile and Adam systems. I just tested my latest code on my Anna, the info that I want to obtain is all there and no errors! Looks like I'm on the right track :)

@riemers, when comparing the Adam-XML-code to the Anna-Smile-XML-code I see a lot of similarities. So, what is possible on the Anna is possible on the Adam, is my working assumption. I will find out when I actually install the Adam, etc. in my home.

For now, I will try to finish the "obtaining-data" part, meaning create the plugwise library and a matching climate.py file that the interested people can install as a custom_component. Next, for that I will need to have the Adam installed, I will tackle the "programming"-part.

riemers commented 4 years ago

You can use HACS for a custom component then do all your work in the "dev" branch, people can select that branch then in hacs i believe to try it out easilly. Once working you can push it to master and eventually send a PR to HA. But i know that will take some time hence HACS in between. (although i don't mind downloading from somewhere too)

bouwew commented 4 years ago

@riemers I have a default weekschedule programmed in my Anna that I run continuously when I am home. Only when I'm away for a longer time, I switch to a preset. When looking at the Adam-XML-code from XMaarten I can see that the Adam is basically providing the Anna-functionality for every location where there is an Anna, a Lisa or a Tom present. So don't worry about it :)

bouwew commented 4 years ago

I know HACS, I will use it when the component is mostly done. But first I will post the link to my github here, so the early adopters can test first. When the testing within this limited group is successful then I'll put it in HACS, like some of my other plugins that are in HACS now.

bouwew commented 4 years ago

@laetificat @CoMPaTech Please review my work on the new plugwise library: https://github.com/bouwew/plugwise Am I taking the right approach with this output?

For illustration, this is the output I obtain from my Smile/Anna:

[['Living room', None, '20.00', '20.25', {'home': 20.0, 'vacation': 15.0, 'no_frost': 10.0, 'asleep': 18.0, 'away': 18.0}, ['Test', 'Weekschema'], 'Weekschema', 'Weekschema'], ['Controlled Device', '34.0', None, False, None, False, '6.0', '6.9']]

Please see the README.md on the github for an explanation of the data-items.

Please note: only the functions that obtain data are working, I have not done any work on setting stuff. This code is copied over from haanna.

bouwew commented 4 years ago

And this is the output from a set of Adam-User files:

[['Living room', '0.84', '20.00', '19.70', {'home': 20.0, 'asleep': 17.0, 'away': 15.0, 'vacation': 15.0, 'no_frost': 10.0}, ['Living room'], 'Living room', 'Living room'], ['Bedroom M***', '0.48', '21.00', '20.93', {'home': 20.0, 'asleep': 17.0, 'away': 15.0, 'vacation': 15.0, 'no_frost': 10.0}, [], None, None], ['Bedroom K***', '0.77', '20.00', '20.18', {'home': 20.0, 'asleep': 17.0, 'away': 15.0, 'vacation': 15.0, 'no_frost': 10.0}, ['K***', 'K***'], 'K***', 'K***'], [], ['Bathroom', '0.88', '17.00', '19.13', {'home': 20.0, 'asleep': 17.0, 'away': 15.0, 'vacation': 15.0, 'no_frost': 10.0}, ['Bathroom'], 'Bathroom', 'Bathroom'], ['Controlled Device', '80.0', None, False, None, None, None, '3.0']]

This user has, next to the Adam, a Lisa and four Toms. The Lisa and 1 Tom are in the living room, I think.

I've started to work on the custom_component files: ___init___.py, climate,py, etc. It might be that I'll change the format when that is more convenient for the code inside these python files.

CoMPaTech commented 4 years ago

Added review in the code repo issues. With regard to multiple devices (i.e. two Toms and a Lisa) in the living we might need to figure if we change the proposed dict to just have a room name and all thermostat devices under that (also see review issue).

bouwew commented 4 years ago

@CoMPaTech My working assumption based on the information that I have (from the XML-data I received, and the descriptions and manuals on the Plugwise website), is that the Lisa is the master of the Tom's in the configured zone. The Tom's are the slave devices and follow the setpoints received from the master. I have assumed for now that I can ignore the data from the slave devices and only provide HA with data from the master devices (the Lisa for the Living Room and the Tom's in the Bedrooms and the Bathroom). In the future we could consider adding this data, if there is a need for it.

bouwew commented 4 years ago

@XMaarten can I contact you in another way then from here? Via Discord or some other platform?

XMaarten commented 4 years ago

Sure. I have Skype, e-mail, telegram and such, but not discord. I tried sending you (or someone with the same name) a message on Skype.

bouwew commented 4 years ago

Adam support is here!

With some help from https://hashop.nl I have been able to develop a Home Assistant custom_component for the Plugwise Adam HA.

Please go here for the files and configuration-info: https://github.com/bouwew/adam

Any questions? Please post in this topic.

riemers commented 4 years ago

A lot of testing and patience from bouwe. But it is good to see such progress. I will think a lot of people will benefit of this one in the future.

CoMPaTech commented 4 years ago

@riemers in terms of good news, I've made a working proof of concept on having climate + sensor and once this dust settles we should be able to make some traction on that as well making the other request (+ denies from HA on bouwew's previous PR) play along nicely :)