Closed victorcerutti closed 5 years ago
No problem, but my knowledge of python isn’t very good. This was the first thing i ever did. When you have ideas…
Great So far, it looks like the standard API is very good at retrieving history but is not efficient for real time datas. Using it with Home Assistant for automations is then an issue. Jut for the information, I'm working on an automation to detect when my boiler is not working as it happens about once in a month and I have to manually relaunch it.
I added sensors to detect if the boiler is on or off. It kind of work but it doesn't match the real data as there is a constant latency issue with it.
But, when I'm on the thermonstat web app : https://my.netatmo.com/app/therm the data is in exact real time. I think it's because it retrieves directly the thermostat for values
So I looked at the call for an undocumented API
curl 'https://my.netatmo.com/syncapi/v1/homestatus' -H 'Authorization: Bearer <AUTH_CODE>' -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"home_id":"<HOME_ID>","device_type":"NAPlug"}'
This returns all datas for my home, including real time temperature, target and boiler status
This looks like a good way to retrieve more accurate datas of the thermostat
What do you think about it ?
But, when I'm on the thermonstat web app : https://my.netatmo.com/app/therm https://my.netatmo.com/app/therm the data is in exact real time. I think it's because it retrieves directly the thermostat for values. I think this isn’t true https://forum.netatmo.com/viewtopic.php?f=5&t=900 https://forum.netatmo.com/viewtopic.php?f=5&t=8463
I think we have to use the (undocumented) API call ‘syncthermstate' https://forum.netatmo.com/viewtopic.php?f=5&t=9023&p=45822&hilit=syncthermstate#p45822
Op 24 nov. 2017, om 15:02 heeft Victor Cerutti notifications@github.com het volgende geschreven:
Great So far, it looks like the standard API is very good at retrieving history but is not efficient for real time datas. Using it with Home Assistant for automations is then an issue. Jut for the information, I'm working on an automation to detect when my boiler is not working as it happens about once in a month and I have to manually relaunch it.
I added sensors to detect if the boiler is on or off. It kind of work but it doesn't match the real data as there is a constant latency issue with it.
But, when I'm on the thermonstat web app : https://my.netatmo.com/app/therm https://my.netatmo.com/app/therm the data is in exact real time. I think it's because it retrieves directly the thermostat for values
So I looked at the call for an undocumented API curl 'https://my.netatmo.com/syncapi/v1/homestatus' -H 'Authorization: Bearer
' -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"home_id":" ","device_type":"NAPlug"}' This returns all datas for my home, including real time temperature, target and boiler status
This looks like a good way to retrieve more accurate datas of the thermostat
What do you think about it ?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gieljnssns/My-Hassio-config/issues/1#issuecomment-346835148, or mute the thread https://github.com/notifications/unsubscribe-auth/AQb8B2zb0VKkPMiYl-BSkHthsluzlHwVks5s5sxfgaJpZM4QpnSp.
oh, great ! That seems to be what we need to achieve more 'real time' of the boiler status I'm wondering if it drains the battery of the thermostat if we call it to frequently (like each 5 minutes)
Maybe we could implement this in the component before getting the data (maybe as an option ?)
Or else I could also create a fake sensor calling syncthermstate
each 5 minutes to achieve that
@victorcerutti
I think the best way to achieve al of this, is:
First find the current program something like this
def currentProgram(self, module=None, device=None, mid=None):
"""
Return the current program of a given device.
"""
program = None
if mid:
# print('mid')
module_data = self.moduleById(mid)
else:
# print('else')
module_data = self.moduleByName(device=device, module=module)
if module_data:
if module_data['therm_program_list']['selected']:
program = module_data['therm_program_list']['name']
return program
then the current zone and then the current setpoint I've pushed a branch https://github.com/gieljnssns/netatmo-api-python/blob/thermostat-expansion/smart_home/Thermostat.py but I don't find the time to finish this, and I am also still learning python with trail and error.
Maybe you can fix this?
Hello,
I would like to contact you to enhance the Netatmo thermostat component you developed for Home Assistant. It seems to be very unreliable for automations right now because of the slow refresh time of some attributes due to the way the API works. I have some ideas to fix it but I lack the python knowledge to implement and test it
Would you mind discussing it and work together on this subject ?
Thanks in advance
Victor