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

Issue with Iris 3210-L power usage measurement in zigbee-herdsman #671

Closed
airdrummingfool opened this issue Oct 7, 2019 · 9 comments
Closed

Comments

@airdrummingfool
Copy link
Contributor

airdrummingfool commented Oct 7, 2019

Hello and thanks for this awesome project!

I'm starting from scratch (migrating my Zigbee devices from SmartThings) and decided to start with zigbee-herdsman (using zigbee2mqtt dev branch) so I could help test the upcoming update.

I paired an Iris 3210-L smart plug, and on/off works fine. However, power consumption is not reported. There are no errors or other messages in the debug output of zigbee2mqtt, so I'm guessing that power consumption isn't being configured correctly... it looks like fewer options are passed in the new version, but I'm in very unfamiliar territory.

Here's the original configure method from zigbee-shepherd-converters (I can only assume that this worked):

configure: (ieeeAddr, shepherd, coordinator, callback) => {
    const device = shepherd.find(ieeeAddr, 1);
    const actions = [
        (cb) => device.report('haElectricalMeasurement', 'activePower', 10, 1000, 1, cb),
    ];

    execute(device, actions, callback);
},

Here's the new configure method in zigbee-herdsman-converters:

configure: async (device, coordinatorEndpoint) => {
    const endpoint = device.getEndpoint(1);
    await configureReporting.activePower(endpoint);
},

In case it's useful, here's how power consumption is configured in the SmartThings device handler I was using:

//power config for devices with min reporting interval as 1 seconds and reporting interval if no activity as 10min (600s)
//min change in value is 01
def powerConfig() {
	[
		"zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 0x0B04 {${device.zigbeeId}} {}", "delay 200",
		"zcl global send-me-a-report 0x0B04 0x050B 0x29 ${intervalMin ?: 5} ${intervalMax ?: 600} {05 00}",				//The send-me-a-report is custom to the attribute type for CentraLite
		"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500"
	]
}

If you have any suggestions or can lead me in a direction to test some things, I'd be happy to try some changes and make a PR if it works out. Alternatively, if it is not the right time in the zigbee2mqtt/zigbee-herdsman update process, please let me know and I'll go away until the timing is more appropriate :)

EDIT:

  • I'm using Home Assistant MQTT discovery
  • No sensor is created in HA for reporting power consumption (there is a switch for on/off, and a sensor for link quality)
@Koenkk
Copy link
Owner

Koenkk commented Oct 7, 2019

Can you share your database.db?

@airdrummingfool
Copy link
Contributor Author

{
	"id": 1,
	"type": "Coordinator",
	"ieeeAddr": "0x00124b00015a7695",
	"nwkAddr": 0,
	"manufId": 0,
	"epList": [1, 2, 3, 4, 5, 6, 8, 11],
	"endpoints": {
		"1": {
			"profId": 260,
			"epId": 1,
			"devId": 5,
			"inClusterList": [],
			"outClusterList": [],
			"clusters": {},
			"binds": []
		},
		"2": {
			"profId": 257,
			"epId": 2,
			"devId": 5,
			"inClusterList": [],
			"outClusterList": [],
			"clusters": {},
			"binds": []
		},
		"3": {
			"profId": 261,
			"epId": 3,
			"devId": 5,
			"inClusterList": [],
			"outClusterList": [],
			"clusters": {},
			"binds": []
		},
		"4": {
			"profId": 263,
			"epId": 4,
			"devId": 5,
			"inClusterList": [],
			"outClusterList": [],
			"clusters": {},
			"binds": []
		},
		"5": {
			"profId": 264,
			"epId": 5,
			"devId": 5,
			"inClusterList": [],
			"outClusterList": [],
			"clusters": {},
			"binds": []
		},
		"6": {
			"profId": 265,
			"epId": 6,
			"devId": 5,
			"inClusterList": [],
			"outClusterList": [],
			"clusters": {},
			"binds": []
		},
		"8": {
			"profId": 260,
			"epId": 8,
			"devId": 5,
			"inClusterList": [],
			"outClusterList": [],
			"clusters": {},
			"binds": []
		},
		"11": {
			"profId": 260,
			"epId": 11,
			"devId": 1024,
			"inClusterList": [],
			"outClusterList": [1280],
			"clusters": {},
			"binds": []
		}
	},
	"interviewCompleted": false,
	"meta": {}
} {
	"id": 2,
	"type": "Router",
	"ieeeAddr": "0x000d6f000a935c2d",
	"nwkAddr": 16450,
	"manufId": 4174,
	"manufName": "CentraLite",
	"powerSource": "Mains (single phase)",
	"modelId": "3210-L",
	"epList": [1],
	"endpoints": {
		"1": {
			"profId": 260,
			"epId": 1,
			"devId": 256,
			"inClusterList": [0, 3, 4, 5, 6, 2820, 2821, 64515],
			"outClusterList": [25],
			"clusters": {
				"genBasic": {
					"attributes": {
						"modelId": "3210-L",
						"manufacturerName": "CentraLite",
						"powerSource": 1,
						"zclVersion": 1,
						"stackVersion": 2,
						"hwVersion": 3,
						"dateCode": "����������������"
					}
				}
			},
			"binds": []
		}
	},
	"stackVersion": 2,
	"hwVersion": 3,
	"dateCode": "����������������",
	"zclVersion": 1,
	"interviewCompleted": true,
	"meta": {
		"configured": 1
	}
}

