-
Notifications
You must be signed in to change notification settings - Fork 499
Matter Switch: Add greater Energy profiling logic for Switches #2199
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
base: main
Are you sure you want to change the base?
Changes from all commits
f2288c7
f9c3651
ed69b5f
86f3173
cfbf2a9
5608223
1353f42
59be65e
beee0c4
6b8e9ef
8e59891
ca5b1d0
f2e532c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
name: light-level-power-energy-powerConsumption | ||
components: | ||
- id: main | ||
capabilities: | ||
- id: switch | ||
version: 1 | ||
- id: switchLevel | ||
version: 1 | ||
config: | ||
values: | ||
- key: "level.value" | ||
range: [1, 100] | ||
- id: powerMeter | ||
version: 1 | ||
- id: energyMeter | ||
version: 1 | ||
- id: powerConsumptionReport | ||
version: 1 | ||
- id: firmwareUpdate | ||
version: 1 | ||
- id: refresh | ||
version: 1 | ||
categories: | ||
- name: Light | ||
- id: main | ||
capabilities: | ||
- id: switch | ||
version: 1 | ||
- id: switchLevel | ||
version: 1 | ||
config: | ||
values: | ||
- key: "level.value" | ||
range: [1, 100] | ||
- id: powerMeter | ||
version: 1 | ||
- id: energyMeter | ||
version: 1 | ||
- id: powerConsumptionReport | ||
version: 1 | ||
- id: firmwareUpdate | ||
version: 1 | ||
- id: refresh | ||
version: 1 | ||
categories: | ||
- name: Light |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
name: light-power-energy-powerConsumption | ||
components: | ||
- id: main | ||
capabilities: | ||
- id: switch | ||
version: 1 | ||
- id: powerMeter | ||
version: 1 | ||
- id: energyMeter | ||
version: 1 | ||
- id: powerConsumptionReport | ||
version: 1 | ||
- id: firmwareUpdate | ||
version: 1 | ||
- id: refresh | ||
version: 1 | ||
categories: | ||
- name: Light | ||
- id: main | ||
capabilities: | ||
- id: switch | ||
version: 1 | ||
- id: powerMeter | ||
version: 1 | ||
- id: energyMeter | ||
version: 1 | ||
- id: powerConsumptionReport | ||
version: 1 | ||
- id: firmwareUpdate | ||
version: 1 | ||
- id: refresh | ||
version: 1 | ||
categories: | ||
- name: Light |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,8 @@ local aqara_mock_device = test.mock_device.build_test_matter_device({ | |
clusters = { | ||
{cluster_id = clusters.Basic.ID, cluster_type = "SERVER"}, | ||
{cluster_id = clusters.ElectricalPowerMeasurement.ID, cluster_type = "SERVER", cluster_revision = 1, feature_map = 2 }, | ||
{cluster_id = clusters.ElectricalEnergyMeasurement.ID, cluster_type = "SERVER", cluster_revision = 1, feature_map = 5 } | ||
{cluster_id = clusters.ElectricalEnergyMeasurement.ID, cluster_type = "SERVER", cluster_revision = 1, feature_map = 5 }, | ||
{cluster_id = clusters.PowerTopology.ID, cluster_type = "SERVER", cluster_revision = 1, feature_map = 1 } -- NODE_TOPOLOGY | ||
}, | ||
device_types = { | ||
{device_type_id = 0x0016, device_type_revision = 1}, -- RootNode | ||
|
@@ -177,10 +178,12 @@ local function test_init() | |
end | ||
end | ||
test.socket.matter:__expect_send({aqara_mock_device.id, subscribe_request}) | ||
|
||
-- Test added -> doConfigure logic | ||
test.socket.device_lifecycle:__queue_receive({ aqara_mock_device.id, "added" }) | ||
test.socket.matter:__expect_send({aqara_mock_device.id, subscribe_request}) | ||
test.socket.device_lifecycle:__queue_receive({ aqara_mock_device.id, "doConfigure" }) | ||
test.mock_devices_api._expected_device_updates[aqara_mock_device.device_id] = "00000000-1111-2222-3333-000000000001" | ||
test.mock_devices_api._expected_device_updates[1] = {device_id = "00000000-1111-2222-3333-000000000001"} | ||
test.mock_devices_api._expected_device_updates[1].metadata = {deviceId="00000000-1111-2222-3333-000000000001", profileReference="4-button"} | ||
aqara_mock_device:expect_metadata_update({ profile = "4-button" }) | ||
aqara_mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) | ||
test.mock_device.add_test_device(aqara_mock_device) | ||
-- to test powerConsumptionReport | ||
|
@@ -277,7 +280,7 @@ test.register_coroutine_test( | |
{ | ||
-- don't use "aqara_mock_children[aqara_child1_ep].id," | ||
-- because energy management is at the root endpoint. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment can be removed now 😅 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, is this the correct behavior? If I remember right this device has it's energy management cluster on the root endpoint, so why is it now testing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is, this update actually makes the whole aqara child system work better now we use emit_component_event(), side stepping the original issues we faced having the energy management cluster on the root endpoint. |
||
aqara_mock_device.id, | ||
aqara_mock_children[aqara_child1_ep].id, | ||
clusters.ElectricalPowerMeasurement.attributes.ActivePower:build_test_report_data(aqara_mock_device, 1, 17000) | ||
} | ||
) | ||
|
@@ -289,7 +292,7 @@ test.register_coroutine_test( | |
|
||
test.socket.matter:__queue_receive( | ||
{ | ||
aqara_mock_device.id, | ||
aqara_mock_children[aqara_child1_ep].id, | ||
clusters.ElectricalEnergyMeasurement.attributes.CumulativeEnergyImported:build_test_report_data(aqara_mock_device, 1, cumulative_report_val_19) | ||
} | ||
) | ||
|
@@ -302,7 +305,7 @@ test.register_coroutine_test( | |
-- This is because related variable settings are required in set_poll_report_timer_and_schedule(). | ||
test.socket.matter:__queue_receive( | ||
{ | ||
aqara_mock_device.id, | ||
aqara_mock_children[aqara_child1_ep].id, | ||
clusters.ElectricalEnergyMeasurement.attributes.CumulativeEnergyImported:build_test_report_data(aqara_mock_device, 1, cumulative_report_val_29) | ||
} | ||
) | ||
|
@@ -313,10 +316,8 @@ test.register_coroutine_test( | |
|
||
test.socket.matter:__queue_receive( | ||
{ | ||
aqara_mock_device.id, | ||
clusters.ElectricalEnergyMeasurement.attributes.CumulativeEnergyImported:build_test_report_data( | ||
aqara_mock_device, 1, cumulative_report_val_39 | ||
) | ||
aqara_mock_children[aqara_child1_ep].id, | ||
clusters.ElectricalEnergyMeasurement.attributes.CumulativeEnergyImported:build_test_report_data(aqara_mock_device, 1, cumulative_report_val_39) | ||
} | ||
) | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Aqara subdriver overrides
device_added
so this field would not be set in the current implementation and so the subdriver may need to be updated to set it. The other subdrivers may also need to account for thisUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test doesn't handle a device that's using a subdriver.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, my bad, I saw Aqara and thought this was the Aqara cube test file