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

Innr SP-242 Smart Plug not reporting status automatically #6747

Open
davmc123 opened this issue Dec 21, 2023 · 126 comments
Open

Innr SP-242 Smart Plug not reporting status automatically #6747

davmc123 opened this issue Dec 21, 2023 · 126 comments

Comments

@davmc123
Copy link

The device support recently added in PR: Add device support for: Innr SP-242 Smart Plug #6703, does not seem to be reporting status information and sensor readings automatically. They only update when the 'Refresh' buttons are pressed in the Z2M 'Exposes' tab. This includes switch 'State', 'Power', 'Voltage' and 'Current'.

If I press the 'Apply' button for each item listed in the 'Reporting' settings menu, the smart plug will start reporting the sensors automatically, one by one.

If the smart plug is unplugged and plugged in again (power cycled) it stops reporting automatically. Pressing the 'Apply' button again for each item allows the automatic reporting to continue.

Smart Plug Info

Zigbee Model SP 242
Firmware build date 20231019
Firmware version 1.4.3

Zigbee2MQTT Info

Zigbee2MQTT Bridge Coordinator Version 6.10.3.0 build 297
Zigbee2MQTT Bridge Version 1.34.0-dev
@Koenkk
Copy link
Owner

Koenkk commented Dec 21, 2023

@ukgrant can you confirm this issue?

@ukgrant
Copy link
Contributor

ukgrant commented Dec 21, 2023

Yes, I've just tested these steps and it behaves exactly as described by @davmc123 :(
Any ideas what the cause could be?

@Koenkk
Copy link
Owner

Koenkk commented Dec 22, 2023

Pushed a fix, let me know if it works.

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

@davmc123
Copy link
Author

davmc123 commented Dec 23, 2023

Updated to the latest Z2M development image, but still getting the same behaviour where reporting stops working after a power cycle of the smart plug

Zigbee2MQTT version
1.34.0-dev commit: 1a72650
Coordinator type
EZSP v8
Coordinator revision
6.10.3.0 build 297

Frontend version
0.6.149
Zigbee-herdsman-converters version
16.17.0
Zigbee-herdsman version
0.28.0

@Koenkk
Copy link
Owner

Koenkk commented Dec 24, 2023

Could you provide the debug log of this?

See this on how to enable debug logging.

@davmc123
Copy link
Author

davmc123 commented Dec 25, 2023

log_short.txt
log.txt

Powered off the Smart Plug "Innr Smart Plug 2" at 23:09:40 and back on at 23:10:00, I'm not sure if the log is really showing anything useful though.

"Innr Smart Plug 2" doesn't appear again in the log until 23:26:13 when I some switch on/off commands from home assistant

I also attached the full log file but I don't think it will provide any more insight than the short one.

@Koenkk
Copy link
Owner

Koenkk commented Dec 25, 2023

I would expect a "device announce" when the device is plugged back into power, @ukgrant does it do this in your case?

@ukgrant
Copy link
Contributor

ukgrant commented Dec 27, 2023

I've tested and no announcement is published when power cycling this device. Others do...

@Koenkk
Copy link
Owner

Koenkk commented Dec 27, 2023

Then I cannot solve this problem from Z2M, it has to be fixed in the firmware. I've notified my contact person at Innr about this issue.

@remybohmer
Copy link

Just FYI: The Innr SP-240 device suffers from exactly the same bug.

@Koenkk
Copy link
Owner

Koenkk commented Jan 2, 2024

Innr confirmed this issue and is looking into a solution, once fixed they will probably provide an OTA update (which can be done via Z2M)

@WhimsySpoon
Copy link

I have the SP 242 with the same issues. Fortunately mine won't often be power cycled, so I hit the various apply buttons in the Reporting tab and it's been working well.

I have however noticed the green button flashes at random intervals. I can find no mention of this in any documentation. Could this be a side effect of this issue or the work around?

@Koenkk
Copy link
Owner

Koenkk commented Jan 3, 2024

Could this be a side effect of this issue or the work around?

No workaround has been implemented as of now.

@WhimsySpoon
Copy link

Apologies, I meant the action of going into the reporting menu and hitting apply on the various endpoints.

@Koenkk
Copy link
Owner

Koenkk commented Jan 3, 2024

