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

How can I get the accumulated energy in Watts/hour? (CON-1359) #1102

Open
JoseAntonioMG opened this issue Oct 1, 2024 · 11 comments
Open

How can I get the accumulated energy in Watts/hour? (CON-1359) #1102

JoseAntonioMG opened this issue Oct 1, 2024 · 11 comments

Comments

@JoseAntonioMG
Copy link

How can I get the accumulated energy in Watts/hour?
I am using the electrical_power_measurement cluster and also the electrical_energy_measurement cluster, to obtain the current power data, such as voltage, alternating current and watts, but I do not know how to obtain the accumulated consumption data in watts/hour.

This is app_main.cpp code:

extern "C" void app_main()
{
  esp_err_t err = ESP_OK;
  nvs_flash_init();
  app_driver_handle_t electrical_sensor_handle = app_driver_PZEM004T_sensor_init();
  app_driver_handle_t light_handle = app_driver_light_init();
  app_driver_handle_t button_handle = app_driver_button_init();
  app_reset_button_register(button_handle);
  node::config_t node_config;
  node_t *node = node::create(&node_config, app_attribute_update_cb, app_identification_cb);
  if (node!=nullptr)
  {
    on_off_light::config_t on_off_light_config;
    endpoint_t *light_endpoint = on_off_light::create(node, &on_off_light_config, ENDPOINT_FLAG_NONE, light_handle);
    if (light_endpoint)
    {
      light_endpoint_id = endpoint::get_id(light_endpoint);
      ESP_LOGI(TAG, "Light Endpoint: %d", light_endpoint_id);
    }
    electrical_sensor::config_t electrical_sensor_config;
    endpoint_t *electrical_endpoint = electrical_sensor::create(node, &electrical_sensor_config, ENDPOINT_FLAG_NONE, electrical_sensor_handle);
    if (electrical_endpoint)
    {
      electrical_endpoint_id = endpoint::get_id(electrical_endpoint);
      ESP_LOGI(TAG, "Device energy management Endpoint: %d", electrical_endpoint_id);
    }
    cluster::electrical_power_measurement::config_t measurement_power_config;
    esp_matter::cluster_t *epower_cluster = cluster::electrical_power_measurement::create(electrical_endpoint, &measurement_power_config, CLUSTER_FLAG_SERVER, cluster::electrical_power_measurement::feature::alternating_current::get_id());
    cluster::electrical_energy_measurement::config_t measurement_energy_config;
    esp_matter::cluster_t *energy_cluster = cluster::electrical_energy_measurement::create(electrical_endpoint, &measurement_energy_config, CLUSTER_FLAG_SERVER, cluster::electrical_energy_measurement::feature::cumulative_energy::get_id() | cluster::electrical_energy_measurement::feature::imported_energy::get_id());
    int64_t Voltaje = 0;
    int64_t Watios = 0;
    int64_t Amperios = 0;
    int64_t WatiosAcumulados = 0;
    cluster::electrical_power_measurement::attribute::create_voltage(epower_cluster, Voltaje);
    cluster::electrical_power_measurement::attribute::create_active_power(epower_cluster, Watios);
    cluster::electrical_power_measurement::attribute::create_active_current(epower_cluster, Amperios);
    cluster::electrical_power_measurement::attribute::create_reactive_power(epower_cluster, WatiosAcumulados);
    cluster::electrical_energy_measurement::attribute::create_cumulative_energy_imported(energy_cluster,0, 8, 1);
    esp_openthread_platform_config_t config = {.radio_config = ESP_OPENTHREAD_DEFAULT_RADIO_CONFIG(), .host_config = ESP_OPENTHREAD_DEFAULT_HOST_CONFIG(), .port_config = ESP_OPENTHREAD_DEFAULT_PORT_CONFIG(),};
    set_openthread_platform_config(&config);
    err = esp_matter::start(app_event_cb);
    if(err==ESP_OK)
    {
      esp_matter::console::diagnostics_register_commands();
      esp_matter::console::init();
    }
    else
    {
      ESP_LOGE(TAG, "Fallo en el arranque de Matter, err:%d", err);
    }
  }
  else
  {
    ESP_LOGE(TAG, "Fallo al crear el nodo de Matter");
  }
}

