dennis1804 / homewizard-climate-hass

13 stars 7 forks source link

Home Wizard Air Conditioner #8

Closed matteusz88 closed 1 year ago

matteusz88 commented 1 year ago

Trying to add Air Con unit but get the following from the logs. Is it possible to add this device?

This error originated from a custom integration.

Logger: homeassistant.config_entries Source: custom_components/homewizard_climate/init.py:37 Integration: Homewizard Climate First occurred: 16:42:04 (1 occurrences) Last logged: 16:42:04

Error setting up entry XXXX for homewizard_climate Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 383, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/homewizard_climate/init.py", line 37, in async_setup_entry devices: list[HomeWizardClimateDevice] = await hass.async_add_executor_job( File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.10/site-packages/homewizard_climate_ws/api/api.py", line 70, in get_devices devices_list = list( File "/usr/local/lib/python3.10/site-packages/dataclasses_json/api.py", line 72, in from_dict return _decode_dataclass(cls, kvs, infer_missing) File "/usr/local/lib/python3.10/site-packages/dataclasses_json/core.py", line 201, in _decode_dataclass init_kwargs[field.name] = _decode_generic(field_type, File "/usr/local/lib/python3.10/site-packages/dataclasses_json/core.py", line 275, in _decode_generic res = _decode_generic(type_arg, value, infer_missing) File "/usr/local/lib/python3.10/site-packages/dataclasses_json/core.py", line 247, in _decodegeneric res = type(value) File "/usr/local/lib/python3.10/enum.py", line 385, in call return cls.new(cls, value) File "/usr/local/lib/python3.10/enum.py", line 710, in new raise ve_exc ValueError: 'airconditioner' is not a valid HomeWizardClimateDeviceType

dennis1804 commented 1 year ago

Hi, i added it the the homewizard climate websocket repo. like the other Issues, could you check that one out and run the debug script? more info here: https://github.com/dennis1804/homewizard-climate-hass/issues/7#issuecomment-1550907527

matteusz88 commented 1 year ago

Thanks for coming back to me so quickly.

I'm getting the following error when trying to run the debug script within Terminal on Mac

sh /Users/xxx/Downloads/homewizard-climate-websocket-forked/debug.sh
Defaulting to user installation because normal site-packages is not writeable
ERROR: Directory '.' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.
/Library/Developer/CommandLineTools/usr/bin/python3: can't open file '/Users/xxx/homewizard_climate_ws/debug.py': [Errno 2] No such file or directory

Definitely not confident in terminal, but would appreciate it if you could help! Thanks

dennis1804 commented 1 year ago

Seems like it's looking in the wrong folder. If you use cd, which is a "change directory" command, you can go the the correct folder first, so in your case: cd Downloads/homewizard-climate-websocket-forked And then sh ./debug.sh

Let me know if that worked :)

matteusz88 commented 1 year ago

Hi Dennis,

Seemed to have worked, thanks so much! Output below; Defaulting to user installation because normal site-packages is not writeable Processing /Users/mattwhitby/Downloads/homewizard-climate-websocket-forked Preparing metadata (setup.py) ... done Requirement already satisfied: dataclasses-json>=0.5.7 in /Users/mattwhitby/Library/Python/3.9/lib/python/site-packages (from homewizard-climate-ws==0.0.21) (0.5.7) Requirement already satisfied: requests>=2.28.0 in /Users/mattwhitby/Library/Python/3.9/lib/python/site-packages (from homewizard-climate-ws==0.0.21) (2.31.0) Requirement already satisfied: websocket-client>=1.1.0 in /Users/mattwhitby/Library/Python/3.9/lib/python/site-packages (from homewizard-climate-ws==0.0.21) (1.5.3) Requirement already satisfied: marshmallow<4.0.0,>=3.3.0 in /Users/mattwhitby/Library/Python/3.9/lib/python/site-packages (from dataclasses-json>=0.5.7->homewizard-climate-ws==0.0.21) (3.19.0) Requirement already satisfied: marshmallow-enum<2.0.0,>=1.5.1 in /Users/mattwhitby/Library/Python/3.9/lib/python/site-packages (from dataclasses-json>=0.5.7->homewizard-climate-ws==0.0.21) (1.5.1) Requirement already satisfied: typing-inspect>=0.4.0 in /Users/mattwhitby/Library/Python/3.9/lib/python/site-packages (from dataclasses-json>=0.5.7->homewizard-climate-ws==0.0.21) (0.9.0) Requirement already satisfied: charset-normalizer<4,>=2 in /Users/mattwhitby/Library/Python/3.9/lib/python/site-packages (from requests>=2.28.0->homewizard-climate-ws==0.0.21) (3.1.0) Requirement already satisfied: idna<4,>=2.5 in /Users/mattwhitby/Library/Python/3.9/lib/python/site-packages (from requests>=2.28.0->homewizard-climate-ws==0.0.21) (3.4) Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/mattwhitby/Library/Python/3.9/lib/python/site-packages (from requests>=2.28.0->homewizard-climate-ws==0.0.21) (2.0.3) Requirement already satisfied: certifi>=2017.4.17 in /Users/mattwhitby/Library/Python/3.9/lib/python/site-packages (from requests>=2.28.0->homewizard-climate-ws==0.0.21) (2023.5.7) Requirement already satisfied: packaging>=17.0 in /Users/mattwhitby/Library/Python/3.9/lib/python/site-packages (from marshmallow<4.0.0,>=3.3.0->dataclasses-json>=0.5.7->homewizard-climate-ws==0.0.21) (23.1) Requirement already satisfied: mypy-extensions>=0.3.0 in /Users/mattwhitby/Library/Python/3.9/lib/python/site-packages (from typing-inspect>=0.4.0->dataclasses-json>=0.5.7->homewizard-climate-ws==0.0.21) (1.0.0) Requirement already satisfied: typing-extensions>=3.7.4 in /Users/mattwhitby/Library/Python/3.9/lib/python/site-packages (from typing-inspect>=0.4.0->dataclasses-json>=0.5.7->homewizard-climate-ws==0.0.21) (4.6.3) Building wheels for collected packages: homewizard-climate-ws Building wheel for homewizard-climate-ws (setup.py) ... done Created wheel for homewizard-climate-ws: filename=homewizard_climate_ws-0.0.21-py2.py3-none-any.whl size=12055 sha256=4c1c44f10b766919ede44d876613852a909676bb3218bf9ec0bd76ea27d671bb Stored in directory: /Users/mattwhitby/Library/Caches/pip/wheels/03/34/62/2b68e807a950ca26daf7378237c360ab1aa9451f57cf93d180 Successfully built homewizard-climate-ws Installing collected packages: homewizard-climate-ws Attempting uninstall: homewizard-climate-ws Found existing installation: homewizard-climate-ws 0.0.21 Uninstalling homewizard-climate-ws-0.0.21: Successfully uninstalled homewizard-climate-ws-0.0.21 Successfully installed homewizard-climate-ws-0.0.21 /Users/mattwhitby/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py:34: NotOpenSSLWarning: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020 warnings.warn( DEBUG:homewizard_climate_ws.api.api:Logging in to https://api.homewizardeasyonline.com/v1/auth/login with username mattwhitby@me.com DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.homewizardeasyonline.com:443 DEBUG:urllib3.connectionpool:https://api.homewizardeasyonline.com:443 "GET /v1/auth/login HTTP/1.1" 200 695 DEBUG:homewizard_climate_ws.api.api:Login (mattwhitby@me.com) status code: 200 DEBUG:homewizard_climate_ws.api.api:Login successful with token for username mattwhitby@me.com DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.homewizardeasyonline.com:443 DEBUG:urllib3.connectionpool:https://api.homewizardeasyonline.com:443 "GET /v1/auth/devices HTTP/1.1" 200 312 DEBUG:homewizard_climate_ws.api.api:Received 1 device(s) for user (mattwhitby@me.com), filtering the supported ones. supported_device_types: ['heaterfan', 'infraredheater', 'heater', 'fan', 'dehumidifier', 'airconditioner'] DEBUG:homewizard_climate_ws.api.api:Creating 1 device(s) for user (mattwhitby@me.com): ['airconditioner/3c39e7296b1e'] Airconditioner is an: airconditioner INFO:homewizard_climate_ws.ws.hw_websocket.airconditioner/3c39e7296b1e:Connecting to websocket (wss://app-ws.homewizard.com/ws) mattwhitby@Matts-MacBook-Air homewizard-climate-websocket-forked %

dennis1804 commented 1 year ago

hi @matteusz88, seems like i forgot to add a sleep in that code in order to get the full device update, I added it now, so could you re-download that project and retry the command?

it then should return a line that looks like this:

DEBUG:homewizard_climate_ws.ws.hw_websocket.infraredheater/XXXXXXX:Received full device update: {'type': 'infraredheater', 'device': 'infraredheater/XXXXXXX', 'state': {'power_on': False, 'target_temperature': 20, 'current_temperature': 22, 'temperature_unit': 'celsius', 'timer': 0, 'mute': False, 'error': [], 'timezone': 'Europe/Amsterdam CET-1CEST,M3.5.0,M10.5.0/3', 'clock_format': '24h', 'ext_mode': [], 'ext_current_temperature': None, 'ext_target_temperature': None}, 'name': 'Infrared Heater', 'online': True, 'version': '1.00', 'model': '1.6,HWC-INFH', 'hardware_version': '1.00', 'wifi_ssid': 'XXXXXX', 'wifi_strength': 100}

thanks,

matteusz88 commented 1 year ago

Thanks!

Output pasted below;

DEBUG:homewizard_climate_ws.api.api:Logging in to https://api.homewizardeasyonline.com/v1/auth/login with username mattwhitby@me.com DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.homewizardeasyonline.com:443 DEBUG:urllib3.connectionpool:https://api.homewizardeasyonline.com:443 "GET /v1/auth/login HTTP/1.1" 200 695 DEBUG:homewizard_climate_ws.api.api:Login (mattwhitby@me.com) status code: 200 DEBUG:homewizard_climate_ws.api.api:Login successful with token for username mattwhitby@me.com DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.homewizardeasyonline.com:443 DEBUG:urllib3.connectionpool:https://api.homewizardeasyonline.com:443 "GET /v1/auth/devices HTTP/1.1" 200 312 DEBUG:homewizard_climate_ws.api.api:Received 1 device(s) for user (mattwhitby@me.com), filtering the supported ones. supported_device_types: ['heaterfan', 'infraredheater', 'heater', 'fan', 'dehumidifier', 'airconditioner'] DEBUG:homewizard_climate_ws.api.api:Creating 1 device(s) for user (mattwhitby@me.com): ['airconditioner/3c39e7296b1e'] Airconditioner is an: airconditioner INFO:homewizard_climate_ws.ws.hw_websocket.airconditioner/3c39e7296b1e:Connecting to websocket (wss://app-ws.homewizard.com/ws) INFO:websocket:Websocket connected DEBUG:homewizard_climate_ws.ws.hw_websocket.airconditioner/3c39e7296b1e:Websocket opened DEBUG:homewizard_climate_ws.ws.hw_websocket.airconditioner/3c39e7296b1e:Sending message for command _hello: {"message_id": "hello", "token": "eyJhbGciOi...KzQoSVXISA", "type": "hello", "source": "https://github.com/mepla/homewizard-climate-websocket", "compatibility": 4} DEBUG:homewizard_climate_ws.ws.hw_websocket.airconditioner/3c39e7296b1e:Received message: {"type":"response","message_id":"hello","status":200} DEBUG:homewizard_climate_ws.ws.hw_websocket.airconditioner/3c39e7296b1e:Received response update: {'type': 'response', 'message_id': 'hello', 'status': 200} DEBUG:homewizard_climate_ws.ws.hw_websocket.airconditioner/3c39e7296b1e:Auto responding tohelloresponse withsubscribe DEBUG:homewizard_climate_ws.ws.hw_websocket.airconditioner/3c39e7296b1e:Sending message for command _handle_response_update: {"type": "subscribe_device", "device": "airconditioner/3c39e7296b1e", "message_id": "subscribe"} DEBUG:homewizard_climate_ws.ws.hw_websocket.airconditioner/3c39e7296b1e:Received message: {"type":"response","message_id":"subscribe","status":200,"details":"Tracking ID: 26960237708610144"} DEBUG:homewizard_climate_ws.ws.hw_websocket.airconditioner/3c39e7296b1e:Received response update: {'type': 'response', 'message_id': 'subscribe', 'status': 200, 'details': 'Tracking ID: 26960237708610144'} DEBUG:homewizard_climate_ws.ws.hw_websocket.airconditioner/3c39e7296b1e:Received message: {"type":"airconditioner","device":"airconditioner/3c39e7296b1e","state":{"power_on":true,"mode":"cool","current_temperature":21,"target_temperature":16,"fan_speed":"high","oscillate":null,"timer":0,"error":[],"sleep":false,"silent":false,"ext_mode":[],"ext_current_temperature":null,"ext_target_temperature":null},"name":"Airconditioner","online":true,"version":"2.00","model":"1.0,PS-A007","hardware_version":"1.00","wifi_ssid":"EE-Hub-S96q","wifi_strength":76} DEBUG:homewizard_climate_ws.ws.hw_websocket.airconditioner/3c39e7296b1e:Socket initialized. DEBUG:homewizard_climate_ws.ws.hw_websocket.airconditioner/3c39e7296b1e:Received full device update: {'type': 'airconditioner', 'device': 'airconditioner/3c39e7296b1e', 'state': {'power_on': True, 'mode': 'cool', 'current_temperature': 21, 'target_temperature': 16, 'fan_speed': 'high', 'oscillate': None, 'timer': 0, 'error': [], 'sleep': False, 'silent': False, 'ext_mode': [], 'ext_current_temperature': None, 'ext_target_temperature': None}, 'name': 'Airconditioner', 'online': True, 'version': '2.00', 'model': '1.0,PS-A007', 'hardware_version': '1.00', 'wifi_ssid': 'EE-Hub-S96q', 'wifi_strength': 76} /Users/mattwhitby/Library/Python/3.9/lib/python/site-packages/dataclasses_json/core.py:171: RuntimeWarning:NoneTypeobject value of non-optional type oscillate detected when decoding HomeWizardClimateDeviceState. warnings.warn(f"NoneTypeobject {warning}.", RuntimeWarning) /Users/mattwhitby/Library/Python/3.9/lib/python/site-packages/dataclasses_json/core.py:171: RuntimeWarning:NoneTypeobject value of non-optional type ext_current_temperature detected when decoding HomeWizardClimateDeviceState. warnings.warn(f"NoneTypeobject {warning}.", RuntimeWarning) /Users/mattwhitby/Library/Python/3.9/lib/python/site-packages/dataclasses_json/core.py:171: RuntimeWarning:NoneTypeobject value of non-optional type ext_target_temperature detected when decoding HomeWizardClimateDeviceState. warnings.warn(f"NoneTypeobject {warning}.", RuntimeWarning) DEBUG:homewizard_climate_ws.ws.hw_websocket.airconditioner/3c39e7296b1e:Received state update, diff: power_on: False -> True, mode: normal -> cool, current_temperature: 0 -> 21, target_temperature: 0 -> 16, fan_speed: 0 -> high, oscillate: False -> None, ext_current_temperature: 0 -> None, ext_target_temperature: 0 -> None, DEBUG:homewizard_climate_ws.ws.hw_websocket.airconditioner/3c39e7296b1e:Socket closed. Code: None, message: None DEBUG:homewizard_climate_ws.ws.hw_websocket.airconditioner/3c39e7296b1e:Disconnect was explicitly requested, not attempting to reconnect mattwhitby@Matts-MacBook-Air homewizard-climate-websocket-forked-2 %

matteusz88 commented 1 year ago

Don't suppose you've had any luck with this?

dennis1804 commented 1 year ago

please check #13, and the PR: #14 it should add some airco functionality