persandstrom / python-verisure

A python module for reading and changing status of verisure devices through verisure app api.
MIT License
137 stars 42 forks source link

HeatPumps #81

Closed jamiewalters closed 1 year ago

jamiewalters commented 6 years ago

I am interested in adding support for HeatPumps (get status, change temperature, etc)

They show up in the /overview as:

"heatPumps": [ { "deviceLabel": "XXX XXX", }, "heatPumpModel": "PANASONIC", "heatPumpConfig": { "status": "RUNNING", "mode": "HEAT", "power": "ON", "targetTemperature": 21, "fanSpeed": "LOW", "airSwingDirection": { "vertical": "0_DEGREES" }, "feature": "QUIET", "changedTime": "2017-09-27T22:12:48.647Z" } } ],

However from there I haven't managed to work out the resource for fetching only the heatpump or to post updates to it.

This could be done with the regular "mypages" There you could send the payload as a post request. First choice however would be to keep it all on the same URL and session.

Any tips on going forward?

persandstrom commented 6 years ago

Hi, Is it possible to do this from the app?

jamiewalters commented 6 years ago

Exactly, you can control all the functions of the heatpump from the apps.

persandstrom commented 6 years ago

Then It should be doable. I don't have a heatpump myself so you have to add the functionality yourself.

I have installed https://www.charlesproxy.com on a computer used it as a reverse proxy for my cell phone. When ask certificate is exchanged it is possible to sniff the traffic from the app.

jamiewalters commented 6 years ago

I managed to added HeatPumps, tested at home, works as expected. However the interface for the HeatPump has a few more options. I opted for a single function that takes (property, state) with property freely being any given property of the HeatPump. Given that I would like to contribute this code, is there a preferred style?

persandstrom commented 6 years ago

Great! If you create a pull request I can take a look at it.

taugusti commented 6 years ago

Hi @persandstrom and @jamiewalters I am also hoping to find heat pump support... It seems like Jamie got i running - but it does not appear to be a part of the main line. Is there any plan to add it - or perhaps I could get a copy of the prototype to see if I can make it work?

jamiewalters commented 6 years ago

Hi @taugusti I got it running at home but I have been quite busy to merge it with the latest code and push it back. I am more than happy to share this, maybe you can add some input to make it more useable before merging.

-Jamie

taugusti commented 6 years ago

Great - how do I get access to it? can you mail it (or link to it): thomas at augustinus dot dk? Btw. I got the existing version up and running and now have the staus of the heatpump in my Home Assistant setup. But adding "change settings" would be great. It is a great module @persandstrom.

jamiewalters commented 5 years ago

https://github.com/jamiewalters/python-verisure

taugusti commented 5 years ago

Fantastic - I will try it out right away- thanks @jamiewalters !

jamiewalters commented 5 years ago

Let me know how it works, I have only tested it with my pump. Sorry I took to long to get back, had to put this aside while I was renovating.

jamiewalters commented 5 years ago

I am working on a HASS climate component to go with this, let me know if you are interested in testing it.

taugusti commented 5 years ago

Hi @jamiewalters, I have only had limited time to test - and I seem to recall that I could test by executing the scripts from the ssh console or on my pc... but I can't do that anymore because of a missing reference. I will look at it later. I made an extra python script to wrap the other one - that handles initiating the session, getting/setting and then closing the session. It is my first attempt at setting parameters with input_select. It seems that the script is not called when I change values. The same when I try to make the selector reflect the current state. I must be doing something totally wrong :-) Are you doing it the same way? or is there an easier way to go? Btw - since you are using hass - could you show me the scripts/config you use to present it ?

And yes - I would love to help test the climate component!

jamiewalters commented 5 years ago

I tested it using python3 on my pc, worked fine. The climate component, I just add to custom_components and it shows up in HASS under climate, it still a little rough on the edges, but it works and shows up in HomeKit, will upload a copy to github later this evening

taugusti commented 5 years ago

Hmm - I need to look into it again. Did you install any extra libraries? It would be great to see your config - thanks!

taugusti commented 5 years ago

Ok - stupid rookie mistake... I was missing the requests module on my pc. from ssh it seems not to be available for some reason. "pip install requests" saved my day :-)

Looking forward to the custom component - I have not yet looked in that direction...

jamiewalters commented 5 years ago

try this:

https://github.com/jamiewalters/python-verisure-climate

still very rough, first hass component, will keep improving it in the coming days. since hass defaults to v 1.3.7 of vsure I add it beside the component and reference it locally.

follox commented 5 years ago

Hi @jamiewalters Thanks a lot for this. I was posting a feature request on the forum to ask if someone could update the Home Assistant component. Will check this out tonight :)

jamiewalters commented 5 years ago