Then in the app_driver.cpp file I added the lines to update the attributes:

static void PZEM004T(void *pvParameter)
{
  struct current_values pzValues;
  esp_matter_attr_val_t voltaje = esp_matter_invalid(NULL);
  esp_matter_attr_val_t Amperios = esp_matter_invalid(NULL);
  esp_matter_attr_val_t Watios = esp_matter_invalid(NULL);
  esp_matter_attr_val_t WatiosAcumulados = esp_matter_invalid(NULL);
  ESP_LOGI(TAG, "Starting PZEM004T ...");
  while (1==1)
  {
    PzemGetValues(&pzValues);
    voltaje.type = esp_matter_val_type_t::ESP_MATTER_VAL_TYPE_INT64;
    voltaje.val.i64 = pzValues.voltage;
    Amperios.type = esp_matter_val_type_t::ESP_MATTER_VAL_TYPE_INT64;
    Amperios.val.i64 = pzValues.current;
    Watios.type = esp_matter_val_type_t::ESP_MATTER_VAL_TYPE_INT64;
    Watios.val.i64 = pzValues.power;
    WatiosAcumulados.type = esp_matter_val_type_t::ESP_MATTER_VAL_TYPE_INT64;
    WatiosAcumulados.val.i64 = pzValues.energy;
    esp_matter::attribute::update(electrical_endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::Voltage::Id, &voltaje);
    esp_matter::attribute::update(electrical_endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::ActiveCurrent::Id, &Amperios);
    esp_matter::attribute::update(electrical_endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::ActivePower::Id, &Watios);
    esp_matter::attribute::update(electrical_endpoint_id, ElectricalEnergyMeasurement::Id, ElectricalEnergyMeasurement::Attributes::CumulativeEnergyImported::Id, &WatiosAcumulados);
    vTaskDelay(DEFAULT_MEASURE_INTERVAL / portTICK_PERIOD_MS);
  }
  vTaskDelete(NULL);
}

However, the following errors appear:

