-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
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
Add Custom mapping of Risco states #39218
Add Custom mapping of Risco states #39218
Conversation
if not risco_state: | ||
_LOGGER.warning("No mapping for mode %s", mode) | ||
return |
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.
Not sure how to cover this with a test. Hypothetically, this condition can't happen, but it seems wise to add this guard to protect against a bug that would cause it to.
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.
have you tried initializing the mock entity with options that are missing one of the keys? might that trigger it?
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.
Any keys that are missing in ha_to_risco
mean that the entity wouldn't report those services as supported, thus there's no way to run them...
* Custom mapping of Risco states * More informative error log * Add alternative Risco terms * Black formatting
* Custom mapping of Risco states * More informative error log * Add alternative Risco terms * Black formatting
Proposed change
Enable custom configuration of Risco and HA alarm states. The user can define a two-way mapping - which HA state the entity will be in when Risco is reporting state X, and how to arm Risco when arming the entity in mode Y.
The possible Risco states are:
The possible HA states are:
STATE_ALARM_ARMED_AWAY
STATE_ALARM_ARMED_CUSTOM_BYPASS
STATE_ALARM_ARMED_HOME
STATE_ALARM_ARMED_NIGHT
Only HA states that are mapped will be supported by the entity.
This also marks the last PR in the roadmap I laid out in the initial PR for this integration. I do have other minor stuff potentially coming up, like (un)bypassing zones, but nothing major.
Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: