Switch Manager - New refined switch integration to manage your switches

Perfect, thanks, I just see just see the new release…

@Sian in your intro video you mentioned shortly a smooth brightness adjust script. I am still trying to figure out how could i make the philips smart button to adjust brightness when holding and cycling it. Could you share a video or a tutorial how to implement something like that?

I don’t own the smart switch so I can’t give too much advice but I don’t think the brightness up and down would need a smooth script as the time it takes to goto the next brightness step then the repeat for a “hold” (or however that switch functions with the brightness action) delay would already have the brightness set ready for the next step…

A generic sequence for the action you want for brightness should suffice…

service: light.turn_on
target:
  entity_id: light.living_room_main
data:
  brightness: "{{ state_attr('light.living_room_main', 'brightness') + 10 }}"

change the + to a - for brightness down

Just chiming in to say thanks for your hard work on making this visually appealing and easier to visually create automations. I think this is the foundation of how the some of the rest of the eco-system in HA should go.

2 Likes

Sian, I also just want to say thank you for creating this! I love that this simplifies and organizes all of my hue switch automations/actions. This is so much cleaner than having 4 separate automations cluttering up my automation page!

1 Like

I’m trying to set up a hold action for the Ikea Strybar in ZHA, however for some reason it seems to always get stuck in an endless loop. It could be due to the fact that, as far as I’ve found, the hold_release event for the top and bottom button is the same. The blueprint currently is the following:

name: Ikea Styrbar ZHA
service: ZHA
event_type: zha_event
identifier_key: device_id
buttons:
  ## Not sure why the buttons are back to front and illogical by their numbers??
  - x: 247
    y: 61
    width: 50
    actions:
      - title: press
        conditions:
          - key: command
            value: 'on'
      - title: hold
        conditions:
          - key: command
            value: move_with_on_off
      - title: hold_release
        conditions:
          - key: command
            value: stop_with_on_off

  - x: 442
    y: 248
    width: 50
    actions:
      - title: press
        conditions:
          - key: command
            value: press
          - key: params.param1
            value: '256'
      - title: hold
        conditions:
          - key: command
            value: hold
          - key: params.param1
            value: '3328'
      - title: hold (released)
        conditions:
          - key: command
            value: release
          - key: params.param1
            value: '-7258'
  - x: 245
    y: 434
    width: 50
    actions:
      - title: press
        conditions:
          - key: command
            value: 'off'
      - title: hold
        conditions:
          - key: command
            value: move
      - title: hold_release
        conditions:
          - key: command
            value: stop_with_on_off
  - x: 52
    y: 248
    width: 50
    actions:
      - title: press
        conditions:
          - key: command
            value: press
          - key: params.param1
            value: '257'
      - title: hold
        conditions:
          - key: command
            value: hold
          - key: params.param1
            value: '3329'
      - title: hold (released)
        conditions:
          - key: command
            value: release
          - key: params.param1
            value: '1675'

And the automation it fires:

- wait_template: "{{ data.button_last_state[2].action == 1 }}"
  continue_on_timeout: false
  timeout: "00:00:20"
- service: notify.persistent_notification
  data:
    message: hold pressed
    title: "{{ data.button_last_state[2].action }}"
- repeat:
    until:
      - condition: template
        value_template: "{{ data.button_last_state[2].action != 1 }}"
    sequence:
      - service: light.turn_on
        data:
          brightness_step_pct: -5
        target:
          entity_id: light.bed_lights
      - delay:
          hours: 0
          minutes: 0
          seconds: 0
          milliseconds: 50
- service: notify.persistent_notification
  data:
    message: hold pressed stop
    title: "{{ data.button_last_state[2].action }}"

