Cant get automations to run

Hello all first post. Very very new to home assistant. setup hass.io in vmware got a tplink switch and setup up dht22 on a wesmos mini with esphome. I setup a couple of automations to turn a fogger in a greenhouse on and off but they are not running. I set it up in the gui shall I post screenshot of setup or yaml code to try troubleshoot. Zerro errors in log. Help much appreciated.

1 Like

Yaml code would be best. Please format it as per section 11 here: How to help us help you - or How to ask a good question

I think I tracked down my issue to sun condition in my automation. I am trying to run a green house fogging system if humidity is out of spec or if temp is out of spec or if its 3h.30m after sunrise and 3hr before sunset. Here is the yaml code I am trying to use.

Sunrise I found this example in forum and tried to apply it

ondition: state
entity_id: sun.sun
after: sunrise
after_offset: '03.30.00'

This is for sunset same code editered from a forum post

condition: state
entity_id: sun.sun
before: sunset
before_offset: "03.00.00"

if I use the gui editor I get the following code wich is also wrong and wont let me save
sunrise

condition: sun
after: sunrise
after_offset: 03.30.00

Sunset

condition: sun
before: sunset
before_offset: 03.00.00

this is what gui setup looks like

any help much appreciated

If you scroll to the top of the page it will show you the error as to why it won’t save. It will look a lot like this :wink:

Change your dots to colons in the before and after offsets

after_offset: 03:30:00

Awesome thanks heaps hopefully that got that sorted I will find out in a couple of days when I can try it on hardware again. other issue is the repeat mode on the automation. I trigger the automation either by hardware device or manually it runs once then stops.

To work out what everything does I want to switch a tplink switch “misterswitch” on if temp above 5c delay it so it runs for 30sec then switch it off delay another 30 sec the repeat infinately(eventually I will edit run times and add the sunrise sunset condition.)I am doing this within the automation gui. Here is the code.

- id: '1603014610801'
  alias: Mister_control
  description: Control humidity+
  trigger:
  - type: value
    platform: device
    device_id: 95864f0f0dd011eba637572e73a66433
    entity_id: sensor.orchid_house_temperature
    domain: sensor
    above: 5
    for:
      hours: 0
      minutes: 0
      seconds: 2
  condition: []
  action:
  - type: turn_on
    device_id: 7f651ad80f7811eb880cdf84a33cf782
    entity_id: switch.misterswitch
    domain: switch
  - delay: '30'
  - type: turn_off
    device_id: 7f651ad80f7811eb880cdf84a33cf782
    entity_id: switch.misterswitch
    domain: switch
  - delay: '30'
  - repeat:
      until:
      - type: is_value
        condition: device
        device_id: 95864f0f0dd011eba637572e73a66433
        entity_id: sensor.orchid_house_temperature
        domain: sensor
        above: 5
      sequence: []
  mode: queued
  max: 7

I have tried all the modes I have also tried using time but cant get it to cycle more then once.

Just to clarify the temp I want to use to reference the switch is a dht22 on a wesmos mini.

Two things:

Your automation trigger is temp over 5 degrees, is also your trigger to stop the repeat. It’s already at 5 degrees so will only run once

The actions you want to repeat need to be under the sequence: key of your repeat list item

Have a look here and scroll down to Repeat Until for an example.

Thanks for the help. Hmmm has me stumped still not doing what I expect. Here is my full automation I would assume this would keep running till humidity above 70%. Still no sunrise sunset condition either

- id: '1603038946644'
  alias: control humidity
  description: ''
  trigger:
  - type: value
    platform: device
    device_id: 95864f0f0dd011eba637572e73a66433
    entity_id: sensor.orchid_house_temperature
    domain: sensor
    above: 26
  - type: value
    platform: device
    device_id: 95864f0f0dd011eba637572e73a66433
    entity_id: sensor.orchid_house_humidity
    domain: sensor
    below: 70
  condition: []
  action:
  - type: turn_on
    device_id: 7f651ad80f7811eb880cdf84a33cf782
    entity_id: switch.misterswitch
    domain: switch
  - delay: '30'
  - type: turn_off
    device_id: 7f651ad80f7811eb880cdf84a33cf782
    entity_id: switch.misterswitch
    domain: switch
  - repeat:
      until:
      - type: is_value
        condition: device
        device_id: 95864f0f0dd011eba637572e73a66433
        entity_id: sensor.orchid_house_humidity
        domain: sensor
        above: 70
        below: 0
      sequence: []
  mode: queued
  max: 10

This will keep running for ten cycles unless the humidity exceeds 70.
Keep in mind you have two triggers.
If the automation is triggered by temperature and the humidity is already over 70, I’m not sure if it will run only once, or not at all :thinking:

- id: '1603038946644'
  alias: control humidity
  description: ''
  trigger:
  - platform: numeric_state
    entity_id: sensor.orchid_house_temperature
    above: '26'
  - platform: numeric_state
    entity_id: sensor.orchid_house_humidity
    below: '70'
  condition: []
  action:
  - repeat:
      until:
      - condition: numeric_state
        entity_id: sensor.orchid_house_humidity
        above: '70'
      sequence:
      - service: switch.turn_on
        entity_id: switch.misterswitch
      - delay: 00:00:30
      - service: switch.turn_off
        entity_id: switch.misterswitch
      - delay: 00:00:30
  mode: queued
  max: 10