zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

Shelly 2PM Gen4 - No input available when Switch in Detached mode

Open ebeng opened this issue 10 months ago β€’ 24 comments

What happened?

As the title goes, I have configured one of the Shelly to be in detached mode Switch, where the relais of the output is not affected from the switch ports on the Shelly. In Z2M I don't see these values being read from the Shelly.

Image

What did you expect to happen?

To have 2 more values available in Z2M to configure

Image

Here should be 2 more values available for the Detached switches as INPUTS

How to reproduce it (minimal and precise)

After the Shelly has been configured with all the options, the Shelly has been completely new onboarded in Z2M, to check still if the values now will be seen.

Zigbee2MQTT version

2.7.1

Adapter firmware version

20240602

Adapter

SLZB-MR4U EFR32MG26

Setup

HAOS on a VM with the Z2M PoE adapters

Device database.db entry

No response

Debug log

No response

Notes

No response

ebeng avatar Jan 14 '26 10:01 ebeng

any one, who could help me out pointing to the right direction?

ebeng avatar Jan 21 '26 07:01 ebeng

In the same boat right now. I read that it apparently can't be done on the zwave version and wondering if this applies to the zigbee as well. No issues over wifi but I really don't want to resort to using it on wifi.

Just found this - Apparently it's going to be featured in v1.8: https://github.com/Koenkk/zigbee2mqtt/issues/26852#issuecomment-3450180940

jordanmasc avatar Jan 24 '26 19:01 jordanmasc

Same way here. I want everything as much as possible to trigger and control over Zigbee.

Hope we can arrange something soon.

ebeng avatar Jan 25 '26 11:01 ebeng

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar Mar 27 '26 00:03 github-actions[bot]

Anyone?

ebeng avatar Mar 27 '26 12:03 ebeng

The feature has landed in the latest beta shelly firmware 2.0.0-beta1: https://shelly-api-docs.shelly.cloud/gen2/changelog/

Image

SebiGo avatar Apr 23 '26 19:04 SebiGo

Thanks!!! @SebiGo I will try to update all of my stuff and see how it goes. Will try to update here with my findings

ebeng avatar May 02 '26 15:05 ebeng

Thanks!!! @SebiGo I will try to update all of my stuff and see how it goes. Will try to update here with my findings

Any luck? I'm not seeing the detached input being exposed on Z2M and I'm on latest 2.0.0 beta version.

araujorm avatar May 11 '26 01:05 araujorm

Thanks!!! @SebiGo I will try to update all of my stuff and see how it goes. Will try to update here with my findings

Any luck? I'm not seeing the detached input being exposed on Z2M and I'm on latest 2.0.0 beta version.

Sorry didnt try it yet. Will do tomorrow!!

ebeng avatar May 15 '26 22:05 ebeng

For me it works with 2.0.0-beta1 on

  • Shelly Mini1PM Gen4
  • Shelly 1PM Gen4
  • Shelly 2PM Gen4

I had to re-interview and reconfigure for the clusters to appear. As far as I understand, the action is only triggered if the device (or switch for 2PM) is in detached mode.

Image

SebiGo avatar May 18 '26 19:05 SebiGo

Anyone know how to react to long press and double click ?

Hydro8 avatar Jun 12 '26 19:06 Hydro8

I was able to get around to working on this tonight and got it working. I'm only using it for toggle in detached mode and haven't figured out the long press or double click yet.

Here's an example hue bulb automation in HA:

alias: New automation
description: ''
triggers:
  - trigger: mqtt
    topic: zigbee2mqtt/0xe4b063fffe63a9b1
    value_template: "{{ value_json.action }}"
    payload: input_1_off
  - trigger: mqtt
    topic: zigbee2mqtt/0xe4b063fffe63a9b1
    value_template: "{{ value_json.action }}"
    payload: input_1_on
conditions: []
actions:
  - type: toggle
    device_id: 16e7f667736d7ebefe6ee58a9fcb9690
    entity_id: 83b298adcb0aeeb5a577b00f66588ed0
    domain: light
mode: single

jordanmasc avatar Jun 14 '26 23:06 jordanmasc

@krobipd thank you! I do believe the next update will include the states of the detached switches to be used? Is that the correct understanding?

I have the Shelly 2PM Gen4 now on 2.0.0-Beta3/2955b998 version... at last...

Image

I did reinterview the Shelly. Did expect 2 more different values.

Image

However within the State on the device, I can see the state_l1 and state_l2 => not sure if this is linked to Output or Input...

Image

ebeng avatar Jul 23 '26 12:07 ebeng

I was able to get around to working on this tonight and got it working. I'm only using it for toggle in detached mode and haven't figured out the long press or double click yet.

Here's an example hue bulb automation in HA:

