Help with Automation not working

Hi

I have the following automation. When I trigger it is working, so both switches turn on. However when its the right time for automation to work it only turns on the first switch.

#Bed Heat
- id: Bed Heat
  alias: Bed Heat
  trigger:
    platform: time
    at: '21:15:00'
  condition:
    condition: time
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
  action:
    - service: switch.turn_on
      entity_id: switch.sonoff_10001baf48, switch.sonoff_10007b436c

I also tried this with the same results

 action:
    - service: switch.turn_on
      entity_id: switch.sonoff_10001baf48
    - service: switch.turn_on
      entity_id: switch: switch.sonoff_10007b436c

Any ideas why this is happening? I have the latest version of Hassio

The second way you tested can’t work because you have an unneeded “switch:” in the second entity_id line.

Try like this:

#Bed Heat
- id: Bed Heat
  alias: Bed Heat
  trigger:
    platform: time
    at: '21:15:00'
  condition:
    condition: time
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
  action:
    - service: switch.turn_on
      data:
        entity_id: switch.sonoff_10001baf48, switch.sonoff_10007b436c

Try this:

action:
  - service: switch.turn_on
    entity_id: switch.sonoff_10001baf48
  - service: switch.turn_on
    entity_id: switch.sonoff_10007b436c

I will try it at the evening when I got home. Hopefully it work.

@briis
Thanks. I did try it this way and won’t worked. The code I provided above it was not the actual one. I just wrote it for information here

If @briis suggestion doesn’t work, then there might be a bigger issue with your system. Both suggestions should work equally well and I’m surprised that it turns on both switches when you trigger it manually, but only one when it is triggered by the time.

I will try them both this week to see what will happen. It looks strange to me also, why it is working when I manually trigger the automation.

If you manually trigger the automation, the trigger and condition parts are ignored.

Yes, I don’t know if OP is aware of that, however doesn’t change the fact that only a part of the action gets executed when the automation is triggered manually and this seems strange to me as there are no conditions, wait templates or anything like that in his action part.

Yes I know about that, but again it doesn’t justifies why only one switch is turned on.

Wow, there’s a whole lot of repetition in this thread telling the OP to try the same things he said he already tried (at least according to his first post).

In the OP both ways should work (minus the extraneous “switch:” that you said didn’t actually exist). You need to do some testing to see what might be the issue.

If not then try one then the other. if both work individually then try reversing the order of the entities.

you can even try adding the entities as a bulleted list instead of individually or in a single line.

try in this order:

action:
    - service: switch.turn_on
      entity_id: switch.sonoff_10001baf48
action:
    - service: switch.turn_on
      entity_id: switch.sonoff_10007b436c
action:
    - service: switch.turn_on
      entity_id: switch.sonoff_10007b436c
    - service: switch.turn_on
      entity_id: switch.sonoff_10001baf48
action:
    - service: switch.turn_on
      entity_id: 
        - switch.sonoff_10001baf48
        - switch.sonoff_10007b436c
1 Like

Thanks, I will try them too. The first one is working. It was like this until I added a second switch in order to be able to turn off my side only.

Makis, can you understand the confusion ?
You say you have a problem with THIS
Then people point out the problems with THIS and how it should be THAT.
You say that THIS is not THIS but something else (and don’t post your something else) it’s very hard to diagnose something we can’t see.
Finity has given you every permutation you should try.
Test them out and report back posting the updated config you are having issues with

I just tested the first code that @Burningstone gave me, and it worked.

#Bed Heat
- id: Bed Heat
  alias: Bed Heat
  trigger:
    platform: time
    at: '21:15:00'
  condition:
    condition: time
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
  action:
    - service: switch.turn_on
      data:
        entity_id: switch.sonoff_10001baf48, switch.sonoff_10007b436c

Sorry If my request was not clear.

Out of curiosity I will test the rest of the provided codes to see what happens.
Thanks again all for your time and effort

I’m not really sure what is different between the first one in your OP and what you say is now working.

It has “data:” in the action but that isn’t needed to make a comma separated list work. To test that I just wrote a test automation and this works just fine:

  - alias: test
    trigger:
      - platform: state
        entity_id: input_boolean.bool_15
        to: 'on'
    condition:
      - condition: state
        entity_id: input_boolean.bool_14
        state: 'on'
    action:
      - service: input_boolean.turn_on
        entity_id: input_boolean.bool_16, input_boolean.bool_17

There had to be something else wrong that you weren’t showing us.

Exactamundo

I also can’t see anything wrong with what OP posted originally :thinking: Just glad it works now for him.

1 Like

Sorry, but I don’t know what was wrong.
Now tested @finity code and it worked too.

#Bed Heat SS
- id: Bed Heat SS
  alias: Bed Heat SS
  trigger:
    platform: time
    at: '14:04:00'
  condition:
    condition: time
    weekday:
      - mon
      - sun
  action:
    - service: switch.turn_on
      entity_id: switch.sonoff_10007b436c
    - service: switch.turn_on
      entity_id: switch.sonoff_10001baf48

I installed the second switch (sonoff outlet) yesterday. I tried a few times with different codes but nothing worked. I don’t know why today it is working.

ok, right now I am at work but I can see that both switches turned on. I just tried my original code and both switches turned on…

Really sorry for your time. Right now I am not sure why it wasn’t working. I assume that I didn’t reload automations when I changed the code? So that’s why it turned on only the first one.

Just find out what the problem is. Although HA turns on both switches there is a problem with the one I installed yesterday. It turns off in HA after 2-3 minutes. In the sonoff app I can see that its not turning on.
So I have to reinstall the switch and I hope that it will work ok