#But can t we create a thread

1 messages ยท Page 1 of 1 (latest)

reef condor
#

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
mortal nexus
#

This inside the yaml of the autiomation trigger ?

reef condor
#

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
mortal nexus
#

Where should I put it ?

reef condor
#

The first one you can build in the UI editor

#

Pick numeric state trigger for the trigger

mortal nexus
#

Explain the ride for a second and how it is listening for the "temperature change" event to turn it off or on ,please

reef condor
#

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

mortal nexus
#

what mean .whale ?

reef condor
#

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

mortal nexus
#

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 ?

reef condor
#

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

mortal nexus
#

why ?

reef condor
#

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

mortal nexus
#

So to get it to turn itself off, I would have to do another simple automation ? If not, I'll end up melting XD

reef condor
#

Yes

#

With above and a suitable number

mortal nexus
#

with the same code right ?

#

sorry but my english is not good ๐Ÿ˜ฆ

reef condor
#

Similar

#
trigger:
- platform: numeric_state
  entity_id: sensor.broadlink_4_temperature
  above: 22
action:
- service: climate.turn_off
  target:
    entity_id: climate.whale
mortal nexus
#

I could also use SET_AUX_HEAT right ?

reef condor
#

You can use any service call

mortal nexus
#

for my case !

reef condor
#
  action:
    - service: climate.set_aux_heat
      target:
        entity_id: climate.kitchen
      data:
        aux_heat: true
#

Remember you can build that in the UI

mortal nexus
#

where are they saved ? config/automation.yaml ?

reef condor
#

Yes

mortal nexus
#

and to activate them ?

reef condor
#

What do you mean?

honest spokeBOT
#

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 a condition that checks for more than one having started the automation then the condition can never be true.
  • condition: These are checked after a trigger starts 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.
reef condor
#

That's how automations work โ˜๏ธ

mortal nexus
#

the automations as soon as they are created are already listening ?

reef condor
#

Yes

mortal nexus
#

Do they intercept trigger changes on their own ?

reef condor
#

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
mortal nexus
#

what if I wanted to pause them ? for example for all nights ? I would have to add other conditions right ?

reef condor
#

Yes

mortal nexus
#

okok i understand

honest spokeBOT
reef condor
#

Something like that, or just turn them off

mortal nexus
#

with disable button right ?

reef condor
#

Yes

mortal nexus
#

do you write the automations by hand or use the UI ?

reef condor
#

I do them by hand

#

YAML isn't that hard, to me anyway

mortal nexus
#

Upper mode

Fixed number

Numeric value of another entity

what mean that ?

reef condor
mortal nexus
#

sorry i understand

reef condor
#

Fixed number - for example 18

mortal nexus
#

or 22.2

reef condor
#

Numeric value of another entity - for example sensor.petunia_temperature

mortal nexus
#

I'm trying if it works

#

Now it looks like he didn't turn it off

reef condor
#

Did the temperature cross the threshold?

mortal nexus
#

`- 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

honest spokeBOT
#

To test an automation there's three stages you can follow. Testing the action, the condition and action, and the whole automation:

  1. 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
  2. Use Developer tools -> Services and call automation.trigger on the automation with skip_condition: false. If the first passes but this fails then the problem is in your condition: block
  3. 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.

reef condor
#

above: 22.9 means it has to go from 22.9 or lower to 23.0 or higher

mortal nexus
#

it works ๐Ÿ˜„

#

i'm trying to understand the test

reef condor
#
  1. Checks that your actions work
mortal nexus
#

yep yep

reef condor
#
  1. checks that the conditions work
mortal nexus
#

i'm done ๐Ÿ˜›

reef condor
#
  1. Checks the triggers work
mortal nexus
#

mmmh another one thing

reef condor
mortal nexus
#

oh ok ahahahah

#

because at this point I was thinking about making two buttons that invoke services, volumeUp and volumeDown

mortal nexus
#

can one automation call another automation ?

reef condor
#

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

honest spokeBOT
mortal nexus
#

what language does HA use?

#

python? I would like to understand built-in methods and variables

reef condor
#

Well, it's written in Python, but that's got nothing to do with how automations work

mortal nexus
#

i saw

mortal nexus