Switch Manager - New refined switch integration to manage your switches

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

I could not find any errors or issues in the logs. Maybe it is because the switches are “bound” to the coordinator?
Since I couldn’t get the Switch Manager to work I did one of the switches by binding it directly to the corresponding lamps in the Zigbee2mqtt addon.
But Switch Manager would be more convenient.

I was attempting this by using the built-in blueprints btw.

With the device being Z2M, It uses the HA’s MQTT integration and listens for those messages internally, so if MQTT works fine in HA then the integration should be fine. Also if you see the button and action flash green then it’s picking up the device and button presses.

With there being no error in logs and I can’t replicate this issue (nor has this been raised by others in the issue tracker on github) I can’t really provide a solution right now. If something pings with the same issue by someone else or you discover something then I might be able to find a pattern or point where the issue is.

1 Like

I’ve only just discovered this today. An amazing idea and things will be so much tidier after I get it working on my HA instance. Can get switches in using both ZHA and Zigbee2MQTT. Buttons go “green” when they are pushed or turned, so they are corrected mapped. But the action doesn’t happen, in my case a toggle of a light or dimming adjustment of a light. If I run the toggle or dim action manually in the lower section of the screen (ellipses followed by run), that works. I can’t work out what the missing link and why it is not working. any ideas?

1 Like

I posted below, only to realise you have the same issue as I have. Buttons go green, but the action doesn’t happen.

1 Like

Does the action also go green? (action title, not the action sequence)

Interesting. I just got notified of an Update to 1.23 and will try again with that version.

Same issue with the new release. I enabled debug logging and got some errors.

File “/usr/local/lib/python3.11/site-packages/voluptuous/schema_builder.py”, line 433, in validate_mapping
raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: not a valid value for dictionary value @ data[‘entity_id’]
2023-09-09 15:40:52.508 DEBUG (MainThread) [custom_components.switch_manager.const] Running sequence for switch:0 button:0 action:0
2023-09-09 15:40:52.509 INFO (MainThread) [custom_components.switch_manager.const] switch_manager_0_0_0: Running switch_manager script
2023-09-09 15:40:52.509 INFO (MainThread) [custom_components.switch_manager.const] switch_manager_0_0_0: Executing step device automation
2023-09-09 15:40:52.510 ERROR (MainThread) [custom_components.switch_manager.const] switch_manager_0_0_0: Error executing script. Invalid data for device at pos 1: not a valid value for dictionary value @ data[‘entity_id’]
2023-09-09 15:40:52.512 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 1579, in async_run
return await asyncio.shield(run.async_run())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 420, in async_run
await self._async_step(log_exceptions=False)
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 470, in _async_step
self._handle_exception(
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 493, in _handle_exception
raise exception
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 468, in _async_step
await getattr(self, handler)()
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 720, in _async_device_step
await device_action.async_call_action_from_config(
File “/usr/src/homeassistant/homeassistant/components/device_automation/action.py”, line 71, in async_call_action_from_config
await platform.async_call_action_from_config(hass, config, variables, context)
File “/usr/src/homeassistant/homeassistant/components/light/device_action.py”, line 76, in async_call_action_from_config
await toggle_entity.async_call_action_from_config(
File “/usr/src/homeassistant/homeassistant/components/device_automation/toggle_entity.py”, line 123, in async_call_action_from_config
await hass.services.async_call(
File “/usr/src/homeassistant/homeassistant/core.py”, line 1935, in async_call
processed_data: dict[str, Any] = handler.schema(service_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/voluptuous/validators.py”, line 232, in call
return self._exec((Schema(val) for val in self.validators), v)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/voluptuous/validators.py”, line 355, in _exec
raise e if self.msg is None else AllInvalid(self.msg, path=path)
File “/usr/local/lib/python3.11/site-packages/voluptuous/validators.py”, line 351, in _exec
v = func(v)
^^^^^^^
File “/usr/local/lib/python3.11/site-packages/voluptuous/schema_builder.py”, line 272, in call
return self._compiled([], data)
^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/voluptuous/schema_builder.py”, line 818, in validate_callable
return schema(data)
^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/voluptuous/schema_builder.py”, line 272, in call
return self._compiled([], data)
^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/voluptuous/validators.py”, line 229, in _run
return self._exec(self._compiled, value, path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/voluptuous/validators.py”, line 355, in _exec
raise e if self.msg is None else AllInvalid(self.msg, path=path)
File “/usr/local/lib/python3.11/site-packages/voluptuous/validators.py”, line 353, in _exec
v = func(path, v)
^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/voluptuous/schema_builder.py”, line 818, in validate_callable
return schema(data)
^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/voluptuous/schema_builder.py”, line 272, in call
return self._compiled([], data)
^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/voluptuous/schema_builder.py”, line 595, in validate_dict
return base_validate(path, iteritems(data), out)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/voluptuous/schema_builder.py”, line 433, in validate_mapping
raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: not a valid

1 Like

Ok, so let’s take a “ZHA / TuYa 4 Button Scene”. Press button 1 > Both the visual representation of the button 1, top left goes green and so does the text below “PRESS 1”. Nothing else goes green.
The sequence below which is a single toggle does nothing. If I run ran toggle independently, ellipse > run, that works.

1 Like

This is the interesting part… Could you please post (formatted in yaml) the yaml output of your action? Do this by using the kebab menu on the right of the sequence and selecting Yaml Editor.

2 Likes

type: toggle
device_id: 83e44d42825a9ae9fabf1ca2a3b290f2
entity_id: 4b60277396dd4f54c6ac7df5d33f635f
domain: light

1 Like

Seems it might be an issue using device as the action and not service call… Could you try with a service call instead light.toggle.

I would also advise to avoid using device actions and instead always try to use service calls for anything in HA. Targetting entity id’s specifically will always be more reliable and resiliant to changes.

1 Like

That works. So…Service call it is.

1 Like

After having the convo with CommanderROR and discovering he was using the device action causing the issue, could this be the same issue on your end?