Repository navigation
Conversation
|
zigbee-window-treatment_coverage.xml
Minimum allowed coverage is Generated by 🐒 cobertura-action against 901759b |
Test Results 73 files 546 suites 0s ⏱️ Results for commit 901759b. ♻️ This comment has been updated with latest results. |
| -- The position of this device is reported through the present value of the analog output | ||
| -- cluster, where 0 is fully closed and 100 is fully open. The lift percentage of the window | ||
| -- covering cluster is reported with the opposite polarity (100% = fully closed), so it is | ||
| -- ignored here to keep the parent Aqara handler from emitting an inverted shade level. |
There was a problem hiding this comment.
current_position_lift_percentage_handler is never registered in zigbee_handlers. Lift-percentage reports therefore go to the parent aqara sub-driver's shade_level_report_legacy_handler, which emits the inverted level the comment is trying to prevent.
There was a problem hiding this comment.
Please add a test to validate this.
There was a problem hiding this comment.
Thank you for pointing out the missing part. I have added the handler along with the relevant test cases.
|
|
||
| local INIT_STATE_REPORTED = "initStateReported" | ||
|
|
||
| local function is_not_init(device) |
There was a problem hiding this comment.
is_not_init returns false (control allowed) until the device has reported INIT_STATE_ATTRIBUTE_ID at least once. Allowing commands before the init state is reported is the opposite of the existing roller shade, which prevents commands until the device reports as initialized. Why is this device different? If they can function the same that would be a better experience for users.
There was a problem hiding this comment.
The requested changes have been applied.
| [capabilities.windowShade.ID] = { | ||
| [capabilities.windowShade.commands.open.NAME] = window_shade_open_cmd, | ||
| [capabilities.windowShade.commands.close.NAME] = window_shade_close_cmd, | ||
| -- [capabilities.windowShade.commands.pause.NAME] = window_shade_pause_cmd, |
There was a problem hiding this comment.
remove commented out handler
There was a problem hiding this comment.
I have removed it as suggested.
| local reverseRollerShadeDirPrefValue = device.preferences[reverseRollerShadeDir.ID] | ||
| if reverseRollerShadeDirPrefValue ~= nil and | ||
| reverseRollerShadeDirPrefValue ~= args.old_st_store.preferences[reverseRollerShadeDir.ID] then | ||
| local raw_value = reverseRollerShadeDirPrefValue and true or false |
There was a problem hiding this comment.
| local raw_value = reverseRollerShadeDirPrefValue and true or false | |
| local raw_value = reverseRollerShadeDirPrefValue |
reverseRollerShadeDirPrefValue is already a boolean type
There was a problem hiding this comment.
Updated as requested.
| local function init_state_handler(driver, device, value, zb_rx) | ||
| device:set_field(INIT_STATE_REPORTED, true, { persist = true }) | ||
| local state = value.value == 0x02 and initializedStateWithGuide.initializedStateWithGuide.initialized() or | ||
| initializedStateWithGuide.initializedStateWithGuide.notInitialized() |
There was a problem hiding this comment.
nit: indent to show it is a part of the line above
|
|
||
| local lazy_load_if_possible = require "lazy_load_subdriver" | ||
| local sub_drivers = { | ||
| lazy_load_if_possible("aqara.roller-shade.t1s"), |
There was a problem hiding this comment.
nit: 2 space indentation is our standard
| local function is_not_init(device) | ||
| if not device:get_field(INIT_STATE_REPORTED) then return false end | ||
|
|
||
| -- True if uninitialized; false if already initialized | ||
| local initialized = device:get_latest_state("main", initializedStateWithGuide.ID, | ||
| initializedStateWithGuide.initializedStateWithGuide.NAME) or 0 | ||
| local ret = true | ||
| if initialized == initializedStateWithGuide.initializedStateWithGuide.initialized.NAME then ret = false end | ||
| return ret | ||
| end |
There was a problem hiding this comment.
| local function is_not_init(device) | |
| if not device:get_field(INIT_STATE_REPORTED) then return false end | |
| -- True if uninitialized; false if already initialized | |
| local initialized = device:get_latest_state("main", initializedStateWithGuide.ID, | |
| initializedStateWithGuide.initializedStateWithGuide.NAME) or 0 | |
| local ret = true | |
| if initialized == initializedStateWithGuide.initializedStateWithGuide.initialized.NAME then ret = false end | |
| return ret | |
| end | |
| local function is_not_init(device) | |
| -- Only gate commands once the device has reported its init state at least once | |
| return device:get_field(INIT_STATE_REPORTED) and | |
| device:get_latest_state("main", initializedStateWithGuide.ID, | |
| initializedStateWithGuide.initializedStateWithGuide.NAME) ~= | |
| initializedStateWithGuide.initializedStateWithGuide.initialized.NAME | |
| end |
nit: Can be compressed/simplified
There was a problem hiding this comment.
I have updated the function based on your feedback.
| -- The position of this device is reported through the present value of the analog output | ||
| -- cluster, where 0 is fully closed and 100 is fully open. The lift percentage of the window | ||
| -- covering cluster is reported with the opposite polarity (100% = fully closed), so it is | ||
| -- ignored here to keep the parent Aqara handler from emitting an inverted shade level. | ||
| local function current_position_lift_percentage_handler(driver, device, value, zb_rx) | ||
| end |
| local reverseRollerShadeDir = capabilities["stse.reverseRollerShadeDir"] | ||
| local shadeRotateState = capabilities["stse.shadeRotateState"] | ||
| local setRotateStateCommandName = "setRotateState" | ||
| local directionReversal = "directionReversal" |
|
Invitation URL: |
Check all that apply
Type of Change
Checklist
Description of Change
Summary of Completed Tests