I (181960) PZEM-004T: CRC check OK for GetValues()
I (181960) esp_matter_attribute: ********** W : Endpoint 0x0002's Cluster 0x00000090's Attribute 0x00000004 is 234 **********
I (181960) esp_matter_attribute: ********** W : Endpoint 0x0002's Cluster 0x00000090's Attribute 0x00000005 is 0 **********
I (181960) esp_matter_attribute: ********** W : Endpoint 0x0002's Cluster 0x00000090's Attribute 0x00000008 is 6 **********
I (181960) esp_matter_attribute: ********** W : Endpoint 0x0002's Cluster 0x00000091's Attribute 0x00000001 is 8 **********
I (181960) esp_matter_attribute: ********** R : Endpoint 0x0002's Cluster 0x00000090's Attribute 0x00000008 is 6 **********
I (181970) esp_matter_attribute: ********** R : Endpoint 0x0002's Cluster 0x00000090's Attribute 0x00000004 is 234 **********
I (181970) esp_matter_attribute: ********** R : Endpoint 0x0002's Cluster 0x00000090's Attribute 0x00000005 is 0 **********
I (181970) esp_matter_attribute: ********** R : Endpoint 0x0002's Cluster 0x00000091's Attribute 0x00000001 is <invalid type: 4> **********
E (181970) esp_matter_attribute: Insufficient space for reading Endpoint 0x0002's Cluster 0x00000091's Attribute 0x00000001: required: 4, max: 2
I (181970) chip[EM]: <<< [E:29462i S:22429 M:5844842] (S) Msg TX to 2:000000000001B669 [5EE6] [UDP:[FDDE:AD00:BEEF:CAFE:AB3E:6390:CD80:EBF]:36687] --- Type 0001:05 (IM:ReportData)
I (182050) chip[EM]: >>> [E:29462i S:22429 M:43702472 (Ack:5844842)] (S) Msg RX from 2:000000000001B669 [5EE6] --- Type 0001:01 (IM:StatusResponse)
I (182050) chip[IM]: Received status response, status is 0x00
I (182050) chip[EM]: <<< [E:29462i S:22429 M:5844843 (Ack:43702472)] (S) Msg TX to 2:000000000001B669 [5EE6] [UDP:[FDDE:AD00:BEEF:CAFE:AB3E:6390:CD80:EBF]:36687] --- Type 0000:10 (SecureChannel:StandaloneAck)
I (202030) PZEM-004T: CRC check OK for GetValues()
I (202030) esp_matter_attribute: ********** W : Endpoint 0x0002's Cluster 0x00000090's Attribute 0x00000004 is 235 **********
I (202030) esp_matter_attribute: ********** W : Endpoint 0x0002's Cluster 0x00000090's Attribute 0x00000005 is 0 **********
I (202030) esp_matter_attribute: ********** W : Endpoint 0x0002's Cluster 0x00000090's Attribute 0x00000008 is 6 **********
I (202030) esp_matter_attribute: ********** W : Endpoint 0x0002's Cluster 0x00000091's Attribute 0x00000001 is 8 **********
I (202030) esp_matter_attribute: ********** R : Endpoint 0x0002's Cluster 0x00000090's Attribute 0x00000008 is 6 **********
I (202030) esp_matter_attribute: ********** R : Endpoint 0x0002's Cluster 0x00000090's Attribute 0x00000004 is 235 **********
I (202030) esp_matter_attribute: ********** R : Endpoint 0x0002's Cluster 0x00000090's Attribute 0x00000005 is 0 **********
I (202030) esp_matter_attribute: ********** R : Endpoint 0x0002's Cluster 0x00000091's Attribute 0x00000001 is <invalid type: 4> **********
E (202040) esp_matter_attribute: Insufficient space for reading Endpoint 0x0002's Cluster 0x00000091's Attribute 0x00000001: required: 4, max: 2
I (202040) chip[EM]: <<< [E:29463i S:22429 M:5844844] (S) Msg TX to 2:000000000001B669 [5EE6] [UDP:[FDDE:AD00:BEEF:CAFE:AB3E:6390:CD80:EBF]:36687] --- Type 0001:05 (IM:ReportData)
I (202110) chip[EM]: >>> [E:29463i S:22429 M:43702473 (Ack:5844844)] (S) Msg RX from 2:000000000001B669 [5EE6] --- Type 0001:01 (IM:StatusResponse)
I (202110) chip[IM]: Received status response, status is 0x00
I (202110) chip[EM]: <<< [E:29463i S:22429 M:5844845 (Ack:43702473)] (S) Msg TX to 2:000000000001B669 [5EE6] [UDP:[FDDE:AD00:BEEF:CAFE:AB3E:6390:CD80:EBF]:36687] --- Type 0000:10 (SecureChannel:StandaloneAck)
I (222100) PZEM-004T: CRC check OK for GetValues()
I (222100) esp_matter_attribute: ********** W : Endpoint 0x0002's Cluster 0x00000090's Attribute 0x00000004 is 235 **********
I (222100) esp_matter_attribute: ********** W : Endpoint 0x0002's Cluster 0x00000090's Attribute 0x00000005 is 0 **********
I (222100) esp_matter_attribute: ********** W : Endpoint 0x0002's Cluster 0x00000090's Attribute 0x00000008 is 6 **********
I (222100) esp_matter_attribute: ********** W : Endpoint 0x0002's Cluster 0x00000091's Attribute 0x00000001 is 8 **********
I (222100) esp_matter_attribute: ********** R : Endpoint 0x0002's Cluster 0x00000090's Attribute 0x00000008 is 6 **********
I (222110) esp_matter_attribute: ********** R : Endpoint 0x0002's Cluster 0x00000090's Attribute 0x00000004 is 235 **********
I (222110) esp_matter_attribute: ********** R : Endpoint 0x0002's Cluster 0x00000090's Attribute 0x00000005 is 0 **********
I (222110) esp_matter_attribute: ********** R : Endpoint 0x0002's Cluster 0x00000091's Attribute 0x00000001 is <invalid type: 4> **********
E (222110) esp_matter_attribute: Insufficient space for reading Endpoint 0x0002's Cluster 0x00000091's Attribute 0x00000001: required: 4, max: 2
I (222110) chip[EM]: <<< [E:29464i S:22429 M:5844846] (S) Msg TX to 2:000000000001B669 [5EE6] [UDP:[FDDE:AD00:BEEF:CAFE:AB3E:6390:CD80:EBF]:36687] --- Type 0001:05 (IM:ReportData)
I (222170) chip[EM]: >>> [E:29464i S:22429 M:43702474 (Ack:5844846)] (S) Msg RX from 2:000000000001B669 [5EE6] --- Type 0001:01 (IM:StatusResponse)
I (222170) chip[IM]: Received status response, status is 0x00
I (222170) chip[EM]: <<< [E:29464i S:22429 M:5844847 (Ack:43702474)] (S) Msg TX to 2:000000000001B669 [5EE6] [UDP:[FDDE:AD00:BEEF:CAFE:AB3E:6390:CD80:EBF]:36687] --- Type 0000:10 (SecureChannel:StandaloneAck)