Let me know how it works, I am only aware of it being tested on two HeatPumps, I am not certain all the options are the same for every pump but let me know, so it can up updated.

follox commented 5 years ago

@jamiewalters It works like a sharm! Thanks a lot. But it is only showing one of two pumps. Anything I can do to fix that? Is it also possible to get powerconsumption?

jamiewalters commented 5 years ago

Let me look at the code again, never been tested in multiple pumps as I only have one :/ Can you open an issue at my repo?

follox commented 5 years ago

@jamiewalters Thanks for looking at it. As mention in the "issue" it is missing two settings on my heatpump, which is econavi and quiet mode. It is not that important tho. More important to get both the heatpumps into hass :)

follox commented 5 years ago

If any help it is this heatpump: Panasonic HZ9 RKE-1

jamiewalters commented 5 years ago

Try the latest commit - J

jamiewalters commented 5 years ago

The python lib supports setting these, just never figured out how to add them to home assistant.

follox commented 5 years ago

It works! Thanks a lot

follox commented 5 years ago

I hope someone can also integreate power consumption and also the two missing modes. You can also just adjust swing mode vertically but not horizontally.

jamiewalters commented 5 years ago

I did the support for adjusting swing mode, I didn't have any horizontal adjustments to test with so I couldn't add support for horizontal, maybe you can send me an example of your overview data from the python lib. I will look into the power consumption. The modes are in the python lib, I just dont know where they would fit into the climate component, Ill look into this.

follox commented 5 years ago

Hi again. Much appreciated. Where do you want me to send\upload the overview data for the python lib?

jamiewalters commented 5 years ago

Open an issue here: https://github.com/jamiewalters/python-verisure-climate and share the file, scrub all sensitive data, I only need to see what they heatPumps config looks like

follox commented 5 years ago

Alright, I will do that tonight. Can't access samba from work. You want the details in my verisureclimate.py file, right?

follox commented 5 years ago

I am not sure what file you want me to gather information from.

jamiewalters commented 5 years ago

No, I wanted to see what the output from your versure data is like, you would have to run python-versire lib and print it out.

follox commented 5 years ago

@jamiewalters I do not have any file with that name extension in the folder.

follox commented 5 years ago

@jamiewalters ?

jamiewalters commented 5 years ago

I am trying to get a copy of your output from Verisure when the module is running. You can get this by running, this lib here python-verisure and doing get_overview() this should return this data.

follox commented 5 years ago

I am sorry, but I am unable to write python. Will need some explanation about how I can proceed with this. What should I write in this python file in order to retrieve the data you asking for?

Maybe some text I can copy paste?

follox commented 5 years ago

@jamiewalters Sorry to bother you with this, but can you please give me a detailed text or a recipe on how to proceed? Thanks :)

turbokongen commented 5 years ago

@follox look at the readme of this project. The output of overview command line.

jamiewalters commented 5 years ago

Hi

Not an issue, I just don't find the time to answer so quickly. Check the readme as said above its a good way to begin, the method you need to call is "get_overview()"

persandstrom commented 5 years ago

@jamiewalters I have updated vsure in HA to version 1.5.0

jamiewalters commented 5 years ago

Excellent, I have a component for adding the heatpumps as a climate device, how could we get this in?

persandstrom commented 5 years ago

I think the best way is to read to docs on how to Submit your work to home assistant. When you have created a PR I can help out to review it.

follox commented 5 years ago

Hi @jamiewalters It seems like the verisure plugin for HomeAssistant has stopped after upgrading to the newest version. Can you check into this?

Integrations need to be in their own folder. Change climate/verisureclimate.py to verisureclimate/climate.py. This will stop working soon

If I move it to a new folder it does not work eiter...

jamiewalters commented 5 years ago

Will check this out

taugusti commented 5 years ago

@jamiewalters - any news on this? Anything I can do to help?

taugusti commented 5 years ago

I have added an issue in the repository here: https://github.com/jamiewalters/python-verisure-climate/issues/4

follox commented 5 years ago

@taugusti Thanks for looking into this as well. Is there any way to integrate the climate into the Verisure component? https://www.home-assistant.io/components/verisure/

The heatpump sensor is a part of Verisure, so I am a bit unsure why it is not included in the component.

taugusti commented 5 years ago

Hi @follox I fixed the issue and made a pull-request for @jamiewalters. When he has reviewed and approved it, you can get it from his repository.

If you want to get moving and help test it, you can get it here:

Regarding including it into the climate component... I guess we should give it a try... I assume there is a formal procedure for adding to home assistant... Maybe you could research it?

follox commented 5 years ago

@taugusti Well, I do not know anything about this. But I guess we can upload a hvac.yaml file here: https://github.com/home-assistant/home-assistant/tree/dev/homeassistant/components/verisure

This is the yaml files the Versiure component is using.