How to define a helper as a "real" switch? (not a input_boolean.helper_name)

HI,
I am trying to run a script based on a triggered “on” virtual switch and use this switch in an ESPHome that only supports “real” switches.

I do have an M5 dial and it works perfectly when switching on “real” lights. I am using GitHub - SmartHome-yourself/m5-dial-for-esphome: M5 Stack Dial - Custom Component for ESPHome

As I want to start a working script with the M5 I hoped that I can use a “Helper Switch”, but this does not work. I assume (no clue) this is the case, because the helper switch shows up as

input_boolean.rolladen_morgens

entity, and in the M5 integration I can use only “real”

switch.shelly1_f41cf7_deckenlicht

(at least the shelly works, the helper in the M5 not). What happens:

If I trigger the input_boolean helper in HA, than the M5 dial recognizes this and goes according to the state on/off.
But if I press the helper switch in the M5 nothing happens.

I found

and it seems to me, as I need the “other way round”. (To make a Helper Button be a switch).

Can someone either confirm that this needs a change in the M5 firmware, or can someone tell me how to solve this problem? I think I need a way to make a “real” helper switch, that reacts to the “torn_on/turn_off”, and this is nothing what I found with googling.

thank you
Juergen

Step back and explain what you’re actually trying to accomplish because I don’t think you’ve got the right idea on how to use the helper.

So what’s your goal?

1 Like

Wrap your input_boolean in a template switch.

switch:
- platform: template
  switches:
    rolladen_morgens:
      friendly_name: Rolladen Morgens
      value_template: "{{ is_state('input_boolean.rolladen_morgens', 'on') }}"
      turn_on:
      - service: homeassistant.turn_on
        target:
          entity_id: input_boolean.rolladen_morgens
      turn_off:
      - service: homeassistant.turn_off
        target:
          entity_id: input_boolean.rolladen_morgens
3 Likes

Hi @petro,
awesome! Works perfectly. Not I can turn on my covers on the morning with the M5.

many thanks

Juergen

Hi @NathanCu,
the goal is to use an M5 to trigger a script in HA. As the M5 implementation I showed did not support directly calling a script, I thought to use a “switch”, as a “switch” is supported in the M5 implementation.
But the Helper Switch that was generated is a bloolean, which could not be used by the M5 implementation.
The template that @petro showed works as I hoped it would work directly with the helper.

thanks
Juergen

Hi @petro ,
after the Update to 2024.10.2 it gives to following warnings/error:

What can I change?

thanks
Juergen

hover over each portion of the line, it will tell you what to change.

For all versions after 2024.10.0 use

switch:
- platform: template
  switches:
    rolladen_morgens:
      friendly_name: Rolladen Morgens
      value_template: "{{ is_state('input_boolean.rolladen_morgens', 'on') }}"
      turn_on:
      - action: homeassistant.turn_on
        target:
          entity_id: input_boolean.rolladen_morgens
      turn_off:
      - action: homeassistant.turn_off
        target:
          entity_id: input_boolean.rolladen_morgens

@petro ,
Thank you for teaching me a little fishing :slight_smile:

https://quoteinvestigator.com/2015/08/28/fish/

I am so overwelmed by HA, but even as an interested newbie it is hard to cope with the update and change frequency. Thanks for your help!

thanks
Juergen