#But can t we create a thread
1 messages ยท Page 1 of 1 (latest)
As if by magic
trigger:
- platform: numeric_state
entity_id: sensor.broadlink_4_temperature
below: 18
action:
- service: climate.turn_on
target:
entity_id: climate.whale
This inside the yaml of the autiomation trigger ?
No
That's the trigger and action
automation:
- alias: Heat the whale
trigger:
- platform: numeric_state
entity_id: sensor.broadlink_4_temperature
below: 18
action:
- service: climate.turn_on
target:
entity_id: climate.whale
``` whole automation
Where should I put it ?
The first one you can build in the UI editor
Pick numeric state trigger for the trigger
Explain the ride for a second and how it is listening for the "temperature change" event to turn it off or on ,please
When the state of sensor.broadlink_4_temperature goes from 18 or higher to below 18 the automation triggers
There are no conditions, so it goes right to the actions
The action is to call the climate.turn_on service on climate.whale
what mean .whale ?
climate.whale not .whale
climate.whale is an entity
Clealry I made it up, since I don't know what your actual climate entity is
ah ok sorry, just a second i'm trying
but if I put an if else in the actions and put numerical values so that it turns on and off by itself works the same ?
Don't complicate things
While you're still trying to learn how this all works, throwing an if...else in there is just asking for confusion
why ?
You're asking why over-complicating things is just going to cause confusion?
Start simple, learn
Once you understand things then sure, add in pointless complexity
So to get it to turn itself off, I would have to do another simple automation ? If not, I'll end up melting XD
Similar
trigger:
- platform: numeric_state
entity_id: sensor.broadlink_4_temperature
above: 22
action:
- service: climate.turn_off
target:
entity_id: climate.whale
I could also use SET_AUX_HEAT right ?
for my case !
action:
- service: climate.set_aux_heat
target:
entity_id: climate.kitchen
data:
aux_heat: true
Remember you can build that in the UI
where are they saved ? config/automation.yaml ?
Yes
and to activate them ?
What do you mean?
There are three sections to an automation:
trigger: When any one of these becomes true the automation starts processing. Only one trigger is ever responsible for starting an automation, if you make aconditionthat checks for more than one having started the automation then the condition can never be true.condition: These are checked after atriggerstarts the processing, and must be true for the automation to continue.action: This is the part that does something, and can also include further conditions.
That's how automations work โ๏ธ
the automations as soon as they are created are already listening ?
Yes
Do they intercept trigger changes on their own ?
Yes, otherwise what would be the point?
All that's needed is for the trigger to go from false to true.
So
- platform: numeric_state
entity_id: sensor.broadlink_4_temperature
above: 22
``` won't trigger until `sensor.broadlink_4_temperature` goes from 22 or below to above 22
If it's already above 22 it won't run
what if I wanted to pause them ? for example for all nights ? I would have to add other conditions right ?
Yes
okok i understand
Something like that, or just turn them off
with disable button right ?
Yes
do you write the automations by hand or use the UI ?
Upper mode
Fixed number
Numeric value of another entity
what mean that ?
https://www.home-assistant.io/docs/automation/trigger/#numeric-state-trigger explains how the trigger works
sorry i understand
Fixed number - for example 18
or 22.2
Numeric value of another entity - for example sensor.petunia_temperature
Did the temperature cross the threshold?
`- id: '1677346468488'
alias: Spegni condizionatore
description: Spegna in condizionatore se ha superato una cerca temperatura
trigger:
- platform: numeric_state
entity_id: sensor.broadlink_4_temperature
above: 22.9
condition: []
action: - service: climate.turn_off
data: {}
target:
entity_id: climate.office_ac`
I tried to turn it up and see if when he reaches it he turns it off
To test an automation there's three stages you can follow. Testing the action, the condition and action, and the whole automation:
- Use Configuration -> Automations to find the automation and then push Run Actions. If this fails your problem is in the
action:section, and details should be found in your log file - Use Developer tools -> Services and call
automation.triggeron the automation withskip_condition: false. If the first passes but this fails then the problem is in yourcondition:block - Use Developer tools -> States to find the trigger entity, click the name, then change the state (at the top) to something that'll trigger the automation before pushing Set State. If this fails then the problem is with your
trigger:section, or the automation is turned off (you can check that in Developer tools -> States).
You can also see this section in the docs and with HA 2021.4 onwards debug automations.
above: 22.9 means it has to go from 22.9 or lower to 23.0 or higher
- Checks that your actions work
yep yep
- checks that the conditions work
i'm done ๐
- Checks the triggers work

oh ok ahahahah
because at this point I was thinking about making two buttons that invoke services, volumeUp and volumeDown
can one automation call another automation ?
That's the wrong approach
If you need to use the actions from another automation, make those actions a script and call the script from both automations
what language does HA use?
python? I would like to understand built-in methods and variables
Well, it's written in Python, but that's got nothing to do with how automations work
i saw
but how can i the script aren't conditional ?