Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Frient EMIZB-151 HAN P1 Electricity Meter Sensor #8129

Merged
merged 4 commits into from
Oct 20, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/devices/frient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ const definitions: DefinitionWithExtend[] = [
return {default: 2};
},
},
{
zigbeeModel: ['EMIZB-151'],
model: 'EMIZB-151',
vendor: 'Frient',
description: 'HAN P1 power-meter sensor',
extend: [electricityMeter()],
configure: async (device) => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it also work without the configure? (make sure to factory reset the device after removing)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the configure both the reporting and bind fail. Adding the configure was the only way I found to make it behave properly. electricityMeter({threePhase: true}) makes reporting and bind fail.

Is some other parameter required?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you provide the debug log of this failing?

See this on how to enable debug logging.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My mistake, it seems like configure isn't required and it will report and bind properly. Something else must have failed when I was testing earlier

electricityMeter({threePhase: true}) does still fail. It creates a very weird result.

The state reports correctly except for energy
Screenshot 2024-10-14 at 22 29 47

But reporting and bind don't look correct, without seMetering is missing from bind and all reporting configuration is missing
Screenshot 2024-10-14 at 22 29 38

Screenshot 2024-10-14 at 22 29 30

Debug entry

[2024-10-14 22:06:34] info: z2m: Configuring '0x0015bc001b10135c'
[2024-10-14 22:06:34] debug: zh:controller:endpoint: ZCL command 0x0015bc001b10135c/2 haElectricalMeasurement.read(["acPowerDivisor","acPowerMultiplier"], {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"reservedBits":0,"writeUndiv":false})
[2024-10-14 22:06:34] debug: zh:controller:endpoint: Request Queue (0x0015bc001b10135c/2): send request
[2024-10-14 22:06:34] debug: zh:ezsp: sendZclFrameToEndpointInternal 0x0015bc001b10135c:17439/2 (0,0,1), timeout=10000
[2024-10-14 22:06:34] info: z2m:mqtt: MQTT publish: topic 'homeassistant/sensor/0x0015bc001b10135c/power/config', payload '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"}],"device":{"identifiers":["zigbee2mqtt_0x0015bc001b10135c"],"manufacturer":"Frient","model":"HAN P1 power-meter sensor (EMIZB-151)","name":"0x0015bc001b10135c","via_device":"zigbee2mqtt_bridge_0xe0798dfffef441e0"},"device_class":"power","enabled_by_default":true,"entity_category":"diagnostic","object_id":"0x0015bc001b10135c_power","origin":{"name":"Zigbee2MQTT","sw":"1.40.2","url":"https://www.zigbee2mqtt.io"},"state_class":"measurement","state_topic":"zigbee2mqtt/0x0015bc001b10135c","unique_id":"0x0015bc001b10135c_power_zigbee2mqtt","unit_of_measurement":"W","value_template":"{{ value_json.power }}"}'
[2024-10-14 22:06:34] debug: zh:ezsp:ezsp: ==> sendUnicast: {"type":0,"indexOrDestination":17439,"apsFrame":{"profileId":260,"sequence":21,"clusterId":2820,"sourceEndpoint":1,"destinationEndpoint":2,"groupId":0,"options":256},"messageTag":22,"message":{"type":"Buffer","data":[16,14,0,5,6,4,6]}}
[2024-10-14 22:06:34] debug: zh:ezsp:ezsp: ==> {"cls":"sendUnicast","id":52,"isRequest":true,"type":0,"indexOrDestination":17439,"apsFrame":{"profileId":260,"sequence":21,"clusterId":2820,"sourceEndpoint":1,"destinationEndpoint":2,"groupId":0,"options":256},"messageTag":22,"message":{"type":"Buffer","data":[16,14,0,5,6,4,6]}}
[2024-10-14 22:06:34] debug: zh:ezsp:uart: --> DATA (5,6,0): 4500013400001f440401040b010200010000151607100e0005060406
[2024-10-14 22:06:34] debug: zh:ezsp:uart: --> [560721a9602a15ad1d904b21a15490499d4e27befbc97785fdc3658dfa7d33c57e]
[2024-10-14 22:06:34] debug: zh:ezsp:uart: -?- waiting (6)
[2024-10-14 22:06:34] info: z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"definition":{"description":"HAN P1 power-meter sensor","exposes":[{"access":5,"category":"diagnostic","description":"Instantaneous measured power","label":"Power","name":"power","property":"power","type":"numeric","unit":"W"},{"access":5,"category":"diagnostic","description":"Measured electrical potential value","label":"Voltage","name":"voltage","property":"voltage","type":"numeric","unit":"V"},{"access":5,"category":"diagnostic","description":"Instantaneous measured electrical current","label":"Current","name":"current","property":"current","type":"numeric","unit":"A"},{"access":5,"description":"Sum of consumed energy","label":"Energy","name":"energy","property":"energy","type":"numeric","unit":"kWh"},{"access":5,"category":"diagnostic","description":"Instantaneous measured power on phase B","label":"Power phase b","name":"power_phase_b","property":"power_phase_b","type":"numeric","unit":"W"},{"access":5,"category":"diagnostic","description":"Instantaneous measured power on phase C","label":"Power phase c","name":"power_phase_c","property":"power_phase_c","type":"numeric","unit":"W"},{"access":5,"description":"Measured electrical potential value on phase B","label":"Voltage phase B","name":"voltage_phase_b","property":"voltage_phase_b","type":"numeric","unit":"V"},{"access":5,"description":"Measured electrical potential value on phase C","label":"Voltage phase C","name":"voltage_phase_c","property":"voltage_phase_c","type":"numeric","unit":"V"},{"access":5,"description":"Instantaneous measured electrical current on phase B","label":"Current phase B","name":"current_phase_b","property":"current_phase_b","type":"numeric","unit":"A"},{"access":5,"description":"Instantaneous measured electrical current on phase C","label":"Current phase C","name":"current_phase_c","property":"current_phase_c","type":"numeric","unit":"A"},{"access":1,"category":"diagnostic","description":"Link quality (signal strength)","label":"Linkquality","name":"linkquality","property":"linkquality","type":"numeric","unit":"lqi","value_max":255,"value_min":0}],"model":"EMIZB-151","options":[{"access":2,"description":"Calibrates the power value (percentual offset), takes into effect on next report of device.","label":"Power calibration","name":"power_calibration","property":"power_calibration","type":"numeric"},{"access":2,"description":"Number of digits after decimal point for power, takes into effect on next report of device. This option can only decrease the precision, not increase it.","label":"Power precision","name":"power_precision","property":"power_precision","type":"numeric","value_max":3,"value_min":0},{"access":2,"description":"Calibrates the voltage value (percentual offset), takes into effect on next report of device.","label":"Voltage calibration","name":"voltage_calibration","property":"voltage_calibration","type":"numeric"},{"access":2,"description":"Number of digits after decimal point for voltage, takes into effect on next report of device. This option can only decrease the precision, not increase it.","label":"Voltage precision","name":"voltage_precision","property":"voltage_precision","type":"numeric","value_max":3,"value_min":0},{"access":2,"description":"Calibrates the current value (percentual offset), takes into effect on next report of device.","label":"Current calibration","name":"current_calibration","property":"current_calibration","type":"numeric"},{"access":2,"description":"Number of digits after decimal point for current, takes into effect on next report of device. This option can only decrease the precision, not increase it.","label":"Current precision","name":"current_precision","property":"current_precision","type":"numeric","value_max":3,"value_min":0},{"access":2,"description":"Calibrates the energy value (percentual offset), takes into effect on next report of device.","label":"Energy calibration","name":"energy_calibration","property":"energy_calibration","type":"numeric"},{"access":2,"description":"Number of digits after decimal point for energy, takes into effect on next report of device. This option can only decrease the precision, not increase it.","label":"Energy precision","name":"energy_precision","property":"energy_precision","type":"numeric","value_max":3,"value_min":0},{"access":2,"description":"Calibrates the power_phase_b value (percentual offset), takes into effect on next report of device.","label":"Power phase b calibration","name":"power_phase_b_calibration","property":"power_phase_b_calibration","type":"numeric"},{"access":2,"description":"Number of digits after decimal point for power_phase_b, takes into effect on next report of device. This option can only decrease the precision, not increase it.","label":"Power phase b precision","name":"power_phase_b_precision","property":"power_phase_b_precision","type":"numeric","value_max":3,"value_min":0},{"access":2,"description":"Calibrates the power_phase_c value (percentual offset), takes into effect on next report of device.","label":"Power phase c calibration","name":"power_phase_c_calibration","property":"power_phase_c_calibration","type":"numeric"},{"access":2,"description":"Number of digits after decimal point for power_phase_c, takes into effect on next report of device. This option can only decrease the precision, not increase it.","label":"Power phase c precision","name":"power_phase_c_precision","property":"power_phase_c_precision","type":"numeric","value_max":3,"value_min":0},{"access":2,"description":"Calibrates the voltage_phase_b value (percentual offset), takes into effect on next report of device.","label":"Voltage phase b calibration","name":"voltage_phase_b_calibration","property":"voltage_phase_b_calibration","type":"numeric"},{"access":2,"description":"Number of digits after decimal point for voltage_phase_b, takes into effect on next report of device. This option can only decrease the precision, not increase it.","label":"Voltage phase b precision","name":"voltage_phase_b_precision","property":"voltage_phase_b_precision","type":"numeric","value_max":3,"value_min":0},{"access":2,"description":"Calibrates the voltage_phase_c value (percentual offset), takes into effect on next report of device.","label":"Voltage phase c calibration","name":"voltage_phase_c_calibration","property":"voltage_phase_c_calibration","type":"numeric"},{"access":2,"description":"Number of digits after decimal point for voltage_phase_c, takes into effect on next report of device. This option can only decrease the precision, not increase it.","label":"Voltage phase c precision","name":"voltage_phase_c_precision","property":"voltage_phase_c_precision","type":"numeric","value_max":3,"value_min":0},{"access":2,"description":"Calibrates the current_phase_b value (percentual offset), takes into effect on next report of device.","label":"Current phase b calibration","name":"current_phase_b_calibration","property":"current_phase_b_calibration","type":"numeric"},{"access":2,"description":"Number of digits after decimal point for current_phase_b, takes into effect on next report of device. This option can only decrease the precision, not increase it.","label":"Current phase b precision","name":"current_phase_b_precision","property":"current_phase_b_precision","type":"numeric","value_max":3,"value_min":0},{"access":2,"description":"Calibrates the current_phase_c value (percentual offset), takes into effect on next report of device.","label":"Current phase c calibration","name":"current_phase_c_calibration","property":"current_phase_c_calibration","type":"numeric"},{"access":2,"description":"Number of digits after decimal point for current_phase_c, takes into effect on next report of device. This option can only decrease the precision, not increase it.","label":"Current phase c precision","name":"current_phase_c_precision","property":"current_phase_c_precision","type":"numeric","value_max":3,"value_min":0}],"supports_ota":false,"vendor":"Frient"},"friendly_name":"0x0015bc001b10135c","ieee_address":"0x0015bc001b10135c","status":"successful","supported":true},"type":"device_interview"}'
[2024-10-14 22:06:34] info: z2m:mqtt: MQTT publish: topic 'homeassistant/sensor/0x0015bc001b10135c/voltage/config', payload '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"}],"device":{"identifiers":["zigbee2mqtt_0x0015bc001b10135c"],"manufacturer":"Frient","model":"HAN P1 power-meter sensor (EMIZB-151)","name":"0x0015bc001b10135c","via_device":"zigbee2mqtt_bridge_0xe0798dfffef441e0"},"device_class":"voltage","enabled_by_default":false,"entity_category":"diagnostic","object_id":"0x0015bc001b10135c_voltage","origin":{"name":"Zigbee2MQTT","sw":"1.40.2","url":"https://www.zigbee2mqtt.io"},"state_class":"measurement","state_topic":"zigbee2mqtt/0x0015bc001b10135c","unique_id":"0x0015bc001b10135c_voltage_zigbee2mqtt","unit_of_measurement":"V","value_template":"{{ value_json.voltage }}"}'