@github-actions github-actions bot changed the title How can I get the accumulated energy in Watts/hour? How can I get the accumulated energy in Watts/hour? (CON-1359) Oct 1, 2024
@lboue
Copy link
Contributor

lboue commented Oct 3, 2024

Have you been able to identify the cause of this error?

@JoseAntonioMG
Copy link
Author

No

@jadhavrohit924
Copy link
Contributor

@JoseAntonioMG Power can be easily calculated using voltage and current, right?
Please check #1092 (comment) for the error you got.

@JoseAntonioMG
Copy link
Author

@jadhavrohit924, i get the power from the PZEM004T, I also get the watts/hour. Have you seen the code I wrote above in the app_driver.cpp?
The question is to assign the watts/hour values ​​that I get from the PZEM004T to an attribute that is of accumulated energy, for this I have used the electrical_energy_measurement cluster, which has the attributes CumulativeEnergyImported, CumulativeEnergyExported, periodicEnergyImported and periodicEnergyExported. I suppose that these attributes are used to update the accumulated energy values ​​(watts/hour) that are obtained from the PZEM004T device.
However I have written the code above and the error occurs:

esp_matter_attribute: Insufficient space for reading Endpoint 0x0002's Cluster 0x00000091's Attribute 0x00000001: required: 4, max: 2

I seen the #1092 comment and it does not solve the problem since electrical_energy_measurement does not have a delegate.

also i seen the #1075 comment, where you mention this problem but I do not know how it is implemented with SDK connectedhomeip.
Is there no documentation on this? or an example code that clarifies how to do it?

Thanks for your interest.

@HamzaHajeir
Copy link

@jadhavrohit924, i get the power from the PZEM004T, I also get the watts/hour. Have you seen the code I wrote above in the app_driver.cpp? The question is to assign the watts/hour values ​​that I get from the PZEM004T to an attribute that is of accumulated energy, for this I have used the electrical_energy_measurement cluster, which has the attributes CumulativeEnergyImported, CumulativeEnergyExported, periodicEnergyImported and periodicEnergyExported. I suppose that these attributes are used to update the accumulated energy values ​​(watts/hour) that are obtained from the PZEM004T device. However I have written the code above and the error occurs:

esp_matter_attribute: Insufficient space for reading Endpoint 0x0002's Cluster 0x00000091's Attribute 0x00000001: required: 4, max: 2

I seen the #1092 comment and it does not solve the problem since electrical_energy_measurement does not have a delegate.

also i seen the #1075 comment, where you mention this problem but I do not know how it is implemented with SDK connectedhomeip. Is there no documentation on this? or an example code that clarifies how to do it?

Thanks for your interest.

For updating energy I've a working code:

on global:

#include <app/clusters/electrical-energy-measurement-server/electrical-energy-measurement-server.h>
chip::app::Clusters::ElectricalEnergyMeasurement::ElectricalEnergyMeasurementAttrAccess* energyMeasurementAccess;

