That certainly is not correct. The number of the month cannot be both greater than or equal to 12 at the same time as being less than or equal to 1.
It’s not exactly clear what you want. Do you want the automation to be able to run on January 8th, and December 9th, or any day between them (i.e., after January 8th but before December 9th)?
Or do you want the opposite (i.e., on December 9th, and January 8th, or any day between them – after December 9th but before January 8th)?
automation should work between the days from 8 December to 8 January of the following year, every day, and another that should work on 9 January to 7 December of the same year for each day. thank you
I’m trying to turn on a Christmas tree at 5AM and turn it off at 10PM. A couple options…?
Use the switch.toggle option, and somehow make sure no one messes with it manually and gets it out of sequence…
Use two separate automations one that triggers on at 5AM, one that triggers off at 10PM
(probably a smarter way!)
i thought i saw that i could use a condition template similar to what you are doing above, but i dont know how to ‘action’ it to do an on when the condition is met and an off when not.
Using two automations is definitely simpler, and you get the added benefit of being able to individually turn them on or off if you like. But, for completeness, you can do it in one automation:
trigger:
- platform: time
at: 05:00:00
- platform: time
at: 22:00:00
action:
- service_template: >
switch.turn_{{ 'on' if trigger.now.hour == 5 else 'off' }}
entity_id: switch.SWITCH
Very nicely done. Im going to have to look closer at template syntax in the future. Is it right that the template stuff is tasmota driven? Whereas all the code around it is home assistant specific?
Ok. Thanks for that quick response Dave. Ive just seen some template type stuff in a field on the tasmota flashed sonoff basics, which made me think it was tasmota scripting vs HA.
Are home assistant templates python, perl, bash, or something else? Or just their own special home grown flavor?
The template stuff for Tasmota is entered in Tasmota to set the device type on a once-off basis. Nothing to do with HA templates… completely different function.
Home Assistant generally uses Jinja templates but some addons/custom-cards use Java. You can also use scripts (I have used bash and Python but I assume you could use Perl too - the trick is to make sure the used commands are supported by the Home Assistant shell)
The template sets the GPIO Port outputs. 255=user and that is a Generic sonoff and not active as per what you say. If you set the module type, it will overide that template.
See here:
Here is my nodemcu:
On the Template page you can click on the dropdown menu for each GPIO to see what the options are for that pin.
As well as the preconfigured modules, there is a site you can download templates for pretty much any device or you can roll your own as I have done here.
honestly… this is french to me. GPIO’s are the places i can solder wires on the device i’m using, correct? when you define GPIO4 and 5 above, what kind of data/function is actually moving through these pins? how did you know what an SDA and an SCL are? (yeah. pretty noob!).
Also, why is Generic (18) used? on my sonoff-basic there is an option for that… but i’m on generic (18) as well instead of that. mine are all 255?
Well you see SCL and SDA - those pins enable me to connect i2c devices and they are connected physically to those GPIO’s (See the temp/pressure/humidity/illuminance)
Yours is set to Generic (18) as the module type because that is the default and you have not selected the correct module type. 255=user is the default!
No idea why 9/10 are red.
If you go to configure>configure module you can select the correct module type and it won’t say generic anymore.