dennis1804 / homewizard-climate-hass

13 stars 7 forks source link

Princess Smart tower fan #1

Closed railrene closed 1 year ago

railrene commented 1 year ago

Hi!

I've two of these fans:

https://www.princesshome.eu/en-gb/princess-01-350000-02-001-smart-tower-fan-01.350000.02.001

and they are controlled by the Homewizzard Climate app. (fan on/off, speed 1-2-3, rotate on-off, mode normal-natural-sleep). I successfully installed this through HACS on a raspberry (HASS OS).

What can I do to help extend his integration so it sees the fans?

dennis1804 commented 1 year ago

Hi! first we need to know your device name So i helped someone else as well with this, please check out their comment here: https://community.home-assistant.io/t/homewizard-climate-local-mqtt-control/280480/67 and let me know if anything is unclear.

also a copy of the mail i sent with the same instructions:


I added a small script which you can check-out, if you clone / download this repo&branch: https://github.com/dennis1804/homewizard-climate-websocket/tree/feature/debug-devices

in it is a debug.sh command which can log the devices that exist on your homewizard climate account. you only need to edit the email and password which will be set in the debug.sh file. requirements for the script is that you have python3 and pip3 running on your system.

please let me know if you encounter any errors, if so, please provide the operating system as well, so i can debug it on that kind of device :)

railrene commented 1 year ago

Hi Dennis: I tried. As said, running HA OS so I dont have input on which packages/versions. I know how to ssh to the prompt (putty) and run a command or two but my knowledge here is very limited. I editted debug.sh with the (absotely correct, double tested) correct user/pass. Running it give this, I dont know where to look next.

climatetest.txt

dennis1804 commented 1 year ago

Hey @railrene, shoot, i forgot to update that branch to the latest version. which had an issue with the authentication. please pull the latest changes and try it again, you should get something like this in the terminal:

Received message: {"type":"infraredheater","device":"infraredheater/****","state":{"power_on":false,"target_temperature":24,"current_temperature":20,"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":null,"ext_target_temperature":null},"name":"Infrared Heater","online":true,"version":"1.00","model":"1.6,HWC-INFH","hardware_version":"1.00","wifi_ssid":"****","wifi_strength":100}
railrene commented 1 year ago

Hey Dennis.... it seems a 'fan' is found but it comes with errors: climatetest2.txt

dennis1804 commented 1 year ago

Great, so i added the fan to this project, could you attempt to install this HACS integration and see if it finds the fan?

railrene commented 1 year ago

Hi Dennis! It doesn't just find the fan, it finds BOTH fans! On ('cool') and Off works. Also I see this in the log:

2023-02-12 15:15:38.389 ERROR (Thread-4 (connect)) [websocket] error from callback <bound method HomeWizardClimateWebSocket._on_message of <homewizard_climate_ws.ws.hw_websocket.HomeWizardClimateWebSocket object at 0x7fa2298eb0>>: 'current_temperature' 2023-02-12 15:15:38.392 ERROR (Thread-5 (connect)) [websocket] error from callback <bound method HomeWizardClimateWebSocket._on_message of <homewizard_climate_ws.ws.hw_websocket.HomeWizardClimateWebSocket object at 0x7fa3008610>>: 'current_temperature'

which is as expected, these fans have no temp-sensor or -control.

dennis1804 commented 1 year ago

ah yes of course, would you mind running that debug command again with the latest change, it should detect your fan now and show the states we can change in the api.

railrene commented 1 year ago

Yes; this is the response: Received message: {"type":"fan","device":"FANxxxxxxxxxx82","state":{"power_on":false,"oscillation":false,"timer":0,"mode":"normal","speed":3},"name":"Fan 1","online":true}

and

Received full device update: {'type': 'fan', 'device': 'FANxxxxxxxxxx82', 'state': {'power_on': False, 'oscillation': False, 'timer': 0, 'mode': 'normal', 'speed': 3}, 'name': 'Fan 1', 'online': True}

railrene commented 1 year ago

Other values: Speed is 1,2,3 Timer is number in minutes (in app max 8 hours, 'timer': 480) Modes: 'normal', 'sleep', 'natural'

dennis1804 commented 1 year ago

hi @railrene, could you check out this branch and run the debug script, just like the others. i think i added the 3 values but can't validate 2 of them (speed and mode) because my device doesn't have them, i only have an IR panel

it should switch the speed to 1 and then to 3, and the mode from normal to natural

https://github.com/dennis1804/homewizard-climate-websocket/tree/feature/fan-support

railrene commented 1 year ago

hi @railrene, could you check out this branch and run the debug script, just like the others. i think i added the 3 values but can't validate 2 of them (speed and mode) because my device doesn't have them, i only have an IR panel

Hi Dennis! Yes,it does. Sets both speed and mode (and timer at 3 hrs also). See log attached. Great, thanks!

(BTW: had to rename the homewizard_climate_ws dir to homewizard_climate_websocket) climatetest4.txt

dennis1804 commented 1 year ago

https://github.com/dennis1804/homewizard-climate-hass/pull/2 should add the fan to the interface with support for preset modes and fan speeds. i could'nt find a good api for the timer so that has to be a seperate fix. If you want, please check out the branch and try to run it.

railrene commented 1 year ago

Hi Dennis! Thanks again... almost there:

Setting oscilation onf/off in the app results in this in the log:

2023-02-18 15:57:05.676 ERROR (Thread-113 (connect)) [websocket] error from callback <bound method HomeWizardClimateWebSocket._on_message of <homewizard_climate_ws.ws.hw_websocket.HomeWizardClimateWebSocket object at 0x7f7b71a320>>: HomeWizardClimateDeviceState.init() got an unexpected keyword argument 'oscillation'

Setting preset to eco gives a lot of erros, but DOES set it to 'natural':

2023-02-18 15:57:05.676 ERROR (Thread-113 (connect)) [websocket] error from callback <bound method HomeWizardClimateWebSocket._on_message of <homewizard_climate_ws.ws.hw_websocket.HomeWizardClimateWebSocket object at 0x7f7b71a320>>: HomeWizardClimateDeviceState.init() got an unexpected keyword argument 'oscillation' 2023-02-18 15:59:21.140 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547384900864] Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 200, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1787, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1824, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service await service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 680, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 968, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 720, in _handle_entity_call await result File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 513, in async_set_preset_mode await self.hass.async_add_executor_job(self.set_preset_mode, preset_mode) File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/homewizard_climate/climate.py", line 286, in set_preset_mode raise NotImplementedError() NotImplementedErro

Do you need more logs/tests?

René

railrene commented 1 year ago

BTW: Since personally I only use on/off and speed option myself anyway I'm perfectly happy already. Thanks.

dennis1804 commented 1 year ago

Thanks for the testing, i'll look at the issues you found. Naming wise it's a bit different to the endpoints homeassistant has so that's why they are named different then homewizard