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 support for Innr SP240 Smart Plug #6671

Closed
wants to merge 1 commit into from
Closed

Conversation

baschno
Copy link

@baschno baschno commented Dec 9, 2023

Support for new Innr SP240 Smart Plug with Power Meter.
This is more or less an exact copy of the SP 234 Plug.

Tested as external converter with

const definition = {
    zigbeeModel: ['SP 240'], // The model ID from: Device with modelID 'lumi.sens' is not supported.
    model: 'SP 240', // Vendor model number, look on the device for a model number
    vendor: 'Innr', // Vendor of the device (only used for documentation and startup logging)
    description: 'Smart Plug with power metering', // Description of the device, copy from vendor site. (only used for documentation and startup logging)
    fromZigbee: [fz.on_off, fz.metering, fz.electrical_measurement], // We will add this later
    toZigbee: [tz.on_off], // Should be empty, unless device can be controlled (e.g. lights, switches).
    exposes: [e.switch(), e.energy(), e.power(), e.current(), e.voltage()], // Defines what this device exposes, used for e.g. Home Assistant discovery and in the frontend
    configure: async (device, coordinatorEndpoint, logger) => {
        const endpoint = device.getEndpoint(1);
        await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'haElectricalMeasurement', 'seMetering']);
        await reporting.onOff(endpoint);
        endpoint.saveClusterAttributeKeyValue('haElectricalMeasurement', {
            acCurrentDivisor: 1000,
            acCurrentMultiplier: 1,
        });

        await reporting.activePower(endpoint);
        await reporting.rmsCurrent(endpoint);
        await reporting.rmsVoltage(endpoint);
        // Gives UNSUPPORTED_ATTRIBUTE on reporting.readMeteringMultiplierDivisor.
        endpoint.saveClusterAttributeKeyValue('seMetering', { multiplier: 1, divisor: 100 });
        await reporting.currentSummDelivered(endpoint);
    },
};

@Koenkk
Copy link
Owner

Koenkk commented Dec 9, 2023

Thanks for the PR but it will be added in #6637

@Koenkk Koenkk closed this Dec 9, 2023
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

Successfully merging this pull request may close these issues.

2 participants