Switch Manager - New refined switch integration to manage your switches

So, not sure what that was all about, but sure glad it seems to be over…:+1:

1 Like

To be honest I wasn’t even sure what it was about, I just personally don’t have time for rude condescending individuals protesting and parading around like an activist on a mission. :upside_down_face:. If they would approach in a more civilised manner and not dish out uneducated claims while refraining from nothing but negativity then I be more than happy to provide more insight and better educate/help them.

It is what it is.

1 Like

Right, so using call service to turn a light on and off is simple enough. But if I want to use a rotating switch I can’t call a service that steps down (I can use “light on” service to step up).
Another reason for needing to use the device that exposes these automatically rather than trying to figure out a crazy workaround. the integration needs to support device, service is limited, complicated, time consuming and unnecessary,

Create a script for those things, it’s not hard, I mean you are tech savvy. I’m literally using the philips hue dial for rotation and works a treat for increasing brightness or if I hold down a button to activate a modifier where it would instead change the volume of the TV etc. Infact having a script for this would also ensure those devices that wouldn’t support it natively would do so.

But if this is not your cup of tea then you’re welcome to find alternative solutions. But I’m happy to help by providing a working script or something if you’re inclined.

You can step down by adding a -

The whole point of your integration is to make button and dial implementation simple without the need of automations? Right?
I can do it with an automation by calling the device (not the service) without the need for a script. By not using the device you are limiting your integration. Not an opinion, that’s counting.

Actually the whole main point and like stated above in the initial post it was mainly to remove clutter while having something a more mobile app like interface. How is it limiting the integration if Devices doesn’t work? I don’t see how using a script, call service, triggering an automation within the actions of a button is limiting, they can literally do everything the Device action can do and more.

Also don’t take this as something I’m ignoring, it’s just not something that’s high on my priority list to attend to right now and explore what’s going on. It’s literally just been known to be an issue earlier today but your needs seems to be immediate which sorry to say I can’t accommodate (in the context you need a Device action and nothing else)

Hello, I have Ikea Styrbar switch and 4 scripts for a ceiling fan control, speed 1 to 3 and off button. How can I do a sequence so if I press right button, it calls for script that sets the fan speed to 1, if I press it again, it calls for speed 2 script, and again on next press for speed 3?
Basically I would like to use left and right buttons to control the fan speed, speed up and down in circle.
Any recomendations on how to do this?

Brilliant work @Sian, love this, and I think it should be natively part of Home Assistant. Just makes configuring switches so much more intuitive. Saves a lot of time looking for blueprints and having a full list of automations just for switches.

I know some rude fella above was complaining about not having configuration in yaml, but I must say I think it would be a good if we could. I have in the past worked off the automation.yaml to fix entity names and copy code across automations, and I think if there is a way to store the configuration of the configured switches in yaml, it will be even better. Not a dealbreaker for me, though, loving what’s already there :slight_smile:.

1 Like

I think guy above doesn’t realise there’s an actual file for the saved data, his concerns didn’t question like yours which is valid because I personally do alot of what you do with yaml. But to keep with the design principles of integrations within Home Assistant, the saved data is inside your config/.storage path as json, while JSON and YAML are very similar, it is saved in json because Home Assistant already has libraries and tools which process this in a more fluent manner. You can edit the JSON as you please but make sure it’s still valid when saved.

1 Like

You already have service calls for fan.increase_speed and service: fan.decrease_speed but if you’re referring to “cycle” so from 3 back to 1 then you would just need to write a simple script that checks if the fan speed is already 100% then set fan speed to the 1st step and vise-versa for reverse.

Below is a sample script I made for my bedroom fan. This script will cycle the fan speed then back to off if it’s reached 100% you can make some changes to suit your needs.

alias: Cycle Fan Speed Then Back To Off
fields:
  entity:
    name: Fan
    required: true
    selector:
      entity:
        domain: fan
sequence:
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ states(entity) == 'off' }}"
        sequence:
          - service: fan.turn_on
            target:
              entity_id: "{{ entity }}"
            data:
              percentage: "{{ state_attr(entity, 'percentage_step') }}"
      - conditions:
          - condition: template
            value_template: "{{ state_attr(entity, 'percentage') == 100 }}"
        sequence:
          - service: fan.turn_off
            target:
              entity_id: "{{ entity }}"
    default:
      - service: fan.increase_speed
        target:
          entity_id: "{{ entity }}"
mode: single
icon: mdi:fan

Thanks @Sian

Found the file, handy if I need to do bulk corrections :slight_smile:

Oh yea and I agree with service calls instead of devices unless there are no service calls. It just makes more manageable longer term. I had to move bulbs, swap switches between rooms and replace some all together, if I had used devices, would have taken me much longer to go into automations to figure out which ones I needed to change.