alias: New automation
description: ''
triggers:
  - trigger: mqtt
    topic: zigbee2mqtt/0xe4b063fffe63a9b1
    value_template: "{{ value_json.action }}"
    payload: input_1_off
  - trigger: mqtt
    topic: zigbee2mqtt/0xe4b063fffe63a9b1
    value_template: "{{ value_json.action }}"
    payload: input_1_on
conditions: []
actions:
  - type: toggle
    device_id: 16e7f667736d7ebefe6ee58a9fcb9690
    entity_id: 83b298adcb0aeeb5a577b00f66588ed0
    domain: light
mode: single

I can see indeed on the Action the following However with the automations when Im putting these to ON or OFF, there is no automations triggered...

image

image

EDIT: had to bind it to the zigbee2mqqt3

It works now!! Nice. Would love to see this as a function like all the others.

ebeng avatar Jul 23 '26 13:07 ebeng

@ebeng Not quite β€” a correction on what to expect:

state_l1 / state_l2 are the two relay outputs (endpoints 1/2). The inputs never appear as separate on/off states over Zigbee: the Input (0)/(1) values your Shelly web UI shows come from the local RPC interface, while on the Zigbee side the firmware only emits events when an input changes (genOnOff on/off/toggle plus genScenes single/double/triple/hold). Those arrive in Z2M as the action entity you already found β€” that is the intended interface, and exactly what you built your automation on. So "2 more values" like in the Shelly UI will not appear with any current converter version; that would need the firmware to expose input state over Zigbee, not just events.

About the manual binding you had to do: the converter's configure step has been setting up exactly those genOnOff/genScenes bindings on the input endpoints (3/4) since April β€” but configure does not re-run by itself on devices that were already paired earlier, which is why your 2PM never got the bindings until you added one by hand.

Our merged PR Koenkk/zigbee-herdsman-converters#12747 addresses exactly that: it bumps the definition version, which tells the application to re-configure already-paired devices automatically. Once a Z2M release ships a converter build that includes that merge, already-paired 2PMs get the bindings without any manual step. Koenkk/zigbee-herdsman-converters#12736 (also merged) additionally fixes switch_mode writes targeting the wrong endpoints in the switch profile. I cannot promise which release will pick them up β€” they are merged on master.

If you want a persistent on/off entity per input in HA, you can derive one from the input_X_on/input_X_off actions (e.g. a template binary sensor) β€” that is the practical route as long as the firmware does not report input state over Zigbee.

krobipd avatar Jul 23 '26 15:07 krobipd

Thank you for the explanation

For now I would have to do with the "payload" option as described above by @jordanmasc

I would like to keep this issue open, until we also got some fixes around from Shelly. (Maybe @teodor-hristov ?)

ebeng avatar Jul 23 '26 16:07 ebeng

Thank you for the explanation

For now I would have to do with the "payload" option as described above by @jordanmasc

I would like to keep this issue open, until we also got some fixes around from Shelly. (Maybe @teodor-hristov ?)

Can you please explain what do you expect to be implemented? Some users requested a feature which is new custom cluster that shares the state of the inputs. Is that what you need? (Sorry for not reading the whole thread, it is pretty long and I got confused)

We got confused by the ZigBee standard due to not supporting such feature.

teodor-hristov avatar Jul 23 '26 17:07 teodor-hristov

Thank you for the explanation

For now I would have to do with the "payload" option as described above by @jordanmasc

I would like to keep this issue open, until we also got some fixes around from Shelly. (Maybe @teodor-hristov ?)

Can you please explain what do you expect to be implemented? Some users requested a feature which is new custom cluster that shares the state of the inputs. Is that what you need? (Sorry for not reading the whole thread, it is pretty long and I got confused)

We got confused by the ZigBee standard due to not supporting such feature.

Yes, I do believe so. At this moment, I cannot "out-of-the-box" assign the Inputs to an automation to say; hey if the input is enabled/on, power on the output on the XYZ-devices....

As one of the guys earlier mentioned some automation code, I can do check on the payload and check on this one. But imagine a lot of non technical person who will not understand this.

My main purpose of this feature is to use it with a garagedoor. The Switch is attached to an NC magnetic sensor. I just want the same device to take care of the garagedoor automation. To open, to close but also to warn me when the door is not closed for longer time of period.

ebeng avatar Jul 24 '26 00:07 ebeng

@teodor-hristov could you update us on that, please? We're talking about exposing Shelly's input state via Zigbee, not just actions. Is it considered for implementation? Are there issues with the standard itself - could you elaborate on that?

YaaZ avatar Aug 14 '26 21:08 YaaZ

@teodor-hristov could you update us on that, please? We're talking about exposing Shelly's input state via Zigbee, not just actions. Is it considered for implementation? Are there issues with the standard itselfβ€”could you elaborate on that?

We are going to implement a feature that gives the input state as a attribute that is reportable and readable. It will be a custom cluster. There is no standard cluster that provides such a feature (reading input state). We could be wrong. If we are wrong, please specify the cluster.

teodor-hristov avatar Aug 17 '26 10:08 teodor-hristov