Initializing the cluster:

	esp_matter::cluster::electrical_energy_measurement::config_t energy_measurement_config;
	auto cumulative_energy_feature = esp_matter::cluster::electrical_energy_measurement::feature::cumulative_energy::get_id();
	auto exported_energy_feature = esp_matter::cluster::electrical_energy_measurement::feature::exported_energy::get_id();

	auto relay_energy_measurement_cluster = esp_matter::cluster::electrical_energy_measurement::create(relay_endpoint, &energy_measurement_config, esp_matter::CLUSTER_FLAG_SERVER, cumulative_energy_feature | exported_energy_feature);

	auto mask = chip::BitMask<chip::app::Clusters::ElectricalEnergyMeasurement::Feature>(chip::app::Clusters::ElectricalEnergyMeasurement::Feature::kCumulativeEnergy, chip::app::Clusters::ElectricalEnergyMeasurement::Feature::kExportedEnergy);
	auto optionalmask = chip::BitMask<chip::app::Clusters::ElectricalEnergyMeasurement::OptionalAttributes>(chip::app::Clusters::ElectricalEnergyMeasurement::OptionalAttributes::kOptionalAttributeCumulativeEnergyReset);
	energyMeasurementAccess = new chip::app::Clusters::ElectricalEnergyMeasurement::ElectricalEnergyMeasurementAttrAccess(mask,optionalmask);

	// energyMeasurementAccess.mEndpointId=relay_endpoint_id;
	auto initerr = energyMeasurementAccess->Init();
	if (chip::ChipError::IsSuccess(initerr) == false) {
		logger.E("energyMeasurementAccess->Init() ERR %u %u", initerr.GetRange(), initerr.GetValue());
	}
	

	chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyStruct::Type measurementAccuracy;
	chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyRangeStruct::Type measurementAccuracyRange;
	measurementAccuracy.measured = true;
	measurementAccuracy.measurementType = chip::app::Clusters::detail::MeasurementTypeEnum::kElectricalEnergy;
	measurementAccuracy.maxMeasuredValue = max_energy;
	measurementAccuracy.minMeasuredValue = 0;

	measurementAccuracyRange.rangeMax = max_energy;
	measurementAccuracyRange.rangeMin = 0;
	measurementAccuracyRange.percentMax.SetValue(energy_max_accuracy);
	measurementAccuracyRange.percentMin.SetValue(energy_min_accuracy);
	measurementAccuracyRange.percentTypical.SetValue(energy_typ_accuracy);
	// measurementAccuracyRange.fixedMax.SetValue(187650443764698);
	// measurementAccuracyRange.fixedMin.SetValue(187650443764696);
	// measurementAccuracyRange.fixedTypical.SetValue(0);
	measurementAccuracy.accuracyRanges = {measurementAccuracyRange};
	// chip::app::Clusters::ElectricalEnergyMeasurement::
	auto err = chip::app::Clusters::ElectricalEnergyMeasurement::SetMeasurementAccuracy(relay_endpoint_id, measurementAccuracy);
	if (chip::ChipError::IsSuccess(err) == false) { 
		logger.E("SetMeasurementAccuracy ERR %u %u", err.GetRange(), err.GetValue()); // Change to log_e or your own logger
	}

Then when an energy value is ready:

			chip::app::Clusters::ElectricalEnergyMeasurement::Structs::EnergyMeasurementStruct::Type measurement;
			measurement.startTimestamp.SetValue(energy_start_time); // Change to your marked start EPOCH time of energy
			measurement.endTimestamp.SetValue(getEPOCHTime()); // Change to your own API to get EPOCH time (Or use systime APIs)
			measurement.energy = value;
			
			chip::DeviceLayer::StackLock lock;
			auto success = chip::app::Clusters::ElectricalEnergyMeasurement::NotifyCumulativeEnergyMeasured(endpoint_id, {}, chip::Optional<chip::app::Clusters::ElectricalEnergyMeasurement::Structs::EnergyMeasurementStruct::Type> (measurement));
			logger.I("NotifyCumulativeEnergyMeasured() -> %u", success);

Note that I have only one issue not solved for now: Energy accuracy, which reads out in chip-tool empty:

