-
Notifications
You must be signed in to change notification settings - Fork 77
Never mark device temperature sensor as primary entity #860
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2740,7 +2740,6 @@ class DeviceTemperature(Sensor): | |
| _divisor = 100 | ||
| _attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS | ||
| _attr_entity_category = EntityCategory.DIAGNOSTIC | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct removal — and this line right here is the argument for it: an entity that is permanently Optional: consider locking the behaviour in with a case in # Door sensor whose diagnostic device-temperature sensor previously tied with it
(
"tests/data/devices/lumi-lumi-sensor-magnet-aq2.json",
Platform.BINARY_SENSOR,
Opening,
),
# Remote with no user-facing entities: device temperature must not become primary
(
"tests/data/devices/lumi-lumi-sensor-switch-aq2.json",
None,
None,
),The snapshots do cover this today, but as four unlabelled boolean flips among ~870 files — a future regen would re-bless a regression without anyone reading the intent. #859 adds an explicit test for its half; this is the symmetric one. |
||
| _attr_primary_weight = 1 | ||
| _cluster_id = DeviceTemperatureCluster.cluster_id | ||
|
|
||
| _cluster_match = ClusterMatch( | ||
|
|
||
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.
This flip is the most interesting one in the PR and isn't mentioned in the description. On
devthis device has no primary entity —Opening(weight1) tied withDeviceTemperature(weight1), and_compute_primary_entityfails both candidates on a tie. So besides preventing the wrong entity from being primary, this PR also gives a very common Aqara door sensor its correct primary entity back.Uh oh!
There was an error while loading. Please reload this page.
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.
That is a very good point. I've added it to the PR body.