Skip to content

Commit 57c5892

Browse files
committed
Add rvc operational state list handler
Signed-off-by: Hunsup Jung <[email protected]>
1 parent 57a2e4f commit 57c5892

File tree

1 file changed

+14
-0
lines changed
  • drivers/SmartThings/matter-rvc/src

1 file changed

+14
-0
lines changed

drivers/SmartThings/matter-rvc/src/init.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ local subscribed_attributes = {
5959
clusters.RvcCleanMode.attributes.CurrentMode
6060
},
6161
[capabilities.robotCleanerOperatingState.ID] = {
62+
clusters.RvcOperationalState.attributes.OperationalStateList,
6263
clusters.RvcOperationalState.attributes.OperationalState,
6364
clusters.RvcOperationalState.attributes.OperationalError
6465
},
@@ -367,6 +368,18 @@ local function rvc_operational_error_attr_handler(driver, device, ib, response)
367368
end
368369
end
369370

371+
local function rvc_operational_state_list_attr_handler(driver, device, ib, response)
372+
local supportedOperatingState = {}
373+
for _, state in ipairs(ib.data.elements) do
374+
if OPERATING_STATE_MAP[state.elements.operational_state_id.value] ~= nil then
375+
table.insert(supportedOperatingState, OPERATING_STATE_MAP[state.elements.operational_state_id.value].NAME)
376+
end
377+
end
378+
device:emit_event_for_endpoint(ib.endpoint_id, capabilities.robotCleanerOperatingState.supportedOperatingStates(
379+
supportedOperatingState, {visibility = {displayed = false}}
380+
))
381+
end
382+
370383
local function handle_rvc_operational_state_accepted_command_list(driver, device, ib, response)
371384
device.log.info("handle_rvc_operational_state_accepted_command_list")
372385
local OP_COMMAND_MAP = {
@@ -599,6 +612,7 @@ local matter_rvc_driver = {
599612
[clusters.RvcCleanMode.attributes.CurrentMode.ID] = clean_mode_current_mode_handler,
600613
},
601614
[clusters.RvcOperationalState.ID] = {
615+
[clusters.RvcOperationalState.attributes.OperationalStateList.ID] = rvc_operational_state_list_attr_handler,
602616
[clusters.RvcOperationalState.attributes.OperationalState.ID] = rvc_operational_state_attr_handler,
603617
[clusters.RvcOperationalState.attributes.OperationalError.ID] = rvc_operational_error_attr_handler,
604618
[clusters.RvcOperationalState.attributes.AcceptedCommandList.ID] = handle_rvc_operational_state_accepted_command_list,

0 commit comments

Comments
 (0)