>>> electricalenergymeasurement read accuracy 0x2222 0x2
[1728767805.459424][26766:26766] CHIP:TOO: Command: electricalenergymeasurement read accuracy 0x2222 0x2
[1728767805.459642][26766:26787] CHIP:TOO: Sending command to node 0x2222
[1728767805.459856][26766:26787] CHIP:CSM: FindOrEstablishSession: PeerId = [1:0000000000002222]
[1728767805.459883][26766:26787] CHIP:CSM: FindOrEstablishSession: No existing OperationalSessionSetup instance found
[1728767805.459896][26766:26787] CHIP:DIS: Found an existing secure session to [1:0000000000002222]!
[1728767805.459922][26766:26787] CHIP:DIS: OperationalSessionSetup[1:0000000000002222]: State change 1 --> 5
[1728767805.459933][26766:26787] CHIP:TOO: Sending ReadAttribute to:
[1728767805.459960][26766:26787] CHIP:TOO:      cluster 0x0000_0091, attribute: 0x0000_0000, endpoint 2
[1728767805.459985][26766:26787] CHIP:DMG: SendReadRequest ReadClient[0x7fade000a740]: Sending Read Request
[1728767805.460082][26766:26787] CHIP:EM: <<< [E:15914i S:29226 M:94832233] (S) Msg TX to 1:0000000000002222 [2858] [UDP:[fe80::6ab6:b3ff:fe52:b16c%eth0]:5540] --- Type 0001:02 (IM:ReadRequest)
[1728767805.460154][26766:26787] CHIP:DMG: MoveToState ReadClient[0x7fade000a740]: Moving to [AwaitingIn]
[1728767805.486474][26766:26787] CHIP:EM: >>> [E:15914i S:29226 M:100204619 (Ack:94832233)] (S) Msg RX from 1:0000000000002222 [2858] --- Type 0001:05 (IM:ReportData)
[1728767805.486517][26766:26787] CHIP:EM: Found matching exchange: 15914i, Delegate: 0x7fade000a750
[1728767805.486527][26766:26787] CHIP:EM: Rxd Ack; Removing MessageCounter:94832233 from Retrans Table on exchange 15914i
[1728767805.486569][26766:26787] CHIP:DMG: ReportDataMessage =
[1728767805.486595][26766:26787] CHIP:DMG: {
[1728767805.486619][26766:26787] CHIP:DMG:      AttributeReportIBs =
[1728767805.486648][26766:26787] CHIP:DMG:      [
[1728767805.486672][26766:26787] CHIP:DMG:              AttributeReportIB =
[1728767805.486682][26766:26787] CHIP:DMG:              {
[1728767805.486705][26766:26787] CHIP:DMG:                      AttributeDataIB =
[1728767805.486731][26766:26787] CHIP:DMG:                      {
[1728767805.486757][26766:26787] CHIP:DMG:                              DataVersion = 0x60e48cb3,
[1728767805.486763][26766:26787] CHIP:DMG:                              AttributePathIB =
[1728767805.486767][26766:26787] CHIP:DMG:                              {
[1728767805.486772][26766:26787] CHIP:DMG:                                      Endpoint = 0x2,
[1728767805.486777][26766:26787] CHIP:DMG:                                      Cluster = 0x91,
[1728767805.486782][26766:26787] CHIP:DMG:                                      Attribute = 0x0000_0000,
[1728767805.486787][26766:26787] CHIP:DMG:                              }
[1728767805.486792][26766:26787] CHIP:DMG:
[1728767805.486814][26766:26787] CHIP:DMG:                              Data =
[1728767805.486821][26766:26787] CHIP:DMG:                              {
[1728767805.486827][26766:26787] CHIP:DMG:                                      0x0 = 0 (unsigned),
[1728767805.486866][26766:26787] CHIP:DMG:                                      0x1 = false,
[1728767805.486918][26766:26787] CHIP:DMG:                                      0x2 = 0 (signed),
[1728767805.486945][26766:26787] CHIP:DMG:                                      0x3 = 0 (signed),
[1728767805.486953][26766:26787] CHIP:DMG:                                      0x4 = [
[1728767805.486982][26766:26787] CHIP:DMG:
[1728767805.486991][26766:26787] CHIP:DMG:                                      ],
[1728767805.486998][26766:26787] CHIP:DMG:                              },
[1728767805.487003][26766:26787] CHIP:DMG:                      },
[1728767805.487011][26766:26787] CHIP:DMG:
[1728767805.487017][26766:26787] CHIP:DMG:              },
[1728767805.487023][26766:26787] CHIP:DMG:
[1728767805.487045][26766:26787] CHIP:DMG:      ],
[1728767805.487054][26766:26787] CHIP:DMG:
[1728767805.487058][26766:26787] CHIP:DMG:      SuppressResponse = true,
[1728767805.487081][26766:26787] CHIP:DMG:      InteractionModelRevision = 11
[1728767805.487088][26766:26787] CHIP:DMG: }
[1728767805.487145][26766:26787] CHIP:TOO: Endpoint: 2 Cluster: 0x0000_0091 Attribute 0x0000_0000 DataVersion: 1625590963
[1728767805.487569][26766:26787] CHIP:TOO:   Accuracy: {
[1728767805.487659][26766:26787] CHIP:TOO:     MeasurementType: 0
[1728767805.487720][26766:26787] CHIP:TOO:     Measured: FALSE
[1728767805.487746][26766:26787] CHIP:TOO:     MinMeasuredValue: 0
[1728767805.487752][26766:26787] CHIP:TOO:     MaxMeasuredValue: 0
[1728767805.487776][26766:26787] CHIP:TOO:     AccuracyRanges: 0 entries
[1728767805.487853][26766:26787] CHIP:TOO:    }

