philippelt / netatmo-api-python

Netatmo connect API python client (for Netatmo information, see https://dev.netatmo.com)
GNU General Public License v3.0
191 stars 120 forks source link

Compatibility with netatmo termostat device #19

Closed gieljnssns closed 5 years ago

gieljnssns commented 6 years ago

Hi,

Do you have plan on support termostat device ? I notice it is not available yet.

I can give u acces to mine

thank you.

philippelt commented 6 years ago

Hello Giel,

I do not have access to a thermostat and I must admit that the associated API structure do not give me a lot of desire to dig in it (as usual with Netatmo: overkill and prone to repeated breaking changes ๐Ÿ˜„, I am kidding... or am I ?)

But if you could write a minimal set of specifications (features/functions you need) and give me temporary access to a device, I could check if it is reasonably fast to write...

Yours truly

gieljnssns commented 6 years ago

read out the setpoint, current temperature, thermostat mode, battery status setthermpoint, switch schedule do I have to give your ****@wanadoo.fr mailadress acces to mine thermostat?

philippelt commented 6 years ago

Yes, this is my netatmo account. I just need "read" scope, I will ask you to do yourself any "write" test just to be sure to avoid any trouble. Phil

gieljnssns commented 6 years ago

Invitation sendโ€ฆ

philippelt commented 6 years ago

Hello,

could you try the basic support I just add to the library. I created an example to start from in sample/printThermostat For the full data structure, refer to the Netatmo documentation

Thanks for providing access to your thermostat

Phil

philippelt commented 6 years ago

I just start to understand the terminology used. What is named "module" in the API should be understood as thermostat and what is called "station" is in fact the relay for wifi transmission... Once again, I will have to dig to try to understand the behavior and provide a simpler interface.

I will update the library to better reflect the actual system design.

gieljnssns commented 6 years ago

I wil try this this weekend, I have a lot to do for my job. But if you can try al of that, no problem, just do it. I wil keep an eye on my thermostat, that it goโ€™s back to auto.

Thanks in advantage,

Giel

Op 7 feb. 2018, om 11:18 heeft Philippe Larduinat notifications@github.com het volgende geschreven:

I just start to understand the terminology used. What is named "module" in the API should be understood as thermostat and what is called "station" is in fact the relay for wifi transmission...

I will update the library to better reflect the actual system design.

โ€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/philippelt/netatmo-api-python/issues/19#issuecomment-363722555, or mute the thread https://github.com/notifications/unsubscribe-auth/AQb8BxkLYTjicXdTGh6KOuKcZdT8ZMPEks5tSXiTgaJpZM4R5Nq3.

gieljnssns commented 6 years ago

I've installed on my pi with pip3. I've hardcoded my creds in the lnetatmo.py file. When I do pi@raspberrypi:/usr/local/lib/python3.4/dist-packages $ python3 lnetatmo.py I get

lnetatmo.py : warning, no weather station available for testing
lnetatmo.py : OK
philippelt commented 6 years ago

I didn't upload the interim version to pypi. To use the last library version, download it directly from github. This is a single file library, you just need letatmo.py. I will update the pypi package when the release will be stabilized.

The warning just means that library testing is not possible for weather station features as you don't have any one attached to your account. If you don't own a weather station this is a normal behavior

gieljnssns commented 6 years ago

What do I have to test now?

gieljnssns commented 6 years ago
>>> import sys
>>> import lnetatmo
>>> authorization = lnetatmo.ClientAuth()
>>> thermostat = lnetatmo.ThermostatData(authorization)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'ThermostatData'
>>>
tibuski commented 6 years ago

Hello,

Sorry to hijack this thread but I would like to offer my help too if you need some.

I am interested in having the possibility to use setpoint_endtime but have no knowledge in programmation :) (actually to end manual temperature and go back to normal mode, I set away on/off as a workaround)

https://dev.netatmo.com/resources/technical/reference/thermostat/setthermpoint

If you need testers for netatmo producut I have access to the Netatmo Thermostat, 5 connected Vannes (no API yet I think) and two Presence Camera's.

As last word, thank you for all the work you already done ! :)

Tibuski

philippelt commented 6 years ago

@gieljnssns : You must download lnetatmo.py from the repo to test (the pypi version do not include the thermostat support yet). As a start point, you should be able to run samples/printThermostat to view your datas

@tibuski thanks for your proposal to help. The biggest issue with netatmo products is to define actual life use case to build an API binding that is friendly and easy to use. If you could add details to gieljnssns requirements, it would help to reach the target :) Of course, feel free to download the work in progress version from github and test it with your thermostat...

