-
-
Notifications
You must be signed in to change notification settings - Fork 34.3k
Add details to Husqvarna Automower restricted reason sensor #147678
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: dev
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR enhances the restricted‐reason sensor to surface detailed external reasons when the mower is externally blocked.
- Imported and integrated
ExternalReasons
into the restricted‐reason sensor. - Added a
_get_restricted_reason
callback to returnexternal_reason
when present. - Updated tests, snapshots, and translation strings to cover all new external reasons.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
tests/components/husqvarna_automower/test_sensor.py | Added test_restricted_reason_sensor for external reason logic. |
tests/components/husqvarna_automower/snapshots/test_sensor.ambr | Expanded snapshots to include new ExternalReasons members. |
homeassistant/components/husqvarna_automower/strings.json | Added translation strings for all external reasons. |
homeassistant/components/husqvarna_automower/sensor.py | Imported ExternalReasons , updated RESTRICTED_REASONS , and added _get_restricted_reason . |
Comments suppressed due to low confidence (2)
tests/components/husqvarna_automower/test_sensor.py:139
- [nitpick] The docstring mentions the work area sensor but this test covers the restricted‐reason sensor. Please update it to accurately describe the restricted‐reason test.
"""Test the work area sensor."""
homeassistant/components/husqvarna_automower/sensor.py:190
- [nitpick] This list now includes external reasons as well as restricted ones. Renaming
RESTRICTED_REASONS
to something likeRESTRICTION_OPTIONS
orREASON_OPTIONS
would more clearly convey its merged purpose.
RestrictedReasons.NONE,
@@ -191,11 +192,34 @@ | |||
RestrictedReasons.PARK_OVERRIDE, | |||
RestrictedReasons.SENSOR, | |||
RestrictedReasons.WEEK_SCHEDULE, | |||
ExternalReasons.AMAZON_ALEXA, |
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.
[nitpick] Manually listing each ExternalReasons
value risks falling out of sync if new reasons are added. Consider generating the list dynamically from the enum (e.g., list(ExternalReasons)
).
Copilot uses AI. Check for mistakes.
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.
But if they are not manually listed and the library gets more new reasons, we might just bump the library and forget to update strings.json. So we have no translations for them.
"iftt": "IFTT", | ||
"iftt_wildlife": "IFTT Wildlife", | ||
"iftt_frost_and_rain": "IFTT Frost and Rain", | ||
"iftt_calendar_connection": "IFTT Calendar Connection", | ||
"gardena_smart_system": "Gardena Smart System", | ||
"iftt_applets": "IFTT Applets", | ||
"developer_portal": "Developer Portal" |
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.
Are those about https://ifttt.com/automower ?
Then it looks like we need one more "T" in "IFTTT"
Also words that can be translated should be lowercase.
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.
Yes
Co-authored-by: Norbert Rittel <norbert@rittel.de>
Proposed change
If the mower is restricted in mowing it can have different reasons, one of them is called external. For example IFTT can prevent the mower from mowing, if the user build an condition for that. With this PR we give the user more information, if available.
Type of change
Additional information
Checklist
ruff format 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
.To help with the load of incoming pull requests: