Closed thomas70 closed 4 years ago
I can see that you have used my dev-branch :-) The dev (supporting multiple zones) branch should work, please make sure you are using the climate.py and sensors.py from dev. Also, the documentation is not yet updated to support multiple zones.
I will focus on the master branch for now: You parameters file should contain the parameter "signature" passed in every call. The "signature" parameter is 90-96 characters and normally starts with 302C, 302D or 302E. That goes for all signatures (zone_signature, heat_signature and all temperatures). The URL is built on your account-id and zone-id (fetched over API). Try to update with the signatures instead for all fields and let me know the output. The privateKey is not used.
Probably the signatures that is wrong. I try again after work. I using all files from dev branch
Ok, great. If you still want to use dev branch, you also need to update the function-names (documentation is not done on this) So line 15: get_signature_123456 should be getsignature{your zone id} Line 59: 'elif zone == 168388:' should by elif zone == {your zone id}: Line 60: 'return get_signature_123456(value)' should by return getsignature{your zone id}(value)
To support multiple zones, add a new function getsignature{your second zone id} with all parameters. Also add a second elif pointing towards the new function
I think i have right signatures. I am now on master branch
"zone_signature": '30:2C:02:......" "heat_signature": '30:2C:02:......"
I tried to remove all the : but no change
Do you have the colons in the signature in mitm? My signatures does not have any colons, se picture attached Is your zone_signature fetched from api-call towards URL https://heater.azurewebsites.net/sheater-client-api/rest/zones/list/{account_id}
Yes i see colons in mitmproxy
Cool. And the URL's are correct? I'll try to reproduce this with an Android tablet later today, unfortunately I have no further ideas at the moment
I have not yet been able to retreive my Android traffic in the proxy. My assumption, however, is that the Android app also concatenate locale in the signature. Can you try to curl the below command to investigate? Replace signature and account id. Please also try the signature both with and without colons, and let me know if you get a valid json response. Thanks
curl -X POST -d "signature={YOUR_ZONE_SIGNATURE}&appVersion=android-adax-2.4.0&device=LENOVO\ Lenovo\ TB2-X30F&os=Android\ 6.0.1&timeOffset=-60&timeZone=Europe/Belgrade&locale=nb" https://heater.azurewebsites.net/sheater-client-api/rest/zones/list/{YOUR_ACCOUNT_ID}
I think i got one step further, but now i get this error:
2019-10-31 22:48:55 DEBUG (SyncWorker_14) [custom_components.adax_wifi.climate] Adding component: adax_climate ...
2019-10-31 22:48:55 ERROR (MainThread) [homeassistant.components.climate] Error while setting up platform adax_wifi Traceback (most recent call last): File "/home/thomas/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT) File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for return fut.result() File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/home/thomas/.homeassistant/custom_components/adax_wifi/climate.py", line 50, in setup_platform z_maxtemp = round(float(zone["upperTemperatureLimit"]) / 100, 2) KeyError: 'upperTemperatureLimit'
@thomas70 I have the exact same issue as you. Even using the exact same Android tablet. I also have the colons in mitmproxy and can't get the integration to work at the moment. I follow this thread closely, but unfortunately have no more success then you have. Please let us know if you make any progress. :)
Can any of you try to execute the curl command above? In the command I have added the locale parameter, which is not sent from iPhone. @IDmedia if you try to run it, please make sure to update with your parameters
i am not sure what fixed my problem. I started from scratch. I use colons in my signature and the curl command gives me this:
[ { "errorTypeId": 0 }, [ { "groupId": XXXX, "groupName": "Hjem", "id": XXXXX, "userIsOwner": true, "adaptiveStartEnabled": false, "away": false, "awayMode": 3, "awayTemperature": 1500, "awayFrom": null, "awayTill": null, "currentHeatingMode": 0, "currentTemperature": 1807, "heatersLocked": false, "heatingModeName": "Off", "heatingModeTill": null, "lastNotificationTime": null, "manualSchedule": false, "name": "Home", "openWindow": false, "openWindowDetectionEnabled": false, "outdatedTemperature": false, "scheduledHeatingMode": 0, "scheduleId": 28213, "scheduleName": "Off", "scheduleTargetTemperature": 0, "targetTemperature": 1700, "temperatureCalibration": 0, "temperatureEventsEnabled": false, "toHour": 23, "toMinute": 59, "toWeekDay": 7, "heatingMode": 0 } ] ]
Great, then it is adding locale to theparameters that solved it! I will update the repo later today, thanks for your help!
But i still get this in HA:
2019-11-01 08:29:21 ERROR (MainThread) [homeassistant.components.climate] Error while setting up platform adax_wifi Traceback (most recent call last): File "/home/thomas/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT) File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for return fut.result() File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/home/thomas/.homeassistant/custom_components/adax_wifi/climate.py", line 50, in setup_platform z_maxtemp = round(float(zone["upperTemperatureLimit"]) / 100, 2) KeyError: 'upperTemperatureLimit'
Yes, HA is not using the locale parameter, I Will have to update the repo first🙂
I have now updated the dev-branch, both when it comes to code and documentation. The dev-branch also support multiple zones, making it a little messy.
I have also added the parameter locale
Please try and let me know if it works.
Now HA wont start. The only thing i see in the log is this. If i disable adax_wifi it starts
2019-11-01 12:30:54 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for adax_wifi which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant. 2019-11-01 12:30:55 ERROR (MainThread) [homeassistant.core] Error doing job: Task was destroyed but it is pending! 2019-11-01 12:30:55 ERROR (SyncWorker_16) [concurrent.futures] exception calling callback for <Future at 0x7f4b6a8a7ac8 state=finished returned bool> Traceback (most recent call last): File "/usr/lib/python3.6/concurrent/futures/_base.py", line 324, in _invoke_callbacks callback(self) File "/usr/lib/python3.6/asyncio/futures.py", line 417, in _call_set_state dest_loop.call_soon_threadsafe(_set_state, destination, source) File "/usr/lib/python3.6/asyncio/base_events.py", line 637, in call_soon_threadsafe self._check_closed() File "/usr/lib/python3.6/asyncio/base_events.py", line 377, in _check_closed raise RuntimeError('Event loop is closed') RuntimeError: Event loop is closed
That is strange. When googling, it seems to be a python bug. What version are you on? It works on my 3.6.8
i also running 3.6.8
Another error message. Maybe more related:
2019-11-01 13:42:33 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall homeassistant.restart (c:f7b5d7f3aa9c4097bc016ac0b6ba0c8b)> Traceback (most recent call last): File "/home/thomas/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1244, in _safe_execute await self._execute_service(handler, service_call) File "/home/thomas/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1261, in _execute_service await handler.func(service_call) File "/home/thomas/homeassistant/lib/python3.6/site-packages/homeassistant/components/homeassistant/init.py", line 104, in async_handle_core_service errors = await conf_util.async_check_ha_config_file(hass) File "/home/thomas/homeassistant/lib/python3.6/site-packages/homeassistant/config.py", line 795, in async_check_ha_config_file res = await check_config.async_check_ha_config_file(hass) File "/home/thomas/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/check_config.py", line 156, in async_check_ha_config_file platform = p_integration.get_platform(domain) File "/home/thomas/homeassistant/lib/python3.6/site-packages/homeassistant/loader.py", line 232, in get_platform f"{self.pkg_path}.{platform_name}" File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "
", line 994, in _gcd_import File " ", line 971, in _find_and_load File " ", line 955, in _find_and_load_unlocked File " ", line 665, in _load_unlocked File " ", line 678, in exec_module File " ", line 219, in _call_with_frames_removed File "/home/thomas/.homeassistant/custom_components/adax_wifi/sensor.py", line 11, in from .parameters import set_param, get_static File "/home/thomas/.homeassistant/custom_components/adax_wifi/parameters.py", line 42 def set_param(zone, value): ^ IndentationError: expected an indented block
Line 42 in parameters.py
should contain the signature for 27 degrees. Did you change anything in the parameters file? Removed any temperatures?
If so, can you share your parameters file, except for your values?
Yes. I removed som temperatures. Is that wrong ?
My line 42 is: def set_param(zone, value):
No, removing temps should be fine, but the error message indicates that the previous line may be wrong or that there is a faulty space. Does is still look like
33: '',
34: '',
35: ''
}
return switcher.get(value,"Key missing")
def set_param(zone, value):
"""Section for iOS devices"""
if 'iOS' in get_static("os"):
Even if the temperatures may differ?
No. Sorry. It was some copy/paste errors :-(
Now i'm back to this:
2019-11-01 14:35:04 ERROR (MainThread) [homeassistant.components.climate] Error while setting up platform adax_wifi Traceback (most recent call last): File "/home/thomas/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT) File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for return fut.result() File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/home/thomas/.homeassistant/custom_components/adax_wifi/climate.py", line 50, in setup_platform z_maxtemp = round(float(zone["upperTemperatureLimit"]) / 100, 2) KeyError: 'upperTemperatureLimit'
That is good, that means that the API-call is actually executed. But I can see from your previous post that you actually miss max and min temperature in your response.
I have updated climate.py
in dev
branch to handle that.
Either download the updated file or set max-temp and min-temp in your Adax-app
Than you very much ! Now its working :-)
Great! Thank you for your patience, lots of learnings🙂
@thomas70 care to share your final configuration as an example (anonymize the data, but keep the format/length)? I'll test the dev branch tonight or tomorrow when I have access to the adax heaters again.
I can do that tomorrow
OFF Topic: Is there a attribute that tells me if the heater heats or not?
As Long as you have a target temperature in the thermostat or climate device it is heating. If you mean that the radiator currently consume power, then no. As far as I understand, it is not part of the API.
I ment consuming power. I have to make a sensor that if temperature > current_temperature then it using 900W. Not 100% accurate, but good enough for my use :-) Thanks anyway
@IDmedia here is my parameters file:
https://gist.github.com/thomas70/32044622d8197af695035e8f42c652a2
xxxx=account id yyyyy=zone
@thomas70, regarding power consumption. I cannot retrieve consumption in the API, don’t even think it is measured. Can you see your consumption in your mobile app?
No. I dont see any indication of heating, so its not possible i think :-(
Closing this. Working great for me
I think i have set it up correctly, but get these errors. This is the files from the dev branch
2019-10-30 08:26:13 DEBUG (SyncWorker_0) [custom_components.adax_wifi.climate] Adding component: adax_climate ... 2019-10-30 08:26:13 ERROR (MainThread) [homeassistant.components.climate] Error while setting up platform adax_wifi Traceback (most recent call last): File "/home/thomas/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT) File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for return fut.result() File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/home/thomas/.homeassistant/custom_components/adax_wifi/climate.py", line 43, in setup_platform for zone in devices_json[1]: KeyError: 1
2019-10-30 08:26:14 DEBUG (MainThread) [homeassistant.components.automation] Loaded automation automation.sla_av_lader_ved_hjemkomst with state True from state storage last state <state automation.sla_av_lader_ved_hjemkomst=on; friendly_name=Slå av lader ved hjemkomst, last_triggered=2019-10-29T15:50:14.811980+00:00 @ 2019-10-30T01:04:11.642192+01:00> 2019-10-30 08:26:15 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform adax_wifi Traceback (most recent call last): File "/home/thomas/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT) File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for return fut.result() File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/home/thomas/.homeassistant/custom_components/adax_wifi/sensor.py", line 35, in setup_platform for zone in zones_json[1]: KeyError: 1
Here is my parameters.py
https://gist.github.com/thomas70/38f15d9f744b1f41504d7b4c5877748c