@Koenkk
Copy link
Owner

Koenkk commented Oct 9, 2019

Can you try with

    {
        zigbeeModel: ['3210-L'],
        model: '3210-L',
        vendor: 'Iris',
        description: 'Smart plug',
        supports: 'on/off',
        fromZigbee: [fz.state, fz.iris_3210L_power],
        toZigbee: [tz.on_off],
        meta: {configureKey: 1},
        configure: async (device, coordinatorEndpoint) => {
            const endpoint = device.getEndpoint(1);
            await bind(endpoint, coordinatorEndpoint, ['haElectricalMeasurement']);
            await configureReporting.activePower(endpoint);
        },
    },

@airdrummingfool
Copy link
Contributor Author

After changing the code and unpairing and repairing, power reporting is working! Thanks :)

Power reported is showing up as an attribute of the linkquality sensor. Is that expected, or should it be a separate sensor (or part of the main power switch)?
image
image

@Koenkk
Copy link
Owner

Koenkk commented Oct 9, 2019

Should be a separate sensor, change https://github.com/Koenkk/zigbee2mqtt/blob/dev/lib/extension/homeassistant.js#L536 to '3210-L': [cfg.switch, cfg.sensor_power], and it will work; Do you mind making a pr for these changes? Then this can be closed.

@airdrummingfool
Copy link
Contributor Author

I'd be happy to make PRs. There's one last thing on this device that isn't working: if I use the physical button on the device to toggle the switch state (OFF or ON), nothing is reported to HA. For example, if I turn the plug on in HA and then off using the button on the plug itself, HA still shows it as on (and I have to toggle it OFF and then back ON in HA to turn it on). To me, this is only a minor issue.

@Koenkk
Copy link
Owner

Koenkk commented Oct 9, 2019

Can you try with

    {
        zigbeeModel: ['3210-L'],
        model: '3210-L',
        vendor: 'Iris',
        description: 'Smart plug',
        supports: 'on/off',
        fromZigbee: [fz.state, fz.iris_3210L_power],
        toZigbee: [tz.on_off],
        meta: {configureKey: 2},
        configure: async (device, coordinatorEndpoint) => {
            const endpoint = device.getEndpoint(1);
            await bind(endpoint, coordinatorEndpoint, ['genOnOff', 'haElectricalMeasurement']);
            await configureReporting.onOff(endpoint);
            await configureReporting.activePower(endpoint);
        },
    },

@airdrummingfool
Copy link
Contributor Author

That works! Thank you so much for your quick responses. PRs will be on their way shortly!

@Koenkk
Copy link
Owner

Koenkk commented Oct 9, 2019

merged!

@Koenkk Koenkk closed this as completed Oct 9, 2019
xmow49 pushed a commit to xmow49/zigbee-herdsman-converters that referenced this issue Jun 14, 2024
* PM25 cluster is not manufacturer specific
It's a normal cluster, see ZCL spec 4.13

* Added Ikea specific value for PM25 cluster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants