forked from home-assistant/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ZHA configuration APIs (home-assistant#81874)
* Fix ZHA configuration loading and saving issues * add tests
- Loading branch information
Showing
4 changed files
with
239 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
"""Test data for ZHA API tests.""" | ||
|
||
BASE_CUSTOM_CONFIGURATION = { | ||
"schemas": { | ||
"zha_options": [ | ||
{ | ||
"type": "integer", | ||
"valueMin": 0, | ||
"name": "default_light_transition", | ||
"optional": True, | ||
"default": 0, | ||
}, | ||
{ | ||
"type": "boolean", | ||
"name": "enhanced_light_transition", | ||
"required": True, | ||
"default": False, | ||
}, | ||
{ | ||
"type": "boolean", | ||
"name": "light_transitioning_flag", | ||
"required": True, | ||
"default": True, | ||
}, | ||
{ | ||
"type": "boolean", | ||
"name": "always_prefer_xy_color_mode", | ||
"required": True, | ||
"default": True, | ||
}, | ||
{ | ||
"type": "boolean", | ||
"name": "enable_identify_on_join", | ||
"required": True, | ||
"default": True, | ||
}, | ||
{ | ||
"type": "integer", | ||
"valueMin": 0, | ||
"name": "consider_unavailable_mains", | ||
"optional": True, | ||
"default": 7200, | ||
}, | ||
{ | ||
"type": "integer", | ||
"valueMin": 0, | ||
"name": "consider_unavailable_battery", | ||
"optional": True, | ||
"default": 21600, | ||
}, | ||
] | ||
}, | ||
"data": { | ||
"zha_options": { | ||
"enhanced_light_transition": True, | ||
"default_light_transition": 0, | ||
"light_transitioning_flag": True, | ||
"always_prefer_xy_color_mode": True, | ||
"enable_identify_on_join": True, | ||
"consider_unavailable_mains": 7200, | ||
"consider_unavailable_battery": 21600, | ||
} | ||
}, | ||
} | ||
|
||
CONFIG_WITH_ALARM_OPTIONS = { | ||
"schemas": { | ||
"zha_options": [ | ||
{ | ||
"type": "integer", | ||
"valueMin": 0, | ||
"name": "default_light_transition", | ||
"optional": True, | ||
"default": 0, | ||
}, | ||
{ | ||
"type": "boolean", | ||
"name": "enhanced_light_transition", | ||
"required": True, | ||
"default": False, | ||
}, | ||
{ | ||
"type": "boolean", | ||
"name": "light_transitioning_flag", | ||
"required": True, | ||
"default": True, | ||
}, | ||
{ | ||
"type": "boolean", | ||
"name": "always_prefer_xy_color_mode", | ||
"required": True, | ||
"default": True, | ||
}, | ||
{ | ||
"type": "boolean", | ||
"name": "enable_identify_on_join", | ||
"required": True, | ||
"default": True, | ||
}, | ||
{ | ||
"type": "integer", | ||
"valueMin": 0, | ||
"name": "consider_unavailable_mains", | ||
"optional": True, | ||
"default": 7200, | ||
}, | ||
{ | ||
"type": "integer", | ||
"valueMin": 0, | ||
"name": "consider_unavailable_battery", | ||
"optional": True, | ||
"default": 21600, | ||
}, | ||
], | ||
"zha_alarm_options": [ | ||
{ | ||
"type": "string", | ||
"name": "alarm_master_code", | ||
"required": True, | ||
"default": "1234", | ||
}, | ||
{ | ||
"type": "integer", | ||
"valueMin": 0, | ||
"name": "alarm_failed_tries", | ||
"required": True, | ||
"default": 3, | ||
}, | ||
{ | ||
"type": "boolean", | ||
"name": "alarm_arm_requires_code", | ||
"required": True, | ||
"default": False, | ||
}, | ||
], | ||
}, | ||
"data": { | ||
"zha_options": { | ||
"enhanced_light_transition": True, | ||
"default_light_transition": 0, | ||
"light_transitioning_flag": True, | ||
"always_prefer_xy_color_mode": True, | ||
"enable_identify_on_join": True, | ||
"consider_unavailable_mains": 7200, | ||
"consider_unavailable_battery": 21600, | ||
}, | ||
"zha_alarm_options": { | ||
"alarm_arm_requires_code": False, | ||
"alarm_master_code": "4321", | ||
"alarm_failed_tries": 2, | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters