fairecasoimeme / Zlinky_TIC

Téléinformation Linky autoalimenté ZigBee 3.0
291 stars 21 forks source link

Increase default reporting frequency for LiXee ZLinky_TIC Smartenergysummation #116

Open MayeulC opened 1 year ago

MayeulC commented 1 year ago

Default reporting frequency is very slow. It's possible to increase it via ZHA Toolkit though:

Dev tools -> Service -> yaml mode

service: zha_toolkit.conf_report
data:
  ieee: sensor.lixee_zlinky_tic_electricalmeasurement
  cluster: 1794
  attribute: 0
  max_interval: 200
  reportable_change: 1
  min_interval: 40

This configures the device to an arbitrary min reporting period of 40s, max of 200s, and min change of 1Wh. It would be nice to have it by default in the FW.

(_Originally posted in https://github.com/fairecasoimeme/Zlinky_TIC/issues/18#issuecomment-1285215566_)

The difference is pretty clear:

image

I am currently on FW v9, but the issue was present before as well v5, as well as the shipped version.

Related issues: #65 with @pipiche38 and @Tof-le-Chauve. Maybe @pdecat too from #19

fairecasoimeme commented 1 year ago

There aren't no default reporting in ZLinky at the begining. That is the coordinator accros a plugin/box which send config report to the ZLinky.

I think for this value It's ZHA which send a default config report with a low frequency

MayeulC commented 1 year ago

Thank you for clarifying. It would probably be a good idea to set one; that's not an issue I've had with any other device, including connected plugs, etc.

On the other hand, it's OK to leave it like that, as long as it's documented, IMO. It's quite hard to find good documentation on how to use the ZLinky (with zha). It might be worth opening this github repo's wiki, hosting a wiki somewhere else, or making a github pages-based website.

Ozaroth commented 1 year ago

Hi,

It doesn't work for me, any idea why ?

my log:

event_data {'zha_toolkit_version': 'v0.8.20', 'zigpy_version': '0.51.3', 'zigpy_rf_version': '0.34.2', 'ieee_org': 'sensor.lixee_zlinky_smartenergysummation', 'ieee': '00:15:8d:00:05:00:6f:fe', 'command': 'conf_report', 'command_data': None, 'start_time': '2022-10-27T20:29:42.613552+00:00', 'errors': [], 'params': {'cluster_id': 1794, 'attr_id': 0, 'min_interval': 40, 'max_interval': 59, 'reportable_change': 1, 'dir': 0, 'tries': 1, 'expect_reply': True, 'args': [], 'read_before_write': True, 'read_after_write': True}, 'success': False, 'result_conf': Configure_Reporting_rsp(status_records=[ConfigureReportingResponseRecord(status=<Status.INVALID_VALUE: 135>, direction=<ReportingDirection.SendReports: 0>, attrid=0)])}

Thanks !

MayeulC commented 1 year ago

@Ozaroth did you change some options? I see "expect_reply", "read_before_write", "max_interval" among others, that I didn't specify when doing this.

Ozaroth commented 1 year ago

@MayeulC only the max_interval.

service: zha_toolkit.conf_report data: ieee: 00:15:8d:00:05:00:6f:fe cluster: 1794 attribute: 0 max_interval: 59 reportable_change: 1 min_interval: 40 event_done: zha_done

and the result :

`event_type: zha_done data: zha_toolkit_version: v0.8.20 zigpy_version: 0.51.3 zigpy_rf_version: 0.34.2 ieee_org:

fairecasoimeme commented 1 year ago

Hi, max_interval must be greater than 60 for reporting #define MAX_REPORT_INTERVAL 0x3d

Ozaroth commented 1 year ago

Thank you @fairecasoimeme it's working !

bachy commented 1 year ago

Hi, I'm trying to increase the active_power report frequence like you did (for now reporting every 30min, unusable)

the conf_report seems to works, but active_power does not come more frequently

service: zha_toolkit.conf_report
data:
  ieee: 00:15:8d:00:05:ce:77:e0
  cluster: 2820
  attribute: 1291
  min_interval: 10
  max_interval: 61
  reportable_change: 1
  event_done: zha_done
DEBUG (MainThread) [custom_components.zha_toolkit] event_data {
'zha_toolkit_version': 'v0.8.26', 
'zigpy_version': '0.51.5', 
'zigpy_rf_version': '0.19.0', 
'ieee_org': 00:15:8d:00:05:ce:77:e0, 
'ieee': '00:15:8d:00:05:ce:77:e0', 
'command': 'conf_report', 
'command_data': None, 
'start_time': '2022-11-26T16:32:41.630726+00:00', 
'errors': [], 
'params': {
  'cluster_id': 2820,
  'attr_id': 1291,
  'min_interval': 10,
  'max_interval': 61,
  'reportable_change': 1,
  'dir': 0,
  'tries': 1,
  'expect_reply': True,
  'args': [],
  'event_done': 'zha_done',
  'read_before_write': True,
  'read_after_write': True
}, 
'success': True, 
'result_conf': Configure_Reporting_rsp(status_records=[ConfigureReportingResponseRecord(status=<Status.SUCCESS: 0>)])}
service: zha_toolkit.conf_report_read
data:
  ieee: 00:15:8d:00:05:ce:77:e0
  cluster: 2820
  attribute: 1291
DEBUG (MainThread) [custom_components.zha_toolkit] event_data {
'zha_toolkit_version': 'v0.8.26', 
'zigpy_version': '0.51.5', 
'zigpy_rf_version': '0.19.0', 
'ieee_org': 00:15:8d:00:05:ce:77:e0, 
'ieee': '00:15:8d:00:05:ce:77:e0', 
'command': 'conf_report_read', 
'command_data': None, 
'start_time': '2022-11-26T16:36:26.184368+00:00', 
'errors': [], 
'params': {
  'cluster_id': 2820, 
  'attr_id': 1291, 
  'dir': 0, 'tries': 1, 
  'expect_reply': True, 
  'args': [],
  'read_before_write': True,
  'read_after_write': True
}, 
'success': True, 
'result_conf': [
 {
  'cluster': 'Electrical Measurement', 
  'cluster_id': '0x0B04', 
  'ep': 1, 
  'attr_id': '0x050B', 
  'direction': <ReportingDirection.SendReports: 0>, 
  'status': <Status.SUCCESS: 0>, 
  'type': '0x29', 
  'min_interval': (10,), 
  'max_interval': (61,), 
  'attr': 'active_power'}
]}

any idea ?

misterbenj34 commented 1 year ago

Thanks @MayeulC , you're a life saver ! My ZLinky was working fine yesterday, but stopped reporting the "Summation Delivered" suddenly. Only the Apparent Power was reported every 40 seconds. I used your trick with ZHA toolkit, and it restored the values

I had to migrate to ZHA yesterday, because my integration in deCONZ was also failing after 1 day..

nerthazrim commented 1 year ago

Hi, I'm trying to increase the active_power report frequence like you did (for now reporting every 30min, unusable)

the conf_report seems to works, but active_power does not come more frequently

service: zha_toolkit.conf_report
data:
  ieee: 00:15:8d:00:05:ce:77:e0
  cluster: 2820
  attribute: 1291
  min_interval: 10
  max_interval: 61
  reportable_change: 1
  event_done: zha_done
DEBUG (MainThread) [custom_components.zha_toolkit] event_data {
'zha_toolkit_version': 'v0.8.26', 
'zigpy_version': '0.51.5', 
'zigpy_rf_version': '0.19.0', 
'ieee_org': 00:15:8d:00:05:ce:77:e0, 
'ieee': '00:15:8d:00:05:ce:77:e0', 
'command': 'conf_report', 
'command_data': None, 
'start_time': '2022-11-26T16:32:41.630726+00:00', 
'errors': [], 
'params': {
  'cluster_id': 2820,
  'attr_id': 1291,
  'min_interval': 10,
  'max_interval': 61,
  'reportable_change': 1,
  'dir': 0,
  'tries': 1,
  'expect_reply': True,
  'args': [],
  'event_done': 'zha_done',
  'read_before_write': True,
  'read_after_write': True
}, 
'success': True, 
'result_conf': Configure_Reporting_rsp(status_records=[ConfigureReportingResponseRecord(status=<Status.SUCCESS: 0>)])}
service: zha_toolkit.conf_report_read
data:
  ieee: 00:15:8d:00:05:ce:77:e0
  cluster: 2820
  attribute: 1291
DEBUG (MainThread) [custom_components.zha_toolkit] event_data {
'zha_toolkit_version': 'v0.8.26', 
'zigpy_version': '0.51.5', 
'zigpy_rf_version': '0.19.0', 
'ieee_org': 00:15:8d:00:05:ce:77:e0, 
'ieee': '00:15:8d:00:05:ce:77:e0', 
'command': 'conf_report_read', 
'command_data': None, 
'start_time': '2022-11-26T16:36:26.184368+00:00', 
'errors': [], 
'params': {
  'cluster_id': 2820, 
  'attr_id': 1291, 
  'dir': 0, 'tries': 1, 
  'expect_reply': True, 
  'args': [],
  'read_before_write': True,
  'read_after_write': True
}, 
'success': True, 
'result_conf': [
 {
  'cluster': 'Electrical Measurement', 
  'cluster_id': '0x0B04', 
  'ep': 1, 
  'attr_id': '0x050B', 
  'direction': <ReportingDirection.SendReports: 0>, 
  'status': <Status.SUCCESS: 0>, 
  'type': '0x29', 
  'min_interval': (10,), 
  'max_interval': (61,), 
  'attr': 'active_power'}
]}

any idea ?

Hi @bachy, did you find an answer to your questions, by any chance? I'm trying to do the same: increase the recording frequency of active_power by ZHA. Any help/guide would be appreciated :)

Thanks in advance

bachy commented 1 year ago

Hi @nerthazrim

No i never get to make it work. I gave up on zlinky-tic. I swictched to zigbee2mqtt, and now instead of zlinky i'm using multiple custom ptvo + pzem device which are working smoothly (reports every 5sec)

MayeulC commented 1 year ago

That cluster (CCASN, 2820/1291 aka b04/50b) sounds a bit weird:

Point n de la courbe de charge active soutirée

And it's only available in standard mode. Are you sure it's the right one? I suggest you try to read a clister from the UI on the device page to confirm it returns a value, and the right one, before configuring the reporting period.

Maybe you are looking for IINST | 0x0B04 | 0x0508 and you just mistyped/misread 8 as B?, Or PAPP | 0x0B04 | 0x050F?

Edit: with PAPP, it should be:

service: zha_toolkit.conf_report
data:
  ieee: sensor.lixee_zlinky_tic_electricalmeasurement
  cluster: 2820
  attribute: 1295
  max_interval: 200
  reportable_change: 5
  min_interval: 40

Notice how I replaced 1291 with 1295. I am a bit confused though, as when I perform a read from the interface, 0x50b also returns seemingly valid results. Anyway, both should work, apparent power should be a bit higher than active power, as apparent=active+reactive, but that's the important one, and I am not sure linky can measure reactive power?


Of course, another option is to differentiate the energy, as E=P*t -> P=E/t (dE/dt, the derivative, is more technically correct). E in joules (=1 W.s), t in seconds, P in watts.

nerthazrim commented 1 year ago

Thank you @fairecasoimeme it's working !

Hi @Ozaroth, would you mind sharing the conf snippet you're using, please? :)

Ozaroth commented 1 year ago

Hi @nerthazrim you want my conf for active_power ? If yes my config for active_power is the same as you and not working for me too, the value is reported every 30 minutes. but for current_summ_delivered it's working perfectly.

nerthazrim commented 1 year ago

Hi @nerthazrim you want my conf for active_power ? If yes my config for active_power is the same as you and not working for me too, the value is reported every 30 minutes. but for current_summ_delivered it's working perfectly. Damn it :( I thought you managed to find how to increase the frequency :(

I'll open a ticket with in the ZHA project. I guess that's the way to go.

nerthazrim commented 1 year ago

Well, actually, quick one for you @fairecasoimeme: we can read here (on a similar issue) https://github.com/home-assistant/core/issues/88166#issuecomment-1434857328

We don't pull date from the device, the device push data upon changes, we don't control the update rate.

Would it be possible that the ZLinky does not advertise properly a change in the "active_power" value to ZHA? Which then does not record a new value?

MayeulC commented 1 year ago

Well, actually, quick one for you @fairecasoimeme: we can read here (on a similar issue) home-assistant/core#88166 (comment)

We don't pull date from the device, the device push data upon changes, we don't control the update rate.

Would it be possible that the ZLinky does not advertise properly a change in the "active_power" value to ZHA? Which then does not record a new value?

The device pushes updates, but the coordinator can configure how often, which is what conf_report does. You can specify a minimum time in between updates, as well as a maximum time, and a change after which an update should be sent, for each property (though I think there is a maximum, perhaps about 10, properties that can be reported this way, probably dependent on the device.

Edit: though the thread linked was for a Shelly product which uses Wi-Fi/Bluetooth/Ethernet, not Zigbee, so it's a bit different.