Have fun !

tibuski commented 6 years ago

Avec plaisir :)

Github is new for me but I will check the best way to connect and test your code.

As Giel told, in an ideal worId, I would need to :

See you soon :)

Laurent

gieljnssns commented 6 years ago
pi@raspberrypi:~/netatmo-api-python $ python3
Python 3.4.2 (default, Oct 19 2014, 13:31:11)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> import lnetatmo
>>> authorization = lnetatmo.ClientAuth()
>>> thermostat = lnetatmo.ThermostatData(authorization)
>>> defaultThermostat = thermostat.getThermostat()
>>> if not defaultThermostat : sys.exit(1)
... defaultModule = thermostat.defaultModule
  File "<stdin>", line 2
    defaultModule = thermostat.defaultModule
                ^
SyntaxError: invalid syntax
>>> defaultModule = thermostat.defaultModule
>>> print('Thermostat name      :', defaultThermostat['name'])
Thermostat name      : Thuis
>>> print('Default module       :', defaultModule['name'])
Default module       : Living
>>> print('Module measured temp :', defaultModule['measured']['temperature'])
Module measured temp : 18.5
>>> print('Module set point     :', defaultModule['measured']['setpoint_temp'])
Module set point     : 17.5
>>> print('Module battery       : %s%%' % defaultModule['battery_percent'])
Module battery       : 49%
>>> for p in defaultModule['therm_program_list']:
...     print("\tProgram: ", p['name'])
...     for z in p['zones']:
...         name = z['name'] if 'name' in z else '<noname>'
...         print("\t%15s : %s" % (name, z['temp']))
...
    Program:  Week
            Comfort : 20
              Nacht : 17
                Eco : 17.5
           Tussenin : 18.5
            Ochtend : 19
           <noname> : 14
           <noname> : 7
    Program:  Test
            Comfort : 18
              Nacht : 16
                Eco : 14
           <noname> : 14
           <noname> : 7
>>>
gieljnssns commented 6 years ago

<noname> : 14 is away zone (type 2) <noname> : 7 is frost-guardzone (type 3)

tibuski commented 6 years ago

To be sure I don't break anything. Do I need to download the full project and run the setup or only replace the old lnetatmo.py file already present ?

philippelt commented 6 years ago

@gieljnssns, you don't need to type the script in interpretor by hand, just run it with $ python3 samples/printThermostat (you can download it separately). I don't know why some zone do not have name (or is it just that you didn't set name for the moment) ?

@lbrichet, for the moment, and until a full thermostat release is published, I recommend to just download required files (lnetatmo.py and the sample program printThermostat) in a separate directory and run them locally in this directory (import will always use a local file over a system wide installed one).

gieljnssns commented 6 years ago

When I do pi@raspberrypi:~/netatmo-api-python $ python3 samples/printThermostat I get this error

Traceback (most recent call last):
  File "samples/printThermostat", line 9, in <module>
    import lnetatmo
ImportError: No module named 'lnetatmo'

Apparently those 2 are special modi

schermafbeelding 2018-02-09 om 12 08 11
tibuski commented 6 years ago

Here is what I get : image

Noname 15 is probably the Away temperature and Noname 7 the No Frost one

philippelt commented 6 years ago

@gieljnssns For testing, the lnetatmo.py file and the printThermostat file must be located in the same directory.

Thanks for the info about the special modes, I am going to dig about them

philippelt commented 6 years ago

@lbrichet : I just started to dig in the API structure and I will change the code to reflect the actual equipments (relay, thermostat, ...) @gieljnssns already told me about the special nature of these modes, I will investigate as soon as I will have some time available...

Thanks to you all for your contributions ๐Ÿ‘

tibuski commented 6 years ago

You are welcome, thank you for your work !

Just ask if you need anything tested !

gieljnssns commented 6 years ago

I do not have access to a thermostat and I must admit that the associated API structure do not give me a lot of desire to dig in it (as usual with Netatmo: overkill and prone to repeated breaking changes ๐Ÿ˜„, I am kidding... or am I ?)

You were right, there is a breaking change in the energy api: https://dev.netatmo.com/resources/technical/reference/energy

philippelt commented 6 years ago

Many thanks for the info and sorry for the loooooong delay.

My "bread & butter" activity suddenly pops up with serious workload that I didn't yet finish to deliver but I may soon find some time to restart the thermostat implementation with a better features support coverage and cleaner implementation...

See you soon and thanks to all for your help.

Philippe