Been in tech (telecommunications) over 2 decades now and I’ve learned the hard way, just because you have multiple ways of doing a single task, there is only 1 right way of doing it :slight_smile: (*Most of the time)

1 Like

@Sian I am getting these warnings since I installed, everything still working fine though

Logger: custom_components.switch_manager.const
Source: helpers/script.py:1783
Integration: Switch Manager (documentation, issues)
First occurred: 5:36:22 PM (25 occurrences)
Last logged: 8:30:43 PM
switch_manager_34_1_0: Already running
switch_manager_28_1_0: Already running
switch_manager_28_3_0: Already running

Try restarting HA and see how that goes

Hi Sian,

What a great integration did you develop! I am just figuring out HA have it running with Zigbee2MQTT all my devices are connected via a Zigbee dongle.

I have two questions:

  1. I want to make my remote (Hue Dimmer switch v2) cycle through scenes.
    My scenes are in HA but also in Z2M (but they aren’t exposed to HA so not using them currently). My Hue Dimmer is bound to a group of lightbulbs via Z2M.

Do you have a good example on how to do this? (I currently have it implemented with a script cycling through an input selector. But it’s not really clean and most of all not very reliable.
To my understanding this should be easily implemented in Switch Manager. Would be great to have an example!

  1. I also have an Ikea E1744 controller that is not recognised with auto-discovery. I manually entered the MQTT Topic which I got from the MQTT Tool as you mentioned in the documentation but nothing happens when pressing a button. I noticed that the blueprint uses different values than the ones I see when checking the payload with MQTT Tool (legacy is set to false btw). So I changed the blueprint but that also didn’t help. (I didn’t restart I just realised). I got the same values as mentioned in: Correct IKEA E1744 Z2M action keys by qp68 · Pull Request #179 · Sian-Lee-SA/Home-Assistant-Switch-Manager · GitHub

“I think I have a solution for your point 1. I just created a post last week explaining my script that I use to toggle through my Hue scenes. It also selects random scenes and has a smooth transition. You can then easily select the script in the Switch Manager as an action/sequence. Here is the link: https://community.home-assistant.io/t/hue-scenes-random-selection-with-smooth-transition/636319.

1 Like

**EDIT: I reinstalled everything from scratch, and it’s working perfectly now. Leaving this here in case anyone else has issue in future

Hi,

First of all, thanks for your work creating this. I’m new to HA and I think this will help me setup my switches in a neat & easy to manage way.

I have 2 different remote models that I’m testing with, and I can get neither of them working with brightness up on button hold.

I’ll focus on the newer of the two remotes: Ikea E2002, STYRBAR

I have added the remote in Switch Manager. I can configure short press fine.
The issue is with long press.
I have a light that I want to increase brightness when I hold the top button. I use the visual editor to pick the “Light: Turn on” service for the light. The YAML is:

service: light.turn_on
data:
brightness_step: 20
target:
device_id: 95167ff6194e1268240076deb6fa4099

When I hold the button, the “HOLD” tab flashes. The light increases by 20 steps, once. It doesn’t continue to increase.

In the logbook I see: (In descending order timewise)

IkeaSquareRemoteSpare Action
15:38:04 - 4 seconds ago
IkeaSquareRemoteSpare Action changed to brightness_stop
15:38:04 - 4 seconds ago
IkeaSquareRemoteSpare Action
15:37:57 - 11 seconds ago
IkeaSquareRemoteSpare Action changed to brightness_move_up
15:37:57 - 11 seconds ago

So, I can see the hold of the button is registered for the 7 seconds I held it for, but the brightness of the light is only increasing by 20 steps, and not repeating.

I’ve included the Z2M logs below too in case they can help.
Any ideas please?

I’m wondering if there’s something amiss with my configuration because it seems to “just work” for other users.

Thanks so much for your time.
Cork

The Zigbee2MQTT logs show:

2023-11-14 15:41:27MQTT publish: topic 'zigbee2mqtt/IkeaSquareRemoteSpare', payload '{"action":"brightness_move_up","action_rate":83,"battery":5,"linkquality":212,"update":{"installed_version":65572,"latest_version":581,"state":"idle"},"update_available":null}'

Info 2023-11-14 15:41:27MQTT publish: topic 'zigbee2mqtt/IkeaSquareRemoteSpare', payload '{"action":"","battery":5,"linkquality":212,"update":{"installed_version":65572,"latest_version":581,"state":"idle"},"update_available":null}'

Info 2023-11-14 15:41:27MQTT publish: topic 'zigbee2mqtt/IkeaSquareRemoteSpare', payload '{"action":"","battery":5,"linkquality":212,"update":{"installed_version":65572,"latest_version":581,"state":"idle"},"update_available":null}'

Info 2023-11-14 15:41:27MQTT publish: topic 'zigbee2mqtt/IkeaSquareRemoteSpare', payload '{"action":"","battery":5,"linkquality":212,"update":{"installed_version":65572,"latest_version":581,"state":"idle"},"update_available":null}'

Info 2023-11-14 15:41:27MQTT publish: topic 'zigbee2mqtt/IkeaSquareRemoteSpare', payload '{"action":"","battery":5,"linkquality":212,"update":{"installed_version":65572,"latest_version":581,"state":"idle"},"update_available":null}'

Info 2023-11-14 15:41:27MQTT publish: topic 'zigbee2mqtt/IkeaSquareRemoteSpare/action', payload 'brightness_move_up'

Info 2023-11-14 15:41:27MQTT publish: topic 'zigbee2mqtt/IkeaSquareRemoteSpare/action', payload 'brightness_move_up'

Info 2023-11-14 15:41:27MQTT publish: topic 'zigbee2mqtt/IkeaSquareRemoteSpare/action', payload 'brightness_move_up'

Info 2023-11-14 15:41:27MQTT publish: topic 'zigbee2mqtt/IkeaSquareRemoteSpare/action', payload 'brightness_move_up'

Info 2023-11-14 15:41:27MQTT publish: topic 'zigbee2mqtt/Bulb - tall light sitting room', payload '{"brightness":254,"color_mode":"color_temp","color_temp":383,"color_temp_startup":454,"linkquality":100,"power_on_behavior":"on","state":"ON","update":{"installed_version":604050705,"latest_version":604050705,"state":"idle"},"update_available":null}'

Info 2023-11-14 15:41:34MQTT publish: topic 'zigbee2mqtt/IkeaSquareRemoteSpare', payload '{"action":"brightness_stop","battery":5,"linkquality":204,"update":{"installed_version":65572,"latest_version":581,"state":"idle"},"update_available":null}'

Info 2023-11-14 15:41:34MQTT publish: topic 'zigbee2mqtt/IkeaSquareRemoteSpare', payload '{"action":"","battery":5,"linkquality":204,"update":{"installed_version":65572,"latest_version":581,"state":"idle"},"update_available":null}'

Info 2023-11-14 15:41:34MQTT publish: topic 'zigbee2mqtt/IkeaSquareRemoteSpare', payload '{"action":"","battery":5,"linkquality":204,"update":{"installed_version":65572,"latest_version":581,"state":"idle"},"update_available":null}'

Info 2023-11-14 15:41:34MQTT publish: topic 'zigbee2mqtt/IkeaSquareRemoteSpare', payload '{"action":"","battery":5,"linkquality":204,"update":{"installed_version":65572,"latest_version":581,"state":"idle"},"update_available":null}'

Info 2023-11-14 15:41:34MQTT publish: topic 'zigbee2mqtt/IkeaSquareRemoteSpare', payload '{"action":"","battery":5,"linkquality":204,"update":{"installed_version":65572,"latest_version":581,"state":"idle"},"update_available":null}'

Info 2023-11-14 15:41:34MQTT publish: topic 'zigbee2mqtt/IkeaSquareRemoteSpare/action', payload 'brightness_stop'

Info 2023-11-14 15:41:34MQTT publish: topic 'zigbee2mqtt/IkeaSquareRemoteSpare/action', payload 'brightness_stop'

Info 2023-11-14 15:41:34MQTT publish: topic 'zigbee2mqtt/IkeaSquareRemoteSpare/action', payload 'brightness_stop'

Info 2023-11-14 15:41:34MQTT publish: topic 'zigbee2mqtt/IkeaSquareRemoteSpare/action', payload 'brightness_stop'

I’m just posting simply to emphasise my views about device id’s instead of using just entity id’s and follow on with @YellowMonster76 (not trying to start a debate or flame war etc.).

I think the latest Home Assistant update and the following issue Automations referencing non-existing devices do not work after installing 2023.11.0b1 · Issue #102937 · home-assistant/core · GitHub emphasises how messy device id’s can be. If people don’t wan’t headaches in the future while also being in control of their “system” then I really encourage everyone to try and use enitity id’s and service calls when possible. But again it’s a personal choice but my personal efforts in tackling device actions in future will be less prioritised.

Another good read I found just now Why and how to avoid device_ids in automations and scripts - #4 by sebby

Credit to the developer for making this fantastic integration, hopefully we’ll see something similar implemented in HA natively. :clap:

2 Likes

Has anyone made a blueprint for the Ikea Shortcut button under ZHA? Its possibly a bit beyond my ability to be truthful!