I’m new to Home Assistant, and I’m trying to set up an automation that is based on the temperature readings from 2 different Netatmo Weather Station modules.
Specifically, one weather station module is inside, and the other is outside. I want to create an automation that will turn on a switch that is connected to a window fan whenever the outside temperature is equal to or less than the inside temperature. I have already set up the Netatmo integration, and the “Overview” page of HA shows all of the Netatmo sensors along with their temperature readings. The relevant entity ids are:
single line templates require the templates to be wrapped in quotation marks. either single or double makes no difference. EXCEPT if you use quotation marks inside the template then the ones inside the template have to be opposite the ones outside.
and be sure to use the standard text style marks not the “fancy curly” ones that some word processors will use. as long as you are using a simple text editor then you should be fine.
Also, you don’t need to use “data_template:” in the service call because you aren’t using any templates there. just use “data:”. Or better yet since you are only passing it an entity_id the you don’t even need to use that.
as an example of the different quotes requirement it would be something like this (and this is the recommended format so you might want to use this in place of you template anyway):
The values really need to be converted to numbers before doing the comparison. Otherwise you’re comparing strings (which all states are), and that won’t work as expected. E.g.:
I honestly didn’t even look at the validity of the template. I was just focused on the formatting of the template to get rid of the error that was reported.
Thanks. This explains a lot. I initially thought it was working, but soon observed some weird behavior, including fans turning off and on at the wrong times, or turning on only to immediately turn off again.
One question: your value_template code starts with a ‘>’ and end with a double quote ("), but there is no corresponding double quote. Is that a typo? should the ‘>’ at the beginning be the first double quote?