What is the issue with this?

@WhimsySpoon
Copy link

It might not be an issue; I just wouldn't expect the power button to flash rapidly for a few seconds every minute or so, especially when the device state is off. It almost looks as if it's in a pairing mode (which it isn't).

I'll raise it with Innr directly as it's probably not related to this issue and I don't want to derail this issue any further.

@ablig77
Copy link

ablig77 commented Jan 13, 2024

FYI, my SP-242 device, same fw 1.4.3, exhibits the same issues reported.

@jwmcintosh
Copy link

jwmcintosh commented Jan 24, 2024

Chiming in with SP244's exhibiting the same issue. fwiw

edit: I've been in contact with Innr and they report their expected ETA for the firmware update is Feb 20. It will be turned over immediately to the Z2M team for a commit to their code, after which we will be able to update the plugs themselves.

@jrossouw777
Copy link

Eagerly awaiting this firmware upgrade. I don't currently see my two SP 242 plugs under the OTA section on Z2M. Is that expected? I do see my other SP 222 plugs in there so thought I'd check to see if you guys are seeing the same?

@leander091
Copy link
Contributor

leander091 commented Feb 23, 2024

@jrossouw777, Zigbee2mqtt allows only the OTA capability when there is firmware available in the Zigbee-OTA repo. So until then the device won't show in the OTA section

@andyjayh
Copy link

andyjayh commented Mar 3, 2024

Just bought myself a few SP 242’s with f/w 1.4.3 to then stumble across this issue. I’ve tried hitting the Apply button for all lines in the reporting tab but after 24hrs only 1 out of 4 plugs is still reporting back.

Any news on the firmware update from Innr?

@Koenkk
Copy link
Owner

Koenkk commented Mar 3, 2024

No updates from Innr yet

@andyjayh
Copy link

andyjayh commented Mar 3, 2024

Shame as these look potentially good plugs.

Thanks for confirming no update yet, means I’m not missing anything from my OTA setting.

@trinode
Copy link
Contributor

trinode commented Mar 12, 2024

Is there a way to programatically set the reporting intervals via HA scripts or similar whilst we wait for a firmware?

The fix for the firmware, is that to remember the reporting interval across power cycles, or just to broadcast an announce message when power is restored? (Looks like there's logic to reapply the intervals if an announce occurs in that potential fix that was merged)

@ablig77
Copy link

ablig77 commented Mar 12, 2024

Eagerly awaiting this firmware upgrade. I don't currently see my two SP 242 plugs under the OTA section on Z2M. Is that expected? I do see my other SP 222 plugs in there so thought I'd check to see if you guys are seeing the same?

I have several SP 222 which do not exhibit the same problems.

@trinode
Copy link
Contributor

trinode commented Mar 23, 2024

To answer my own question, while we wait for a firmware update we can update the configuration to use polling to update the stats regularly (every 60s by default):

I've stolen the method the tuya plugs with the same issue use, and inlined it in this definition so it won't break if the tuya method is modified / removed.

As per that implementation there's a field called Measurement poll interval to set the number of seconds between stat updates.

Definition file:-

SP242.js

const {onOff, electricityMeter} = require('zigbee-herdsman-converters/lib/modernExtend');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const globalStore = require('zigbee-herdsman-converters/lib/store');
const utils = require('zigbee-herdsman-converters/lib/utils');
const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const e = exposes.presets;
const ea = exposes.access;

async function onEventMeasurementPoll(type, data, device, options,
    electricalMeasurement=true, metering=false) {
    const endpoint = device.getEndpoint(1);
    if (type === 'stop') {
        clearTimeout(globalStore.getValue(device, 'measurement_poll'));
        globalStore.clearValue(device, 'measurement_poll');
    } else if (!globalStore.hasValue(device, 'measurement_poll')) {
        const seconds = utils.toNumber(
            options && options.measurement_poll_interval ? options.measurement_poll_interval : 60, 'measurement_poll_interval');
        if (seconds === -1) return;
        const setTimer = () => {
            const timer = setTimeout(async () => {
                try {
                    if (electricalMeasurement) {
                        await endpoint.read('haElectricalMeasurement', ['rmsVoltage', 'rmsCurrent', 'activePower']);
                    }
                } catch (error) {/* Do nothing*/}
                try {
                    if (metering) {
                        await endpoint.read('seMetering', ['currentSummDelivered']);
                    }
                } catch (error) {/* Do nothing*/}
                setTimer();
            }, seconds * 1000);
            globalStore.putValue(device, 'measurement_poll', timer);
        };
        setTimer();
    }
}

const definition = {
    zigbeeModel: ['SP 242'],
    model: 'SP 242',
    vendor: 'Innr',
    description: 'Automatically generated definition',
    extend: [onOff({"powerOnBehavior":false}), electricityMeter({current: {divisor: 1000}, voltage: {divisor: 1}, power: {divisor: 1}, energy: {divisor: 100}})],
    meta: {},
    options: [exposes.options.measurement_poll_interval()],
    onEvent: (type, data, device, options) =>
        onEventMeasurementPoll(type, data, device, options,
            true, // polling for voltage, current and power
            true, // polling for energy
        ),

};

module.exports = definition;

add the file as an external definition in the configuration.yaml file:-

external_converters:
  - SP242.js

@rurlaender
Copy link

I have an SP240 but your script works like a charm after a few adaptions.

Thanks

@jrossouw777
Copy link

@trinode,

  1. Can you please confirm where I should place the js file? I've never needed to create an external converter so I'm not familiar with doing this.
  2. Am I correct in saying that the reference to the file should be added to the bottom of the configuration.yaml file under zigbee2mqtt folder?

Thanks!

@netcruiser2k10
Copy link

I have recently updated my Innr sp242 to the newest firmware and it is not updating the energy value even after removing and readding the plug to MQTT. I have inplemented the external converter above to enable polling to update the energy value for me. all the other figures like watts and voltage seem to be updating as they should just the Energy isnt. Can anyone help me with creating the bindings @GerryInnr suggested above in z2mqtt. I'll get using the external converter listed at the start of this thread for now.

@thebatfink
Copy link

Did you read the last few posts, it is only updating when there is something to update, you can change the settings to set lower maximum update durations.

@marbon87
Copy link

marbon87 commented Aug 7, 2024

@thebatfink the plug reports as requested from it by the bridge (or any other device). To receive attribute reports for voltage, current, power, and power consumption, the bridge must:

  • create bindings to clusters 0x0b04 (Electrical Measurement) and 0x0702 (Metering) on the plug
  • configure attribute reporting for attributes 0x0505 (RMSVoltage), 0x0508 (RMSCurrent), and 0x050b (ActivePower) in cluster 0x0b04, and attribute 0x0000 (CurrentSummationDelivered) in cluster 0x0702.

With the ConfigureAttributeReporting command, the bridge can define the minimum reporting interval, the maximum reporting interval, and the "reportable change", for every attribute individually:

  • reportable change: plug reports when there is a change >= this value since the last report
  • minimum interval: plug will not report more frequently than this
  • maximum interval: plug will send a report after this time even if there was no change.

So it depends on what the bridge configures, how fast the plug will report. You can let it report every second (wouldn't recommend that in a large network with many plugs). Also, in general, choose the reportable change value wisely as it can lead to multiple reports per second if set too small.

Hope this helps.

can someone tell me how i do this in home assistant?
I have two sps-242 with the latest firmware. One is updating the value regularly and the other one does not after i trief to configred it.

@thebatfink
Copy link

thebatfink commented Aug 7, 2024

Load up the z2m gui from Settings -> Addons -> Z2M -> Open WebUI.

In the devices list, find you device and go into it clicking the name. In the device details goto the Reporting tab. There you have min/max reporting intervals and minimum reporting change values on the end for each parameter. Change one, click apply corresponding to that row.

But bear in mind just because one updates and another doesn’t, maybe one just doesn’t have any change to report. They’ll only change as frequently as each other if the devices connected to them are pulling the same amount of energy out the wall (assuming this Reporting tab shows the same configuration variables in each device). If you have an LED bulb in one and the other has a washing machine connected to it, the one with the bulb isn’t going to update as frequently anyway.

Not suggesting these are ideal settings or anything but for an idea, I have all my parameters for min report interval as 5 except onoff 0, max report interval as 3600. Min rep change I set power and voltage to 5, current to 50, sumdelivered 500 and onoff 1. I took these from the default values from another brand of plug I had in my network. Find them OK for my automation needs. I assume the intervals are in minutes because for sure if they were seconds, my devices aren’t reporting every 60 minutes.

@marbon87
Copy link

marbon87 commented Aug 7, 2024

Thanks for the instructions.
But can this only be done with Z2M and not with ZHA? I am using ZHA at the moment and did not consider to migrate.

Besides there is energy usage to report by both switches.

@thebatfink
Copy link

thebatfink commented Aug 7, 2024

I don’t use it, maybe someone else can help. Started with zha and switched to z2m long time ago, never looked back.

@thebatfink
Copy link

thebatfink commented Sep 5, 2024

I recently updated the plugs to 1.7.23 on the latest version of z2m. On all the plugs I updated in the reporting tab of the device page in z2m gui I now have all the clusters duplicated and the plugs have stopped reporting again. Any one else noticed this?

Edit, only managed to resolve it by removing all the plugs and re-adding them to the network and configuring all the reporting intervals again. Bit of a pain.

@AndreasMouskos
Copy link

I am considering buying these plugs to use with z2m. Can someone confirm if the issues have been fixed with the latest update? Thanks in advance!

@Aber-s
Copy link

Aber-s commented Sep 6, 2024

Got the same question but with ZHA.

@megakid
Copy link

megakid commented Sep 6, 2024

I am considering buying these plugs to use with z2m. Can someone confirm if the issues have been fixed with the latest update? Thanks in advance!

They work perfectly on Z2M for me now

@Barcley1990
Copy link

For me it is still not working...

@thebatfink
Copy link

What is not working exactly?

@Barcley1990
Copy link

What is not working exactly?

The update of the consumed energy. I still have to click on the blue update button to be able to see any changes.
After the FW-update I completely removed the plug from z2mqtt and added it again, but still no improvements.

Bildschirmfoto 2024-09-09 um 19 38 31

I have not yet changed any of the other parameters in the report section as they work as expected (e.g. I receive updates of the power consumption if it changes 5W)
Bildschirmfoto 2024-09-09 um 19 41 18

Also I wonder why there is no option to change the report settings for the energy parameter?!

@thebatfink
Copy link

Set the maximum interval down on currentsumdelivered from 65000 to how often you want it to report no? I think how you have it will only update every 18 hours.

@Barcley1990
Copy link

Oh boy... I feel so stupid right now... currentsumdelivered.. Thank you.

@AlexanderLeporiday
Copy link

The issue of values not reporting after a power cycle are fixed but the default reporting configuration needs better default values. They seem to get reset after a firmware update so it would be good if the values were adjusted to report at least every 10 minutes or an hour, currently defaults to 18 hours. The minimum could be something like 5 or 10 seconds.

Is this something that could get changed in a future release? Is it worth marking this topic as resolved and closed and opening a new topic for the default reporting values?

@davmc123
Copy link
Author

The issue of values not reporting after a power cycle are fixed but the default reporting configuration needs better default values. They seem to get reset after a firmware update so it would be good if the values were adjusted to report at least every 10 minutes or an hour, currently defaults to 18 hours. The minimum could be something like 5 or 10 seconds.

Is this something that could get changed in a future release? Is it worth marking this topic as resolved and closed and opening a new topic for the default reporting values?

Haven't had time to properly test, but happy to close if the consensus is that the original issue of retaining reporting settings over power cycles is fixed? Not sure if default values are a Z2M or an Innr issue.

@AlexanderLeporiday
Copy link

The issue of values not reporting after a power cycle are fixed but the default reporting configuration needs better default values. They seem to get reset after a firmware update so it would be good if the values were adjusted to report at least every 10 minutes or an hour, currently defaults to 18 hours. The minimum could be something like 5 or 10 seconds.
Is this something that could get changed in a future release? Is it worth marking this topic as resolved and closed and opening a new topic for the default reporting values?

Haven't had time to properly test, but happy to close if the consensus is that the original issue of retaining reporting settings over power cycles is fixed? Not sure if default values are a Z2M or an Innr issue.

The work around is still in the code so it is harder to tell if it's working. The original issue was found because the devices weren't announcing themselves after a power cycle, is that correct? So to confirm we just need to update a device to latest firmware, power cycle it and check the logs for an announcement event from the device.

But the issue of default values being wrong after a firmware update is annoying as it makes it seem like it's broken again. My Kasa and Tapo devices are reporting every few seconds and innr devices appear to default to a few times a day.

@thebatfink
Copy link

It definitely does make it seem that way, after my latest firmware update (beyond the one that changed the tolerances of auto shut off protection, not announcing etc.) I for sure immediately thought it was broken again as it defaulted back to not updating with the long maximum update values resetting. If they can’t persist after firmware updates the defaults really ought to be changed imho.

@GerryInnr
Copy link

We'll check on both issues (default attribute reporting configuration, and not retaining attribute reporting configuration settings across software upgrades) and will provide a fix where applicable. Help of the SDK supplier is probably needed so I cannot provide an ETA yet. I'll leave it up to you to decide whether to keep this issue open or create a new one.

@netcruiser2k10
Copy link

netcruiser2k10 commented Sep 13, 2024

If im running the plugs using an external converter in z2mqtt do i need to i need to disable the external converter for the new update to show ? As the new update isnt showing as available on my plugs ?

Apologies if already been asked

@AlexanderLeporiday
Copy link

If im running the plugs using an external converter in z2mqtt do i need to i need to disable the external converter for the new update to show ? As the new update isnt showing as available on my plugs ?

Apologies if already been asked

If you're trying to update the firmware through zigbee2mqtt then you have to make sure that the app can see devices, version and firmware. Also has the ability to push firmware to it. To confirm this, go to your OTA section in the web front end. Example attached.
markup_1000000227

@netcruiser2k10
Copy link

I cant see it in the OTA list, is there a setting i need to change within the settings ?

In my z2mqtt config i do have the disable_automatic_update_check set to false so doubt it would be that

@AlexanderLeporiday
Copy link

My guess is that your converter is what is being detected by the zigbee bridge. This means that it can't see the underlying devices to connect them to over-the-air updates. Are you able to connect the zigbee devices directly or do you have to go through this converter? Is it possible to update the firmware through the converter? I don't know what converter you're using but it will need to also pull from the same pool of firmwares.

@netcruiser2k10
Copy link

Its possible the external converter is blocking it, i would need to disable it and then check again.

Will try this in a few days as im away from my main pc to do this.

Thanks for your help :)

@thebatfink
Copy link

Yes removal the external convertor, if you applied it to do the automated polling to work around the firmware issue, its no longer needed and OTA will come back.

@netcruiser2k10
Copy link

Noted, ill do the change.

Thanks

@AlexanderLeporiday
Copy link

Just had to setup the reporting of two of my plugs again because for whatever reason, maybe a power cut, they'd reset back to their default and I was only get 1 report a day. Changed to report every max every 60 seconds (minimum 5 seconds) and when volts and watts change by 1 or more and energy and current by 0.01 (So I can see 1 volt and 0.01 amp changes and every 10 watt hours of usage.

@FlorianOosterhof
Copy link

FlorianOosterhof commented Nov 22, 2024

We'll check on both issues (default attribute reporting configuration, and not retaining attribute reporting configuration settings across software upgrades) and will provide a fix where applicable. Help of the SDK supplier is probably needed so I cannot provide an ETA yet. I'll leave it up to you to decide whether to keep this issue open or create a new one.

I am considering buying Innr SP24x plugs, and wonder, @GerryInnr , if you may have an update for us on the 2 remaining issues. You mentioned that support from the SDK supplied may be necessary, so it may take a while. Can you perhaps let us know what the current status is?

@GerryInnr
Copy link

We'll check on both issues (default attribute reporting configuration, and not retaining attribute reporting configuration settings across software upgrades) and will provide a fix where applicable. Help of the SDK supplier is probably needed so I cannot provide an ETA yet. I'll leave it up to you to decide whether to keep this issue open or create a new one.

I am considering buying Innr SP24x plugs, and wonder, @GerryInnr , if you may have an update for us on the 2 remaining issues. You mentioned that support from the SDK supplied may be necessary, so it may take a while. Can you perhaps let us know what the current status is?

Hi @FlorianOosterhof I expect to be able to release a new firmware in December 2024 or January 2025.

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