Hi i’m switching a relay to control a pump that circulates water in my aquaponics system. I would like to do this at various frequencies depending on day and night and when i’ve got that sorted add temperature into the equation.
I have hassio installed in a docker on a virtual machine running on a base machine which is windows.
The system is running fine and various time base automations are running very reliably the last few months.
I have just being doing automations using the automation assistant but would like to write directly, i’m a bit confused with the id that is a long number that they all begin with? oif I write directly what do i put?
However the main question of this topic is to understand why one of the two automations pasted below works perfectly and the other for night does not work.
In my thinking the 1st triggers every 50 minutes and if its after sunrise and before sunset it turns on the pump for 14 minutes. This works.
The 2nd triggers every 2 hours and if its after sunset and before sunrise it turns on the pump for 15 minutes except it does not work!
Thanks
Keith
The id parameter is optional. It is only necessary if you want to be able to edit the automation in the UI. It can be anything, as long as it’s unique. I don’t use the automation editor in the UI at all, and none of my automations have an id.
Actually, it doesn’t. It triggers whenever the minutes component of the current time is a multiple of 50. That happens only once an hour at XX:50:XX.
That’s your problem. It can’t be after sunset and before sunrise at the same time. You need a condition that is true after sunset or before sunrise. The easiest way to do that is:
- condition: state
entity_id: sun.sun
state: below_horizon
Because it’s after sunrise and before sunset. It goes midnight, sunrise, sunset, midnight. Sunrise is always before sunset (because the way the sun condition works is it’s only considering sunrise & sunset of a given day, not sunset from one day and sunrise of the next day.)
You still haven’t entered the condition correctly (as I showed you.) That is why it’s not triggering, or even showing up as an entity. Did you not see any errors in the log or when you checked the config???
You are missing the condition: link. This is what your automation should be:
I still have no joy, maybe there are other issues.
It will be long but i’ll post the whole automation file and the log errors.
Thanks if you can help.
LOG
Invalid config for [automation]: required key not provided @ data[‘trigger’][1][‘platform’]. Got None. (See /config/configuration.yaml, line 13). Invalid config for [automation]: [entity_id] is an invalid option for [automation]. Check: automation->entity_id. (See /config/configuration.yaml, line 13).
Excuse my lack of checking.
Fantastic my code is working!
To get my 50mins and variable timings I think i need to understand timers is that right? and that will be another topic.
Thanks again.
Keith