@HamzaHajeir
Copy link

Update: I've just called to set measurement accuracy after the initialization process, and it worked.

Just ensure the Accuracy Ranges be a static or global; because the list of accuracy ranges is captured as a span.

@JoseAntonioMG
Copy link
Author

@HamzaHajeir I'm going to try it, I'll tell you how it went.

@hatl
Copy link

hatl commented Nov 10, 2024

Update: I've just called to set measurement accuracy after the initialization process, and it worked.

Just ensure the Accuracy Ranges be a static or global; because the list of accuracy ranges is captured as a span.

hi
what exactly do you mean by "after the initialization process".
could you please share the updated/working code?

@HamzaHajeir
Copy link

hi what exactly do you mean by "after the initialization process". could you please share the updated/working code?

I meant after calling esp_matter::start() at minimum, I was beforehand setting the accuracy ranges before esp_matter get started.

@hatl
Copy link

hatl commented Nov 20, 2024

thanks. i got the code working - at least partly.
the reporting of the energy values only works for the first few seconds (~30).
then i constantly get errors like the following:

I (947524) chip[EVL]: Dropped 1 event from buffer with priority 1 and event number  0x000000000006008F due to overflow: event priority_level: 1
I (952524) chip[EVL]: Dropped 1 event from buffer with priority 1 and event number  0x0000000000060090 due to overflow: event priority_level: 1
I (957524) chip[EVL]: Dropped 1 event from buffer with priority 1 and event number  0x0000000000060091 due to overflow: event priority_level: 1
I (962524) chip[EVL]: Dropped 1 event from buffer with priority 1 and event number  0x0000000000060092 due to overflow: event priority_level: 1
I (967524) chip[EVL]: Dropped 1 event from buffer with priority 1 and event number  0x0000000000060093 due to overflow: event priority_level: 1
I (972524) chip[EVL]: Dropped 1 event from buffer with priority 1 and event number  0x0000000000060094 due to overflow: event priority_level: 1

do you have any idea what could cause this?

@HamzaHajeir
Copy link

thanks. i got the code working - at least partly. the reporting of the energy values only works for the first few seconds (~30). then i constantly get errors like the following:

I (947524) chip[EVL]: Dropped 1 event from buffer with priority 1 and event number  0x000000000006008F due to overflow: event priority_level: 1
I (952524) chip[EVL]: Dropped 1 event from buffer with priority 1 and event number  0x0000000000060090 due to overflow: event priority_level: 1
I (957524) chip[EVL]: Dropped 1 event from buffer with priority 1 and event number  0x0000000000060091 due to overflow: event priority_level: 1
I (962524) chip[EVL]: Dropped 1 event from buffer with priority 1 and event number  0x0000000000060092 due to overflow: event priority_level: 1
I (967524) chip[EVL]: Dropped 1 event from buffer with priority 1 and event number  0x0000000000060093 due to overflow: event priority_level: 1
I (972524) chip[EVL]: Dropped 1 event from buffer with priority 1 and event number  0x0000000000060094 due to overflow: event priority_level: 1

do you have any idea what could cause this?

Not, really. Perhaps something in the command issuer?

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

5 participants