Database Entry

{"id":20,"type":"EndDevice","ieeeAddr":"0x0015bc001b10135c","nwkAddr":17439,"manufId":4117,"manufName":"frient A/S","powerSource":"DC Source","modelId":"EMIZB-151","epList":[1,2],"endpoints":{"1":{"profId":49353,"epId":1,"devId":1,"inClusterList":[5,6],"outClusterList":[],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}},"2":{"profId":260,"epId":2,"devId":83,"inClusterList":[0,1,3,32,1794,1796,2817,2820,2821],"outClusterList":[3,10,25],"clusters":{"genBasic":{"attributes":{"modelId":"EMIZB-151","manufacturerName":"frient A/S","powerSource":4,"zclVersion":7,"dateCode":"2023-12-21 11:13"}},"genPollCtrl":{"attributes":{"checkinInterval":14400}},"haElectricalMeasurement":{"attributes":{"acPowerDivisor":1,"acPowerMultiplier":1,"acCurrentDivisor":10,"acCurrentMultiplier":1,"acVoltageDivisor":10,"acVoltageMultiplier":1}}},"binds":[{"cluster":32,"type":"endpoint","deviceIeeeAddress":"0xe0798dfffef441e0","endpointID":1},{"cluster":2820,"type":"endpoint","deviceIeeeAddress":"0xe0798dfffef441e0","endpointID":1}],"configuredReportings":[],"meta":{}}},"dateCode":"2023-12-21 11:13","zclVersion":7,"interviewCompleted":true,"meta":{},"lastSeen":1728936395746,"checkinInterval":3600}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you provide the complete debug log from starting the configure until it fails/succeeds (it's only partial now)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log entry from start to end is very long so I'm uploading the whole file instead.

log.log

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It fails to send the request:

[2024-10-14 22:06:35] debug: 	zh:controller:endpoint: Request Queue (0x0015bc001b10135c/2): queue request (transaction failed) (Error: sendZclFrameToEndpointInternal error)
[2024-10-14 22:06:35] debug: 	zh:controller:requestqueue: Request Queue (0x0015bc001b10135c/2): Sending when active. Expires: 1728939995873

So that's why the binds are missing, this is likely due to a hickup in your network. I also suggest to start using the improved ember driver and try again. (info)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After switching to the ember driver the issue still persists, but now we get a proper error messages.

[2024-10-19 16:29:58] debug: zh:controller:requestqueue: Request Queue (0x0015bc001b10135c/2): send failed, expires in 3289.283 seconds (~x~> [ZCL to=0x0015bc001b10135c:141 apsFrame={"profileId":260,"clusterId":2820,"sourceEndpoint":1,"destinationEndpoint":2,"options":4416,"groupId":0,"sequence":0}] Failed to send request with status=MESSAGE_TOO_LONG.)

Here's the complete log file
log.log

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5c1f2d5

Changes will be available in the dev branch in a few hours from now.

const endpoint = device.getEndpoint(2);
await endpoint.configureReporting('haElectricalMeasurement', [
{attribute: 'acPowerDivisor', minimumReportInterval: 10, maximumReportInterval: 65000, reportableChange: 1},
]);
},
},
];

export default definitions;
Expand Down
Loading