I left the notifications in there as a check, however the last notify action is never fired. Attaching one to the hold_release action does fire two events (since both the up and down button are seen as not being held anymore. Do you happen to have an idea as to what’s causing this? There are also multiple events fired for each button press, perhaps that could also be causing issues, though I am not sure how to set the debounce in ZHA.

Also, massive thanks for this integration! The interface is incredible and it’s been a joy to work with. A lot clearer than building from automations :smiley:

Hi, can I set the actions for double or triple press on the hue remote dimmer via z2m? I can only see init, press, hold and hold release

Z2M doesn’t support double or triple press for the Hue Dimmers

2 Likes

Another satisfied user here. I’ve been transferring all my devices to ZHA and at the same time adding them to Switch Manager, saving me up to 4 automations wasting space in my list.
This should really be added to HA, although I’ve seen how much work/time it takes to get an integration added in there. In the meantime I’ll keep adding blueprints for my devices.Great work!

+1 for the feature request to copy switches, I’ve got a lot of the same button that does basically the same things every time but in different rooms, so if I could just duplicate it and only change the room/light it acts on would save some time. Or alternatively a “edit as YAML” button for the entire switch so I can copy-paste that into a new switch. That might be easier to make.

1 Like

I’m looking forward to being able to use this Integration one day, but currently all my devices are only available via Zigbee2mqtt and I use ZHA… Any idea when the likes of IKEA 5 button remotes will be available under ZHA? Also, the Xiaomi round buttons?

I don’t have one of those but I’m also busy converting the IKEA buttons that I do have to ZHA format. It’s actually pretty easy. Copy the z2m blueprint to a new one, dave-zha-ikea-tradfri-remote.yaml for example, now take an existing ZHA template to see the format you need for ZHA events, then check the event monitor in Developer options to see what exactly happens when you press each button.
Most likely each button will just give command: on for a specific endpoint and cluster id. That should get you the basic press events. Then for hold and release you do the same depending on the exact payload.

1 Like

I’m looking at a menu option within the editor of a switch where you can copy from an existing switch of the same blueprint. I will also add a toggle option to also copy the variables from the switch. This should then have a copy of the switch then allow to easily change a variable for eg target entity etc.

2 Likes

This is Superb!. THANKYOU

I know very little about the back-end of all this, but am beavering away to try to help out - i’ve added the ERS-10TZBVK-AA to Github, i’ll work on the more complicated ‘command mode’ of that over the next few weeks.

A question
Is it possible to ‘auto populate’ the entity device ID’s to save them having to be selected each time for each action of the switch

i.e. either select them once,
then every other function has the same selection, which just needs a minor tweak to change it’s purpose and / or an alternate device

The selections already auto populate the action to ‘Turn off’

i.e. The workflow I imagine When Selecting New Switch
Dialogue box comes up with ‘Rename’
Dialogue box comes up with ‘identifier’ (for the MQTT ones at least)
NEW Dialogue box pops up with ‘Action’ (here you chose the desired target (in my case, Device, Bed Lamp)
Now when you select Any of the switch functions, the Squence is already filled out…

An alternate way to achieve something similar…
For each Button option of the switch, have a ‘copy fprevious button’ tick box that copies the button before it.

This way, you can simply scroll up / down in the menu of actions to enable the feature, rather than select each time
Like this below

You can’t technically auto populate without first referencing because it has no idea what the switch is intended to be used for nor the actions the user wishes to use. So if you want to reuse the device id after setting once then use the variables dialog and reference that variable in your actions/sequences.

As pointed out in the post above yours, I’ll be looking to implement a copy from option to copy previous switches sequences and variables into the current one.

1 Like

Thanks for that.
by ‘auto populate’ - i mean to make an assumption of what the purpose was, i.e. a default of a light bulb device…and first switch is populated with entity ‘on’ but, maybe that’s not the best solution…

for the ‘copy previous button’ - i’d mis-interpreted your previous statement and assumed you’d only be copying whole switches , not buttons within switches!

Again, thankyou for whole Switch manager add-on, it’ll make things so much easier

Hi, I’m interested in using the moes knob, i’ve seen on git that the request is merged but the master version not updated yet. I’ve downloaded the files (Moes Smart Knob AKA ERS-10TZBVK-AA) and added the 2 files (png and yaml) in the directory but is not showing up as a choice in the switch manager, how can I solve?
I’ve already rebooted different times.

I am trying to write a blueprint for a Sengled smart light switch which is similar in appearance to a philips hue dimmer switch but the dim up and down buttons provide events like the following:

event_type: zha_event
data:
  device_ieee: b0:ce:18:14:03:5d:f6:f4
  unique_id: b0:ce:18:14:03:5d:f6:f4:1:0x0008
  device_id: c28ca694da7a40b07a177b2543c8efa3
  endpoint_id: 1
  cluster_id: 8
  command: step
  args:
    - 0
    - 1
    - 0
  params: {}

The only way to differentiate between up and down is based on the three values after args:. How do I reference the args: list in the blueprint?

Thanks

I am struggling to get this working.

I have Zigbee2mqtt running and can add my Switches there, and can then see them (and check their functionality as well).

Now, if I take one of those switches and map something simple like “if I press the main button then toggle this lamp” nothing happens. Switch Manager reports “button pressed” but the lamp never turns on or off.
If I do the same in a HA Automation, then it works just fine. Am I missing a step somewhere…

Need Help working on ZHA Tradfri Remote · Issue #62 · Sian-Lee-SA/Home-Assistant-Switch-Manager · GitHub should help you out.

Is there anything in your logs? are you using a blueprint from the integration or your own made one?

1 Like