A little automation HELP please

I had originally managed to set up a Christmas Tree light automation (using the z-wave configuration GUID in Home-Assistant), which turned on a single zwave Aeotec Smart Switch at a certain time, and then turned it off after a delay of 4 hours. I have now repurposed the switch into my pool enclosure to turn on my pool robot at a certain time and then off 4 hours later (basically i renamed the friendly_name value). I have been trying to add a condition onto the automation which will only activate the automation on Fridays, but i am having a lot of trouble…
First issue is there is no field on the GUID to add a Condition: Time > weekday > - fri, it only allows for Condition: Time > After and Before

Thus i have had to try to edit the code in the automation.yaml file which was auto generated when i created the Christmas Lights automation… The below code is working.

- action:
  - data:
      entity_id: switch.aeotec_zw075_smart_switch_gen5_switch
    service: switch.turn_on
  - delay: 04:00:00
  - data:
      entity_id: switch.aeotec_zw075_smart_switch_gen5_switch
    service: switch.turn_off
  alias: Pool robot automation
  condition: []
  id: '1513727417360'
  trigger:
  - at: '18:00:00'
    platform: time

BUT, when i add the condition of fri, the code will not work… I have tried mutiple ways of adding the code, and NOTHING will work for me, giving me a different error each time.

Any assistance would be greatly appreciated.

thanks in advance

Hi ! The automation editor is a ‘work in progress’ and doesn’t currently have a complete feature set.

Can you repost your code using the code tags above ‘</>’ so the indentation is preserved :slight_smile:

Sorry, I am very new to this… Is there a way of generating the code tags, or is it just type them in manually, I am using Notepad++ and Atom and cannot see the option in either… I have taken a screenshot of the code though if that helps…

image

The code tags are at the top of the box when you are replying to a post in this forum.

Select the text you wish to tag and then press the code tags button which looks like </>

thank you, i did not know that existed…

I have eited my original post.

thanks

Because your automation was created with the ‘automation editer’ I’m not exactly sure of the formatting.
You’ll see I’ve put an entry in under ‘condition’ that I believe should work.
If not, let me know and we’ll re-format it so we know exactly what’s what :slight_smile:

 - action:
      - data:
          entity_id: switch.aeotec_zw075_smart_switch_gen5_switch
        service: switch.turn_on
      - delay: 04:00:00
      - data:
          entity_id: switch.aeotec_zw075_smart_switch_gen5_switch
        service: switch.turn_off
      alias: Pool robot automation
      condition:
      - condition: time
        weekday:
          - fri
      id: '1513727417360'
      trigger:
      - at: '18:00:00'
        platform: time

If you decide you want it come on on different days, you can just add it in.

  - condition: time
    weekday:
      - fri
      - mon
      - wed

Hi, thanks for giving it a go…

Got the below error log.

2018-02-05 20:31:14 ERROR (Thread-2) [homeassistant.util.yaml] while parsing a block collection
in “/home/homeassistant/.homeassistant/automations.yaml”, line 2, column 7
expected , but found ‘?’
in “/home/homeassistant/.homeassistant/automations.yaml”, line 9, column 7
2018-02-05 20:31:14 ERROR (MainThread) [homeassistant.bootstrap] Error loading /home/homeassistant/.homeassistant/configuration.yaml: while parsing a block collection
in “/home/homeassistant/.homeassistant/automations.yaml”, line 2, column 7
expected , but found ‘?’
in “/home/homeassistant/.homeassistant/automations.yaml”, line 9, column 7

I should also say, im happy for someone to give it a go to create it using script rather than the guid… i can always delete the one the guid created.

thanks again

Try this one. Basically the same, just formatted differently.

- alias: Pool robot automation
  id: '1513727417360'
  initial_state: true
  trigger:
  - platform: time
    at: '18:00:00'
  condition:
  - condition: time
    weekday:
      - fri
  action:
  - service: switch.turn_on
    entity_id: switch.aeotec_zw075_smart_switch_gen5_switch
  - delay: 04:00:00
  - service: switch.turn_off
    entity_id: switch.aeotec_zw075_smart_switch_gen5_switch

Also, consider making your actions a script.
Once an automation has been triggered, like a raging bull, it cant be stopped ! Turning the automation off only stops it from being triggered again. It doesn’t stop it from running if already triggered.

When you turn a script off, it stops dead in its tracks.

Also, FYI, you can have conditions in actions, and in scripts !!

Thanks… il try that tonight when i get home and let you know how it goes. I will also read up on creating scripts as i have never created those before.

Thanks

Thanks for attempting to get it the code… I dont receive any errors in the log any more however the task runs daily as opposed to Fridays…

i will red up on the Script option and try to code that myself (just like to give stuff a go myself before asking for help)… if i get stuck i will ask for assistance again.

thanks again,