asantaga / wiserHomeAssistantPlatform

Platform and related climate/sensors to support the Drayton Wiser Home Heating System
MIT License
238 stars 44 forks source link

Assign schedule #509

Open LGO44 opened 2 weeks ago

LGO44 commented 2 weeks ago

It seems that it's no more possible to assign a heating schedule to a room It's possible to create, to modify a schedule.

logs: _2024-10-29 14:58:59.407 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [546817564752] Error handling message: Unknown error (unknown_error) le gallo from 90.59.183.153 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:131.0) Gecko/20100101 Firefox/131.0) Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/aioWiserHeatAPI/schedule.py", line 175, in _send_schedule_command result = await self._wiser_rest_controller._send_schedule_command( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aioWiserHeatAPI/rest_controller.py", line 356, in _send_schedule_command result = await self._do_schedule_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aioWiserHeatAPI/rest_controller.py", line 326, in _do_schedule_action return await self._do_hub_action(action, url, schedule_data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aioWiserHeatAPI/rest_controller.py", line 143, in _do_hub_action raise WiserHubConnectionError(self._last_exception) aioWiserHeatAPI.exceptions.WiserHubConnectionError: Unknown error communicating with Wiser Hub 192.168.1.19 for url http://192.168.1.19:80/data/v2/schedules/Assign with data {'Assignments': [2, 3], 'Heating': {'id': 1, 'Name': 'Séjour'}}. Error code is: 400

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/aioWiserHeatAPI/schedule.py", line 486, in assign_schedule await self._send_schedule_command("ASSIGN", schedule_data) File "/usr/local/lib/python3.12/site-packages/aioWiserHeatAPI/schedule.py", line 180, in _send_schedule_command raise WiserScheduleError(ex) aioWiserHeatAPI.exceptions.WiserScheduleError: Unknown error communicating with Wiser Hub 192.168.1.19 for url http://192.168.1.19:80/data/v2/schedules/Assign with data {'Assignments': [2, 3], 'Heating': {'id': 1, 'Name': 'Séjour'}}. Error code is: 400

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 28, in _handle_async_response await func(hass, connection, msg) File "/config/custom_components/wiser/websockets.py", line 300, in websocket_assign_schedule await schedule.assign_schedule(int(msg["entity_id"])) File "/usr/local/lib/python3.12/site-packages/aioWiserHeatAPI/schedule.py", line 488, in assignschedule raise WiserScheduleError( aioWiserHeatAPI.exceptions.WiserScheduleError: Error assigning/unassigning schedule: Unknown error communicating with Wiser Hub 192.168.1.19 for url http://192.168.1.19:80/data/v2/schedules/Assign with data {'Assignments': [2, 3], 'Heating': {'id': 1, 'Name': 'Séjour'}}. Error code is: 400

msp1974 commented 1 week ago

I wonder if this has changed on the v2 hub. Are you able to see what the Wiser app is sending to assign a schedule? It maybe to do with the new schedule types I see in your diagnostics.

LGO44 commented 1 week ago

Sorry Mark, I have report an issue too quickly, you can close this issue I'v made some more tests and the root cause of this issue is the name of the schedule Séjour I think that the character é is not allowed and I use it. When I rename it everything is OK.

For your information as you see there are new types of schedules: onoffcost : it's to manage some onoff devices (smartplugs) according to the cost when you have some diffrents prices for you electricity ( for exemple I have a lower price between 0:50 and 6:50 AM and 2:20 and 4:20 PM) smart is to force Off a device at certain time
I'll have to look how we can add these schedules ...

The devices have also attribute that report these capability smart or onoffcost

msp1974 commented 1 week ago

On the schedule name, i wonder if we need to encode it. I'll have a look at that. In terms of new schedules, i want to slow the level of changes for a little bit as i am trying to get to a new base that will make it easier to manage all this. I need some time to finish it (and will likely need you to help with testing). We can then progress more of the v2 stuff.

LGO44 commented 1 week ago

Sur le nom du calendrier, je me demande si nous devons le coder. Je pense que ce nom a été corrigé par le correcteur orthographique lorsque je l'ai créé, il n'est pas obligatoire de l'encoder. Cela devrait être la même chose pour d'autres langues...

Of course I will be present for the tests of your new base.

msp1974 commented 1 week ago

I'v made some more tests and the root cause of this issue is the name of the schedule Séjour I think that the character é is not allowed and I use it. When I rename it everything is OK.

No this should be allowed. I have been looking at it and it seems that the aiohttp library is encoding non ascii characters which is then not compatible with the hub. I'll fix this.

msp1974 commented 1 week ago

Ok, i have a fix for this that i will push in next release.

LGO44 commented 1 week ago

Great, sorry to bring you more work!

msp1974 commented 1 day ago

Should be ok now with non ascii chars in schedule names in v3.4.12. Can you let me know. Thx