They are VERY good, itās just that you probably donāt understand how they are laid out. I help people only using the docs for just about everything. Once in a while, Iāll have to go to the template editor. But I donāt use any of these integrations, I donāt use the built in automations, and I have very few devices outside switches and lights. Yet I help all sorts of people by just reading the docs.
Jinja is near identical to python aside from filters. And filters are advanced. There arenāt many jinja tutorials but there is about 90 million python tutorials. Iād start with basic python tutorials. Learn the basics, then take a look at jinja.
Their official documentation is goodā¦ but it will take time, especially to remember that even if itās very similar to python, it is not python.
Donāt think youāll need both things unless youāre not a coder and still are very keen to master it
I can believe that, but I also guess that you speak Python and/or Jinja For someone who does that, it is probably quite easy to see from HA docs what needs to be done.
Well, I am mainly interested in home automation, NOT in codingā¦ Although I understand that I have to code something if (and when) I chose to go to Home Assistant, and I am still thinking I will continue with that when I get to build our new house, instead of going to much expensive KNF or ABBFree@Home -route (or whatever, those are quite easy to use but also limiting in what they can do)ā¦ Itās been over 20 years since last time I did more coding and even then it was with (Object)Pascal, and I have never done anything with Pythonā¦
But I still think that since Lovelace automation tool is quite good already, it would ONLY need to add negative delay to be even better and if there was such an option already, this whole thread would not have been necessary
Then you should move to node red instead. Node-red is for those who donāt want to code, but like understand/think in flow charts.
Actually, you just need to understand yaml to understand the non-template documentation (integrations, etc). The documentation for templates is built like an API documentation. They tell you what the methods are. They do not tell you how to use them because you need to understand code.
ā¦although I probably would have stopped short of putting āveryā in capitals
The layout is not the best, but once you get used to it you (usually) know where to look.
Node-red sounds what would suit me better, that is true, but originally when I chose my home automation software (maybe two years ago or so), I chose Home Assistant because I wanted to choose software that would be very much still in developement and have big (and helpful) community because that would mean that if something was not yet possible in that software, it probably would be sooner or later, and if have a problem, there would be an active community that could help me. So far it seems that I chose right Not sure about in what situation Node-red was back then, but I donāt remember really considering that back then. But I did consider Domoticz, but because fanbase for that was declining, I chose HASS instead.
EDIT: Oh, there is Node-Red Add-on to Hassio, I should look into it!
You suggested that delay be able to employ negative values.
Delay ONLY goes in action sections of automations or sequence sections of scripts.
If you apply it there where you follow any given trigger, how would apply an action two hours earlier?
If you want to apply a minus two hours to a 10:00 time set, why not just set it for 08:00 in the first place.
Gilean, clearly is new to these sorts of issues.
Iāve seen your posts, you clearly have quite a good understanding.
This is what I mean about thinking about it.
Well, the OP is pretty adamant that negative delay is the thing that will save the world him from a lot of unnecessary work, and it doesnāt seem that we were very successful in explaining him the opposite.
For him it would be great to try opening such a FR as in the process he could a) understand things better or b) bring us a new feature.
Win-win!
p.s maybe your post will do the job
p.s.s Iām not always 100% serious, itās too boring
Okay, new day again for me, trying to understand some moreā¦ But itās hard because I donāt understand the syntax and winter will be probably over before I get to study this enough For example, I have no idea what ~ āTā ~ below actually doesā¦
Anyway, I would need to set ātimeā variable so that itās three hours before sensor.alarm_clock2_time. I have looked at previous examples but they have built a bit differently than this āsimplerā code and I cannot figure how to do the math here so itās in right format etcā¦
EDIT: The whole template is here:
value_template: >-
{% set temp = states('sensor.sonoffth3_am2301_temperature') | float %}
{% set time = as_timestamp(now().date() | string ~ 'T' ~ states('sensor.alarm_clock2_time') ~':00') | timestamp_custom('%H:%M') %}
{{ states('sensor.time') == time and temp > -10 }}
- alias: 'Turn Car on'
initial_state: on
trigger:
platform: time_pattern
minutes: '/1'
seconds: '0'
condition:
condition: or
conditions:
- condition: template
value_template: >
{% set time = (as_timestamp(now()) - 180 * 60) | timestamp_custom('%H:%M') %}
{% set temp = states('sensor.sonoffth3_am2301_temperature') | float %}
{{ time == states('sensor.alarm_clock_3_time')[0:5] and temp < -10 }}
- condition: template
value_template: >
{% set time = (as_timestamp(now()) - 120 * 60) | timestamp_custom('%H:%M') %}
{% set temp = states('sensor.sonoffth3_am2301_temperature') | float %}
{{ time == states('sensor.alarm_clock_3_time')[0:5] and temp > -10 and temp < -5 }}
- condition: template
value_template: >
{% set time = (as_timestamp(now()) - 60 * 60) | timestamp_custom('%H:%M') %}
{% set temp = states('sensor.sonoffth3_am2301_temperature') | float %}
{{ time == states('sensor.alarm_clock_3_time')[0:5] and temp > -5 and temp < 2}}
action:
- service: switch.turn_on
entity_id: switch.sonoffpow3_2
This should trigger every minute and turn on the switch only if
(time = alarm clock - 3 hours AND temp < -10)
OR
(time = alarm clock - 2 hours AND temp > -10 AND temp < -5)
OR
(time = alarm clock - 1 hour AND temp > -5 AND temp < 2)
Is this what you want? Please note I didnāt test this as Iām not at home right now.
Thank you Burningstone, you are a star! This looks like working code except shouldnāt it do the math ( 60*60 etc) from sensor.alarm_clock3_time and not from current time and then in the third row compare current time to ātimeā variable? Tried to do so but didnāt succeedā¦
For example if now is 10:59, and I set sensor.alarm_clock3_time as 12:00 (to see if magic happens within minute), I can see from template editor that ātimeā variable is 9:59.
Great, now the template editor returns ātrueā when the time is exactly one hour before sensor.alarm_clock3_time (since temperature is -1.4 C atm)
One more thingā¦ Now I know that delay is in action part of automation, but how the heater will turn off three, two or one hours after it has turned on depending on situation?
Hmmm, wouldnāt it be easier to just turn off the heater when current time == alarm clock time? If I understand correctly, this is the behaviour you want?