Going from Veraedge to HA, some questions: virtual switch, on/off loop

At the moment I use a Veraedge for about 6 years, and have plugin/app Reactor which is a very powerfull tool to do automations. At the moment I have HA running in docker on my Synology NAS and connected a conbee 2 to pay with Zigbee.

I have some questions/findings. In Vera you can use/create virutal switches. I use this virtual switch to start an automation which sets my heater on for 10 minutes and of for 15 minutes in a loop, as long as the virtual switch is set to on.

I was a bit disappointed not to find a virtual switch in HA, but only the binary helper. Which is not completely the same, as it toggles. I know Homey also has virtual switches.

How can I solve this in HA?

A switch, virtual or otherwise, is on or off. The binary helper (aka input_boolean) is also on or off.

They’re functionally the same.

It sounds like your problem is how you’re tackling the automation cycle. Try this:

automation:
- alias: 'Turn it on'
  trigger:
  - platform: state
    entity_id: input_boolean.whale_watcher
    to: 'on'
  - platform: state
    entity_id: switch.heater
    to: 'off'
    for: '00:15:00'
  condition:
  - condition: state
    entity_id: input_boolean.whale_watcher
    state: 'on'
  - condition: state
    entity_id: switch.heater
    state: 'off'
  action:
  - service: switch.turn_on
    entity_id: switch.heater

- alias: 'Turn it off'
  trigger:
  - platform: state
    entity_id: input_boolean.whale_watcher
    to: 'off'
  - platform: state
    entity_id: switch.heater
    to: 'on'
    for: '00:10:00'
  condition:
  - condition: state
    entity_id: switch.heater
    state: 'on'
  action:
  - service: switch.turn_off
    entity_id: switch.heater

The first automation turns on the heater when either:

  • the input_boolean is turned on
  • the heater has been off for 15 minutes and the boolean is on

The second automation will turn off the heater when either:

  • the input_boolean is turned off
  • the heater has been on for 10 minutes
1 Like

Cool, thanks, going to play with this this evening!

Adjusting your example, but in my setup I only can use the Conbee II as a service switch to turn on/off.
I changed the heater switch to use a zigbee ninary switch.

And I need to switch on a zigbee binary switch. Am I doing something wrong?

You’re looking for devices, look for an entity instead.

I must be doing something wrong, but then I also see only this:

image

I got it, I had to change the action to use the device.

- id: '164236275412'
  alias: Turn it on
  trigger:
  - platform: state
    entity_id: input_boolean.whale_watcher
    to: 'on'
  - platform: state
    entity_id: light.icasa_iczb_iw11sw_9ba1c0fe_on_off
    to: 'off'
    for:
      hours: 0
      minutes: 0
      seconds: 5
  condition:
  - condition: state
    entity_id: input_boolean.whale_watcher
    state: 'on'
  - condition: state
    entity_id: light.icasa_iczb_iw11sw_9ba1c0fe_on_off
    state: 'off'
  action:
  - type: turn_on
    device_id: 7d5a2d13204d22d77455e990d735c9e5
    entity_id: light.icasa_iczb_iw11sw_9ba1c0fe_on_off
    domain: light
- id: '847236275412'
  alias: Turn it off
  trigger:
  - platform: state
    entity_id: input_boolean.whale_watcher
    to: 'off'
  - platform: state
    entity_id: light.icasa_iczb_iw11sw_9ba1c0fe_on_off
    to: 'on'
    for:
      hours: 0
      minutes: 0
      seconds: 5
  condition:
  - condition: state
    entity_id: light.icasa_iczb_iw11sw_9ba1c0fe_on_off
    state: 'on'
  action:
  - type: turn_off
    device_id: 7d5a2d13204d22d77455e990d735c9e5
    entity_id: light.icasa_iczb_iw11sw_9ba1c0fe_on_off
    domain: light

In this case, when I set the helper switch ON, the isaca switch goes into a loop going ON and OFF for 5 seconds.

Thanks!

EDIT:
How to prevent the this: When I turn On icasa switch directly, it also goes to Off after 5 seconds.

Ah yes, you said switch so I assumed switch, not light.

You have to match the service to the entity - light services on light entities, etc