zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

[New device support]: Shelly 1PM Mini Gen4

Open marce14-git opened this issue 8 months ago • 64 comments

Link

https://www.shelly.com/products/shelly-1pm-mini-gen4

Database entry

{"id":230,"type":"Router","ieeeAddr":"0x7c2c67fffe7b8fd4","nwkAddr":56139,"manufId":5264,"manufName":"Shelly","powerSource":"Mains (single phase)","modelId":"Mini1PM","epList":[1,239,242],"endpoints":{"1":{"profId":260,"epId":1,"devId":81,"inClusterList":[0,3,4,5,6,2820,1794],"outClusterList":[],"clusters":{"genBasic":{"attributes":{"modelId":"Mini1PM","manufacturerName":"Shelly","powerSource":0,"zclVersion":8}},"genOnOff":{"attributes":{"onOff":0}},"haElectricalMeasurement":{"attributes":{"acPowerDivisor":100,"acPowerMultiplier":1,"acCurrentDivisor":100,"acCurrentMultiplier":1,"acVoltageDivisor":100,"acVoltageMultiplier":1,"acFrequency":5002,"activePower":0,"rmsCurrent":0,"rmsVoltage":22514,"acFrequencyMultiplier":1,"acFrequencyDivisor":100}},"seMetering":{"attributes":{"divisor":1000000,"multiplier":1,"currentSummReceived":0,"status":0}}},"binds":[{"cluster":6,"type":"endpoint","deviceIeeeAddress":"0x00124b0031d80810","endpointID":1},{"cluster":2820,"type":"endpoint","deviceIeeeAddress":"0x00124b0031d80810","endpointID":1},{"cluster":1794,"type":"endpoint","deviceIeeeAddress":"0x00124b0031d80810","endpointID":1}],"configuredReportings":[{"cluster":6,"attrId":0,"minRepIntval":0,"maxRepIntval":65000,"repChange":1},{"cluster":2820,"attrId":1291,"minRepIntval":10,"maxRepIntval":65000,"repChange":500},{"cluster":2820,"attrId":1288,"minRepIntval":10,"maxRepIntval":65000,"repChange":5},{"cluster":2820,"attrId":1285,"minRepIntval":10,"maxRepIntval":65000,"repChange":500}],"meta":{}},"239":{"profId":49153,"epId":239,"devId":8193,"inClusterList":[64513,64514],"outClusterList":[],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"zclVersion":8,"interviewCompleted":true,"meta":{},"lastSeen":1742826019462}

Zigbee2MQTT version

2.1.3

Comments

I followed the Guide at the Add new device page and created the automatic external converter

External definition

const m = require('zigbee-herdsman-converters/lib/modernExtend');

const definition = {
    zigbeeModel: ['Mini1PM'],
    model: 'Mini1PM',
    vendor: 'Shelly',
    description: 'Automatically generated definition',
    extend: [m.deviceEndpoints({"endpoints":{"1":1,"239":239}}), m.onOff({"powerOnBehavior":false}), m.electricityMeter()],
    meta: {"multiEndpoint":true},
};

module.exports = definition;

What does/doesn't work with the external definition?

Image These are the states, I briefly saw something like switch_mode: toggle but i cant seem to reproduce it

Image This are the Exposes, there could be much more, the device is able to switch to detached mode, has an input etc.etc.

The device reports very frequently, like every second, I have a few and they are pretty much spamming the network

marce14-git avatar Mar 24 '25 15:03 marce14-git

after restarting i get this error:

Failed to configure 'Büro Lichtschalter', attempt 2 (Error: ZCL command 0x7c2c67fffe7b6dc4/1 seMetering.configReport([{"minimumReportInterval":10,"maximumReportInterval":65000,"reportableChange":100000,"attribute":"currentSummDelivered"}], {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"reservedBits":0,"writeUndiv":false}) failed (Status 'UNREPORTABLE_ATTRIBUTE') at Endpoint.checkStatus (/app/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:349:28) at Endpoint.zclCommand (/app/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:954:26) at processTicksAndRejections (node:internal/process/task_queues:105:5) at Endpoint.configureReporting (/app/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:686:9) at setupAttributes (/app/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman-converters/src/lib/modernExtend.ts:159:17) at result.configure (/app/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman-converters/src/lib/modernExtend.ts:2016:29) at Object.configure (/app/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman-converters/src/index.ts:357:21) at Configure.configure (/app/lib/extension/configure.ts:124:13) at EventEmitter.wrappedCallback (/app/lib/eventBus.ts:204:17))

marce14-git avatar Mar 24 '25 19:03 marce14-git

This screenshot is provided by a friend, who are already running their PM devices in Z2M , it may help . I hope they expose Zigbee clusters in their documentation (soon).

@Koenkk it will be great if you can add Shelly as vendor , as they plan to expand their portfolio with Zigbee devices now , and all Gen4 will be Zigbee and Gen3 will get Matter (nor Zigbee) with new firmware release .
Gen 4 devices are here https://www.shelly.com/collections/all-products

Image

rionshin avatar Mar 24 '25 22:03 rionshin

This screenshot is provided by a friend, who are already running their PM devices in Z2M , it may help . I hope they expose Zigbee clusters in their documentation (soon).

@Koenkk it will be great if you can add Shelly as vendor , as they plan to expand their portfolio with Zigbee devices now , and all Gen4 will be Zigbee and Gen3 as well with new firmware release . Gen 4 devices are here https://www.shelly.com/collections/all-products

Where is the information that GEN3 will get Zigbee?

Theo16 avatar Mar 25 '25 13:03 Theo16

This screenshot is provided by a friend, who are already running their PM devices in Z2M , it may help . I hope they expose Zigbee clusters in their documentation (soon). @Koenkk it will be great if you can add Shelly as vendor , as they plan to expand their portfolio with Zigbee devices now , and all Gen4 will be Zigbee and Gen3 as well with new firmware release . Gen 4 devices are here https://www.shelly.com/collections/all-products

Where is the information that GEN3 will get Zigbee?

Gen 3 wont get Zigbee, Gen 3 will gett Matter over Wifi

marce14-git avatar Mar 25 '25 13:03 marce14-git

This screenshot is provided by a friend, who are already running their PM devices in Z2M , it may help . I hope they expose Zigbee clusters in their documentation (soon). @Koenkk it will be great if you can add Shelly as vendor , as they plan to expand their portfolio with Zigbee devices now , and all Gen4 will be Zigbee and Gen3 as well with new firmware release . Gen 4 devices are here https://www.shelly.com/collections/all-products

Where is the information that GEN3 will get Zigbee?

Gen 3 wont get Zigbee, Gen 3 will gett Matter over Wifi

Gen4 has zigbee.

MeisterQ avatar Mar 25 '25 15:03 MeisterQ

Knowledge base for Shelly 1pm mini gen4: https://kb.shelly.cloud/knowledge-base/shelly-1pm-mini-gen4

FrodoVDR avatar Mar 26 '25 17:03 FrodoVDR

Knowledge base for Shelly 1pm mini gen4: https://kb.shelly.cloud/knowledge-base/shelly-1pm-mini-gen4

Still not information for the Zigbee clusters.

rionshin avatar Mar 26 '25 17:03 rionshin

This screenshot is provided by a friend, who are already running their PM devices in Z2M , it may help . I hope they expose Zigbee clusters in their documentation (soon). @Koenkk it will be great if you can add Shelly as vendor , as they plan to expand their portfolio with Zigbee devices now , and all Gen4 will be Zigbee and Gen3 as well with new firmware release . Gen 4 devices are here https://www.shelly.com/collections/all-products

Where is the information that GEN3 will get Zigbee?

My mistake it will be matter over wifi, no zigbee.

rionshin avatar Mar 26 '25 17:03 rionshin

Image

Maybe this helps? I dont know. Its the information i receive from IObroker zigbee adapter. Its a Gen4 1PM Mini

MeisterQ avatar Mar 26 '25 19:03 MeisterQ

Knowledge base for Shelly 1pm mini gen4: https://kb.shelly.cloud/knowledge-base/shelly-1pm-mini-gen4

Still not information for the Zigbee clusters.

Hello I have the mini 1 , Mini PM and the models 1 and 1PM

in order to try help this implementation, please let me know where I can try to find this information?

Tks

MiAutomations avatar Mar 27 '25 11:03 MiAutomations

I received this info from the Shelly support :

Shelly 1 an 1 Mini

  "profile_id": "0x0104",
  "device_type": "0x0002",
  "input_clusters": [
    "0x0000",
    "0x0003",
    "0x0004",
    "0x0005",
    "0x0006"
  ],

Shelly 1PM and 1PM Mini

  "profile_id": "0x0104",
  "device_type": "0x0051",
  "input_clusters": [
    "0x0000",
    "0x0003",
    "0x0004",
    "0x0005",
    "0x0006",
    "0x0702",
    "0x0b04"
  ],

Can someone use this info in a meaningful way? @Koenkk ?

marce14-git avatar Mar 28 '25 10:03 marce14-git

I hope shelly will add input state reporting over ZigBee. For example to use it in detached mode

Mosher23 avatar Mar 28 '25 12:03 Mosher23


const m = require('zigbee-herdsman-converters/lib/modernExtend');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const e = exposes.presets;

const definition = {
    zigbeeModel: ['Mini1PM'],
    model: 'Mini1PM',
    vendor: 'Shelly',
    description: 'Automatically generated definition',
    extend: [
        m.deviceEndpoints({"endpoints": {"1": 1, "239": 239}}),
        m.onOff({"powerOnBehavior": false}),
    ],
    exposes: [
  

        // Add the rest of the electricityMeter exposes with '_1' suffix
        ...m.electricityMeter().exposes.map(expose => {
            // Custom mapping for '_1' suffix
            if (expose.property === 'voltage') expose.property = 'voltage_1';
            if (expose.property === 'current') expose.property = 'current_1';
            if (expose.property === 'power') expose.property = 'power_1';
            if (expose.property === 'energy') expose.property = 'energy_1';
            if (expose.property === 'ac_frequency') expose.property = 'ac_frequency_1';
            return expose;
        })
    ],
    meta: { multiEndpoint: true },
};

module.exports = definition;

I tried using ChatGPT to create a working external converter, it kinda works but its probably not the most elegant solution

marce14-git avatar Mar 28 '25 22:03 marce14-git


const m = require('zigbee-herdsman-converters/lib/modernExtend');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const e = exposes.presets;

const definition = {
    zigbeeModel: ['Mini1PM'],
    model: 'Mini1PM',
    vendor: 'Shelly',
    description: 'Automatically generated definition',
    extend: [
        m.deviceEndpoints({"endpoints": {"1": 1, "239": 239}}),
        m.onOff({"powerOnBehavior": false}),
    ],
    exposes: [
  

        // Add the rest of the electricityMeter exposes with '_1' suffix
        ...m.electricityMeter().exposes.map(expose => {
            // Custom mapping for '_1' suffix
            if (expose.property === 'voltage') expose.property = 'voltage_1';
            if (expose.property === 'current') expose.property = 'current_1';
            if (expose.property === 'power') expose.property = 'power_1';
            if (expose.property === 'energy') expose.property = 'energy_1';
            if (expose.property === 'ac_frequency') expose.property = 'ac_frequency_1';
            return expose;
        })
    ],
    meta: { multiEndpoint: true },
};

module.exports = definition;

I tried using ChatGPT to create a working external converter, it kinda works but its probably not the most elegant solution

Could you please share what entities you see in Exposed tab?

Mosher23 avatar Mar 29 '25 08:03 Mosher23

hope shelly will add input state reporting over ZigBee. For example to use it in detached mode

Shelly support said not possible, and the input state is not published from the device via zigbee, hope they add it in the future

For now I’m using the Shelly with Wifi which exposes input state and control the lights over zigbee using Homeassistant

On the Shelly is a script to run in detached mode and fallback to toggle mode if Homeassistant is offline

Image

marce14-git avatar Mar 29 '25 09:03 marce14-git

On the Shelly is a script to run in detached mode and fallback to toggle mode if Homeassistant is offline

Could you please share this script? Thanks

Mosher23 avatar Mar 29 '25 10:03 Mosher23

On the Shelly is a script to run in detached mode and fallback to toggle mode if Homeassistant is offline

Could you please share this script? Thanks

https://pastebin.com/faCH8UDN

Change IP, HA Token and desired state of the HA sensor

marce14-git avatar Mar 29 '25 10:03 marce14-git

Btw, i think this request has to be placed in the herdsman converter repository, right? I dont think @Koenkk will respond here.

MeisterQ avatar Mar 29 '25 16:03 MeisterQ

Could you check if the issue is fixed with the following external converter:

  • save this as file next to configuration.yaml in the external_converters directory (create if it doesn't exist yet) as ext_converter.js (so external_converters/ext_converter.js)
  • start z2m,
  • in the frontend, check if the description of this device now ends with CUSTOM (this indicates the external converter has been loaded correctly)
  • check if issue is fixed

Koenkk avatar Mar 30 '25 19:03 Koenkk

Could you check if the issue is fixed with the following external converter:

  • save this as file next to configuration.yaml in the external_converters directory (create if it doesn't exist yet) as ext_converter.js (so external_converters/ext_converter.js)
  • start z2m,
  • in the frontend, check if the description of this device now ends with CUSTOM (this indicates the external converter has been loaded correctly)
  • check if issue is fixed

The converter is applied and device is shown as Shelly 1 Mini instead of Shelly 1PM Mini, but doesnt solve the issue

States when connected to a 7W bulb: { "ac_frequency": 50.04, "ac_frequency_1": 5006, "current": null, "current_1": 0.05, "energy": null, "energy_1": 0.003084, "last_seen": "2025-03-30T21:26:55+02:00", "linkquality": 138, "power": null, "power_1": 6.97, "produced_energy": 0, "produced_energy_1": 0, "state": "ON", "state_1": "ON", "voltage": null, "voltage_1": 223.49 }

Image

Image

marce14-git avatar Mar 30 '25 19:03 marce14-git

Could you provide the debug log when removing and attaching the 7w load?

See this on how to enable debug logging.

Koenkk avatar Mar 30 '25 19:03 Koenkk

Could you provide the debug log when removing and attaching the 7w load?

See this on how to enable debug logging.

I am sorry, after repairing the device everything works

[{ "ac_frequency": 5010, "ac_frequency_1": 5006, "current_1": 0.05, "energy_1": 0.003084, "last_seen": "2025-03-30T21:59:33+02:00", "linkquality": 171, "power_1": 6.97, "produced_energy": 0, "produced_energy_1": 0, "state": "ON", "state_1": "ON", "voltage_1": 223.49, "current": 0.05, "power": 7.15, "energy": 0.01, "voltage": 226.64 }]

i just get this error

z2m: Failed to configure '0x7c2c67fffe7ba1f4', attempt 2 (Error: ZCL command 0x7c2c67fffe7ba1f4/1 seMetering.configReport([{"minimumReportInterval":10,"maximumReportInterval":65000,"reportableChange":100000,"attribute":"currentSummDelivered"}], {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"reservedBits":0,"writeUndiv":false}) failed (Status 'UNREPORTABLE_ATTRIBUTE') at Endpoint.checkStatus (/app/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:349:28) at Endpoint.zclCommand (/app/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:954:26) at processTicksAndRejections (node:internal/process/task_queues:105:5) at Endpoint.configureReporting (/app/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:686:9) at setupAttributes (/app/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman-converters/src/lib/modernExtend.ts:159:17) at result.configure (/app/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman-converters/src/lib/modernExtend.ts:2016:29) at Object.configure (/app/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman-converters/src/index.ts:357:21) at Configure.configure (/app/lib/extension/configure.ts:124:13) at EventEmitter.wrappedCallback (/app/lib/eventBus.ts:204:17))

marce14-git avatar Mar 30 '25 19:03 marce14-git

@marce14-git Can you confirm that all features works by zigbee? I will receive soon 15 Mini 1 to start with my home automation and I want to use it with HA and Zigbee2MQTT. Thanks

JoSeBu1 avatar Mar 31 '25 09:03 JoSeBu1

@marce14-git Can you confirm that all features works by zigbee? I will receive soon 15 Mini 1 to start with my home automation and I want to use it with HA and Zigbee2MQTT. Thanks

With the new converter all features work

But the 1PM Mini (don’t know about the 1Mini)?reports every 5seconds, and does not seem to abide to increasing the reporting Interval

I have a fairly stable network of 80 devices and a cc2652p and even if I only have 1 or 2 of them, the network gets noticeably slower Compared to all other devices , the Shelly’s spam the network pretty much

EDIT: can be fixed by unbinding the SeMetering Cluster - see below

marce14-git avatar Mar 31 '25 09:03 marce14-git

@marce14-git does it show input state with the converter from Koenkk?

Mosher23 avatar Mar 31 '25 11:03 Mosher23

@marce14-git does it show input state with the converter from Koenkk?

Input state is currently not supported (statement from Shelly support)

You can create a ticket on the Shelly website with feature suggestions, hopefully they add this in the future

marce14-git avatar Mar 31 '25 11:03 marce14-git

I have submitted a ticket.

Mosher23 avatar Mar 31 '25 12:03 Mosher23

After unbinding the seMetering cluster in the Bind tab, my Shelly stopped sending reports every 5 seconds.

xcashy avatar Mar 31 '25 12:03 xcashy

Could you check if the issue is fixed with the following external converter:

  • save this as file next to configuration.yaml in the external_converters directory (create if it doesn't exist yet) as ext_converter.js (so external_converters/ext_converter.js)
  • start z2m,
  • in the frontend, check if the description of this device now ends with CUSTOM (this indicates the external converter has been loaded correctly)
  • check if issue is fixed

Converter still works, but everytime the POWER changes I get this error, however the value is displayed correctly:

zhc: Failed to apply calibration to 'power': 'power_calibration' is not a number, got string ()

marce14-git avatar Mar 31 '25 13:03 marce14-git

After unbinding the seMetering cluster in the Bind tab, my Shelly stopped sending reports every 5 seconds.

How do you unbind only one cluster?

Mosher23 avatar Mar 31 '25 13:03 Mosher23