ok, copying line by line in the automations YAML editor makes the error to disappear. ok now.
Now I still have a problem validating my sensor value, sometimes the value is Null or “-” and I tried to handle the error with something like this, but doesn’t work. Sure I use the wrong syntax:
{% if states.sensor.sion_wind_speed is defined %}
This return false, but doesn’t give me an error. Is there another way to check if value is defined?
Not sure what you mean by that to be honest.
So, when you are setiing up you ‘have’ your factors sorted in your head and the values associated, so I would have pasted this into the template editor : -
{% set avpwr = states('sensor.avg_pvpower') | float %}
{% set azi = state_attr('sun.sun','azimuth') | int %}
{% set stemp = states('sensor.sion_temperature') | float %}
{% set atemp = states('sensor.aeon_dsb05_multisensor_temp') | float %}
{% set swind = states('sensor.sion_wind_speed') | float %}
avpwr-{{ avpowr }}
avi-{{ azi }}
stemp-{{ stemp }}
atemp-{{ atemp }}
swind-{{ swind }}
{% set op1 = avpwr > 350 %}
{{ op1 }}
{% set op2 = 95 < azi < 270 %}
{{ op2 }}
{% set op3 = stemp > 18 %}
{{ op3 }}
{% set op4 = atemp > 23 %}
{{ op4 }}
{% set op5 = swind < 25 %}
{{ op1 }}
This sets those inputs in a clear manner and you can test the values
Also say the wind is less that 25 but you want to test 30 : -
{% set avpwr = states('sensor.avg_pvpower') | float %}
{% set azi = state_attr('sun.sun','azimuth') | int %}
{% set stemp = states('sensor.sion_temperature') | float %}
{% set atemp = states('sensor.aeon_dsb05_multisensor_temp') | float %}
{% set swind = states('sensor.sion_wind_speed') | float %}
avpwr-{{ avpowr }}
avi-{{ azi }}
stemp-{{ stemp }}
atemp-{{ atemp }}
{# This next line tests your wind 30 state #}
{% swind = 30 %}
swind-{{ swind }}
{% set op1 = avpwr > 350 %}
{{ op1 }}
{% set op2 = 95 < azi < 270 %}
{{ op2 }}
{% set op3 = stemp > 18 %}
{{ op3 }}
{% set op4 = atemp > 23 %}
{{ op4 }}
{% set op5 = swind < 25 %}
{{ op1 }}
Then you can play with your logic
Try to avoid multiple output statements as it gets confusing and even when you think you’ve got it solid it may be pointing in a random direct and you won’t know
Your logic is also VERY SCREWY (x stands for ANY variable)
If pwr > x AND x < sunazi < x AND stemp > x AND a temp > x AND wind < x – then ON
elseif (that full set does not match, but) wind > 35 (that’s a big gap) – then OFF
elseif (i dont care about any of the above but) if sun azi < 220 — then ON
else — then OFF
This just looks wrong.
Pick a wind speed and stick to it. This is a binary condition, use the other binary sensor type of thing to set a wind condition (less than for 5 mins or whatever)
Put it another way
Only consider wind speed
Then
Only consider temp
Then
Only consider azimuth
Then
Only consider power
Because if higher than 220 I do not want the blind to go down again. But at 270 it must go up. This is because I want to use one automation for managing up and down, sure it would be simple using 2 automations.
Same answer as above.
You’re totally right. Studied Turbo Pascal at University in 1987 but didn’t practiced enough…
Anyway, thanks for your syntax, looks like “Select case” no? Like better than if “nesting”, this is the right translation for “imbrication” sorry…
So now let me a little time to assimilate this! Chris
So you are saying blind must go up if < 95 and >270 but the rest of the time “it depends” ?
That’s good, we can work with that !
{% set upazi = azi < 95 or azi > 270 %}
So upazi == blind always up
220 to 270 if up stay up else 95 to 270 go up ???
No, I mean during testing you just want to test “what if” scenairios, you enter your deviations (from what actual sensors are saying) into the template editor “like this”