Hi there.
I am all new to Home Assistant and have just gotten up and running with the newest hassio on a Rasberry Pi + a AEOTEC Z-stick and two Telldus Plug-in switched (zwave) + a temperature sensor.
I can make a script that turns both plugs on or both plugs off pretty easy:
I am however struggling with making the automation script for it. I cant figure out how to make a script that compares two readings from my temperature sensor (current temperature, and set temperature is “climate.danfoss_rs_room_sensor_heating.current_temperature” and “climate.danfoss_rs_room_sensor_heating.temperature”) and triggers if the first is higher than the other.
What i want to do is this:
if climate.danfoss_rs_room_sensor_heating.current_temperature < climate.danfoss_rs_room_sensor_heating.temperature
then trigger the turn on script
if climate.danfoss_rs_room_sensor_heating.current_temperature > climate.danfoss_rs_room_sensor_heating.temperature
then trigger the turn off script
Anyone that can help with some pointers or samples that look like this? (it is “greater than” or “less than” that i am struggling with…
What that works i would want to include “if door open - do not run the turn on script”
I’m not sure where the entities you listed came from but you need to make sure those exist. They may also be listed under attributes of the entity. That will change the template if so.
Just thought i would give an update to what actually worked.
I have to say these scripts and automations files sure are picky when it comes to indentation and spaces…spent quite a few hours getting it right and getting the right values out of the entities (and their attributes…)
btw: Anyone knows if i can set the value of an attribute in an entity (and actually have it write that value to the entity) ? ie. During night i would like to decrease the set value for the temp by 3 degrees
Thanks! Now that your code is formatted we can conclude that indentation and spaces really do matter! Check out the examples here to get an idea of what’s wrong.
Yeah, the indents on the last code you posted are wrong all over the place.
you probably ought to correct those errors so in case anybody comes along and uses your “working” code and they get errors on the config check it won’t confuse them more.
FWIW, on Windows 10, this free, open-source utility does a nice job of screen-recording with an option to save in gif format: https://www.screentogif.com/
Thanks for your tips. It worked out in the end. The code listed is now working as its supposed to.
I ended up adding a boolean thats true if the heat is on. I use this to check whether to swich heat back on once an open door returns to state “off”.
FWIW, I’d vote for replacing the existing static demo, with your animated version, ONLY if there was a way for me to hide it.
I’m long past the need for the code-formatting tip and prefer to regain some screen real-estate by hiding that box. Replacing it by an even larger box (containing an animated demo), would not be something I’d support (unless I could hide it).