Help on simple switch automation

just trying to get a wall switch that does nothing but send a z-wave signal to my HA raspberry pi to turn on a light plugged into a z-wave outlet. So simple it’s driving me nuts.

Here’s the code that won’t work:

  • id: ‘1553032867518’
    alias: treadmill
    trigger:
    • entity_id: switch.zooz_unknown_type_b111_id_1e1c_switch
      from: ‘off’
      platform: state
      to: ‘on’
      condition: []
      action:
    • service: switch.toggle
      entity_id:
      switch.intermatic_unknown_type_0001_id_0003_switch

I’ve tried switch.on and/or switch off.

I see both in the log when I press the wall switch or turn the light on at the outlet manually…I just can’t code it to work on home assistant (works well, but slowly on the WINK I’m trying to replace).

can someone help me…

Please use code blocks and syntax highlighting. It makes reading configs and code so much easier.

I tried to clean it up. But without further infos it might be difficult.

- alias: treadmill
  initial_state: true
  trigger:
    platform: state
    entity_id: switch.zooz_unknown_type_b111_id_1e1c_switch
  action:
    service: switch.toggle
    entity_id: switch.intermatic_unknown_type_0001_id_0003_switch

Did you try to toggle the light from the devs service menu to see if that part works?

image

yes, I can toggle the light from HAAS and I can see the switch changing states in the log as well.

My understanding is that I am setting a trigger so that when the state of the switch changes (whether it be 1/0 or on/off), the action will be to toggle the outlet (switch)…but that’s not happening,

Note: I have two entries for the switch and the outlet…one zwave, one as a switch. They both have the same names.

I copied your code…restarted haas and it still doesn’t work.

What further info can I even give? HAAS is seeing the manual change and logging it…but I can’t get automation to work…and I can’t imagine a simpler script. Obviously, I’m missing something. I have not set polling…could that be the issue?

Just to be sure, switch.zooz_unknown_type_b111_id_1e1c_switch is the wall switch and switch.intermatic_unknown_type_0001_id_0003_switch is the relay that you want to toggle, is that correct? Can you toggle both via the services menu in the dev tools?

That’s correct…and yes I can toggle both via services and see that they are toggled looking at states and looking at the lamp connected to the intermatic outlet.

I tried setting up a simple trigger based on time of day and setting action switch.toggle and that didn’t work either. It’s like automation isn’t running. I can do anything manually, but I can’t tie two things together…time:action or event: action.

Each time I make changes, I check config and reload automations. I’ve also tried restarting the server.

Clearly I’m missing something very basic.

I am using a aeotec z-stick gen5 and it shows as ready in the log. If I manually push the switch on/off or manually turn on/off the outlet, that shows in the log…so z-wave is clearly working.

Thanks for sticking with me on this…very frustrating!

Are you sure that your automations are actually loaded?

I just found the problem…and you are correct, automations were not loaded. For some reason, the following was not included in coniguration.yaml:

automation: !include automations.yaml

and apparently that is not the default, as one would think from the documentation.

Your code now works perfectly…

Thanks for your help…now I an convert from the Wink.

1 Like