Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set_schedule not working for old automation / some time entries changed to needing quotes #325

Closed
toddstar opened this issue Nov 8, 2022 · 7 comments

Comments

@toddstar
Copy link

toddstar commented Nov 8, 2022

More an fyi, as very easy to change on the users end, but it seems some time entries now need to be enclosed in quotes for the set_schedule file to correctly update the schedule and without updating your files to enclose the times in quote marks (see File Fix at the bottom) the old format fails silently. Couldn't see anything in release notes about this change, so mainly creating this just so others can find the information when searching for "set_schedule" issues to save themselves some debug/testing time.

e.g.
my spare room has the following code in my current saved files (I use node red to switch between 3 difference preset files for all my schedules based on the external temperature for a summer, winter & an inbetween sate)

Name: Wiser Top Room
Description: Schedule for Wiser Top Room
Type: Heating
Monday:
  - Time: 00:00
    Temp: 5.0
  - Time: 10:00
    Temp: 13.0
  - Time: 17:00
    Temp: 10.0
  - Time: 23:00
    Temp: 7.0
Tues.....

as its now getting cold enough that it should be switching between inbetween & winter I noticed that the schedule didn't seem to be changing and also couldn't see any errors being logged. So deleted the schedule from wiser, created a fresh dummy schedule in the wiser app and pulled it via get_schedule which output

Monday:
- Time: 06:30
  Temp: 5.0
- Time: 08:30
  Temp: 5.0
- Time: '22:30'
  Temp: 5.0
....

which now has quotes around 22:30 time but not the other times. (didn't test but guess its probably anything after 10:00???). Not sure when this changed but definitely post 'set_heating_schedule' changing to just 'set_schedule' as my old files still worked when testing the change to the service used

File Fix
All the time variables work enclosed so for a quick fix you can do a quick Ctrl+R (find & replace) to search for Time: and replace all to Time: ' and same with :00 to :00' / :15 to :15' / :30 to :30' / etc.

so that it looks something like below

Monday:
  - Time: '00:00'
    Temp: 5.0
  - Time: '10:00'
    Temp: 13.0
  - Time: '17:00'
    Temp: 10.0
  - Time: '23:00'
    Temp: 7.0
....
@msp1974
Copy link
Collaborator

msp1974 commented Nov 8, 2022

@toddstar - thanks for logging this. We moved from ruamel.yaml to pyyaml with v3.2.0 change to the fully async api - aioWiserHeatAPI, to be more inline with HA.

I did not notice this change in the time string requirements (seems this is yaml 1.1 compliant and ruamel was yaml1.2 compliant) but I think also, it should not fail silently but provide some notification that it has not been able to set the schedule due to errors in the yaml file. Will look to add something to better identify and error message this.

@nottledim
Copy link

nottledim commented Dec 6, 2022

Interesting. This issue seems to give me http 400 errors like this:

2022-12-06T10:02:08.871242854Z 2022-12-06 10:02:08.869 ERROR (MainThread) [aioWiserHeatAPI] Error setting schedule: Unknown error getting communicating with Wiser Hub wiserheat0395f2.lingbrae for url http://{}:{}/data/v2/schedules/Heating/1.  Error code is: 400

@msp1974
Copy link
Collaborator

msp1974 commented Dec 6, 2022

It will as unquoted times higher than 10am will send invalid times to the hub when setting a schedule. Error 400 is what the hub returns in this situation. Next integration update will have better error handling to alert to this issue.

@msp1974
Copy link
Collaborator

msp1974 commented Jan 9, 2023

Improved error checking and notifying now in v3.2.3beta. Are you able to check it? Thx

@toddstar
Copy link
Author

toddstar commented Jan 9, 2023

Improved error checking and notifying now in v3.2.3beta. Are you able to check it? Thx

getting

Error handling message: Error setting schedule from yaml file - Error converting to Wiser schedule: _WiserTemperatureFunctions._is_valid_temp() missing 1 required positional argument: 'temp' (unknown_error)
websocket_api script: Error executing script. Error for call_service at pos 1: Error setting schedule from yaml file - Error converting to Wiser schedule: _WiserTemperatureFunctions._is_valid_temp() missing 1 required positional argument: 'temp'

using the wiser.get_schedule command to generate a file and then using that same file in the wiser.set_schedule command

@msp1974
Copy link
Collaborator

msp1974 commented Jan 10, 2023

Sorry, reorganised some code and made a typo. Just released v3.2.3beta2 that should now work.

@toddstar
Copy link
Author

Sorry, reorganised some code and made a typo. Just released v3.2.3beta2 that should now work.

yeah working now and getting an error warning on HA automations page and node red outputs the error message too

@msp1974 msp1974 mentioned this issue Feb 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants