I have written a script which controls my BOSCH smart home thermostats gen. II by means of the new controller II. It works well.
Purpose of the script: Deactivation of thermostats for x minutes during venting of whole appartment.
The thermostats are always on auto (running a heating plan) and are temporarily set to manual 18°C during venting.
Background: My appartment is rented, so no extensive installation of sensors etc. makes sense currently, I want to work with only the existing thermostats.
Thank you so much, exactly what I was looking for. Can global variables be defined (e.g. as entities?) so they can be reused in different scripts/automations?
About the notification group: I’ll try to implement it with your hint and will share the result.
I do a similar thing with the thermostat in my garage, when the garage door opens an automation set the hvac _mode to off, then 15 minutes later turns it back into heat mode.
Anyways, that all works fine, except last week the command to turn the thermostat timed out and the integration (zwave) did not return an error,
So, to make this reliable, you’ll want to add a delay, check to see if the thermostat did turn on and if not retry. Also you should be setting continue_on_error to true otherwise if one of those calls errors the automation will terminate.
I’m working on a project to make the retries transparent and easy to do vs coding into each automation.
That’s funny - I thought of exactly the same robustness improvement. A little simpler currently: Just issue the same script commands twice with a delay between. The whole status checking will take some more time for me as a newbee. But thanks to your kind provision of resources (HASS-RS) maybe not so much time after all.
It’s easy to use repeat for this purpose. The service call will be repeated only the number of times necessary or until it reaches a maximum number of attempts.
For added robustness, add an if-then after the repeat to check if the service call was ultimately successful. If it wasn’t then, at a minimum, post a notification reporting the failure.
FWIW, I have a ‘goodnight’ script that runs through a long list of things to lock, turn off, etc. For my situation, it doesn’t employ repeat (to try multiple times) but a wait_for_trigger with a timeout. For example, after locking a doorlock, it waits for the lock’s state to change to ‘locked’. If it fails to change within the timeout period, the script announces the failure (and then proceeds to execute the balance of the script).
for some reason the variable definition (- variables: bereiche: bad, ...) and reference (area_id: "{{ bereiche }}") doesn’t work. No error is displayed when saving script (so correct indentation as per your suggestion), but no effect.
Trying this as an alternative: Loop in script with variables - #5 by mullischlumpf
Now I want to add a while loop like in the following code snippet, but I don’t yet know how the variables would work in a nested repeat loop (I need a repeat count from the superordinate repeat loop) and also how the climate. entities can be called using concatenations of climate.room_climate_ and the values of the variables array.
Thanks for the note. I am working on an updated version of RS that will be an integration instead of the scripts. I see from your example, that you periodically poll the device (via update_entity) and your condition contains multiple parts. Are there any other missing capabilities?
Either way can work on the repeat. If it works then it’s good! I do like to have things be efficient as possible, I don’t know that you get an advantage of polling every second vs polling at a longer interval? Also note, that if the update_entity fails, the automation will end, you may want to consider using the continue_on_error flag, so that a WIFI dropout doesn’t cause the automation to exit.