Hello, I need some advise/help in yaml template formatting.
To learn to use yaml, I started by trying to implement a furnace control. I have a Sonoff-sv controlling the furnace and a Sonoff-TH reporting the temperature(mqtt). I want to compare the temperature to a set point on a panel slider, and with hysteresis, turn the furnace on/off. In addition, I want to turn off the furnace after a set time from a slider on the panel compared to a counter incremented each minute. I have tried for a week and failed. Value templates that work in the template tool, fail in operation yielding errors in the log file. The log file language is not very easy to understand. I tried state.xxx.state and float(state.xxx.state) and operators ‘gt’, ‘lt’, and ‘ge’ which all failed. I show example code below and I have attached my yaml files. Sometimes, I find hundreds of lines of nulls in the log file between the top and any error messages. I have completely started over with a freshly programmed, new Sandisk class 10, 64 Gb SD card with hassio 0.63.3 and new clean yaml files and database files. There was no improvement.
I would really appreciate any advise. I program in assembly, C, C++, and Python, but that is not helping me much here.
indent preformatted text by 4 spaces
condition:
condition: and
conditions:
- condition: state
entity_id: input_boolean.og_furnace_run
state: 'on'
- condition: template
value_template: '{{ (states.counter.og_furnace_timer.state) > (states.input_number.og_furnace_ontime.state) }}'
condition:
condition: and
conditions:
- condition: template
value_template: '{{ float(states.input_number.og_furnace_temp_set.state) > float(states.sensor.shop_ac_temperature.state) }}'
- condition: state
entity_id: input_boolean.og_furnace_run
state: 'on'
condition:
- condition: template
value_template: '{{ gt(states.input_number.og_furnace_temp_set.state, states.sensor.shop_ac_temperature.state + 2.5) }}'
- condition: state
entity_id: input_boolean.og_furnace_run
state: 'on'
indent preformatted text by 4 spaces
We don’t need files attached, but we need the formatting done correctly using the instructions at the top of every page that explains how to properly format your code using the forum software.
nope, don’t need the if. That will break the value templates. Value templates are ment to return a True/False for condition. If you add the if, then it removes the returned true/false from the value template.
You can disregard this comment. I didn’t read your full value template.