-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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 Sense Devices for entities #129182
Draft
kbickar
wants to merge
25
commits into
home-assistant:dev
Choose a base branch
from
kbickar:sense-devices
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+32
−13
Draft
Add Sense Devices for entities #129182
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
84ccdce
Update sense-energy to 0.13.2 and library compatiblity changes
kbickar 5a10755
Add trend sensors and devices for sense energy devices
kbickar 6111d01
Merge branch 'dev' into sense-trend
kbickar a6f3ec0
Create tests for sense integration
kbickar 6211b81
Merge branch 'dev' into sense-tests
kbickar 79dc228
Merge branch 'sense-tests' into sense-trend
kbickar dbbf929
Rearrange files
kbickar 6d12f36
Update to use snapshots
kbickar b057683
Merge branch 'dev' into sense-tests
kbickar e64e8ca
Merge branch 'sense-tests' into sense-trend
kbickar d42805d
Updates Tests
kbickar 43ef50f
Merge branch 'sense-trend' into sense-devices
kbickar 6462b9e
Update Tests
kbickar 2f60c7a
Merge branch 'dev' into sense-trend
kbickar c4c086f
Add typing for sense component
kbickar 804ac79
Merge branch 'sense-type' into sense-trend
kbickar 864fbff
Merge branch 'dev' into sense-trend
kbickar 74b2f90
Convert Sense realtime to use Coordinator
kbickar f97670d
Merge branch 'dev' into sense-rt-coord
kbickar 890c935
Merge branch 'sense-rt-coord' into sense-devices
kbickar 007e5d1
Add custom coordinators
kbickar 94c77c2
Merge branch 'sense-rt-coord' into sense-devices
kbickar 416800b
Merge coordinator update
kbickar 81b4d68
Merge branch 'dev' into sense-devices
kbickar ac4c3d0
Remove added sensors
kbickar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -10,6 +10,7 @@ | |||||
) | ||||||
from homeassistant.core import HomeAssistant | ||||||
from homeassistant.helpers import entity_registry as er | ||||||
from homeassistant.helpers.device_registry import DeviceInfo | ||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback | ||||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity | ||||||
|
||||||
|
@@ -66,6 +67,14 @@ def __init__( | |||||
self._attr_unique_id = f"{sense_monitor_id}-{self._id}" | ||||||
self._attr_icon = sense_to_mdi(device.icon) | ||||||
self._device = device | ||||||
self._attr_device_info = DeviceInfo( | ||||||
name=f"Sense {sense_monitor_id} - {device.name}", | ||||||
identifiers={(DOMAIN, f"{sense_monitor_id}:{device.id}")}, | ||||||
model="Sense", | ||||||
manufacturer="Sense Labs, Inc.", | ||||||
configuration_url="https://home.sense.com", | ||||||
via_device=(DOMAIN, f"{sense_monitor_id}"), | ||||||
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.
Suggested change
|
||||||
) | ||||||
|
||||||
@property | ||||||
def old_unique_id(self) -> str: | ||||||
|
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 | ||||
---|---|---|---|---|---|---|
|
@@ -195,6 +195,13 @@ def __init__( | |||||
self._attr_name = f"L{index + 1} Voltage" | ||||||
self._data = data | ||||||
self._voltage_index = index | ||||||
self._attr_device_info = DeviceInfo( | ||||||
name=f"Sense {sense_monitor_id}", | ||||||
identifiers={(DOMAIN, sense_monitor_id)}, | ||||||
model="Sense", | ||||||
manufacturer="Sense Labs, Inc.", | ||||||
configuration_url="https://home.sense.com", | ||||||
) | ||||||
|
||||||
@property | ||||||
def native_value(self) -> float: | ||||||
|
@@ -276,6 +283,14 @@ def __init__( | |||||
self._id = device.id | ||||||
self._attr_icon = sense_to_mdi(device.icon) | ||||||
self._device = device | ||||||
self._attr_device_info = DeviceInfo( | ||||||
kbickar marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
name=f"Sense {sense_monitor_id} - {device.name}", | ||||||
identifiers={(DOMAIN, f"{sense_monitor_id}:{device.id}")}, | ||||||
model="Sense", | ||||||
manufacturer="Sense Labs, Inc.", | ||||||
configuration_url="https://home.sense.com", | ||||||
via_device=(DOMAIN, f"{sense_monitor_id}"), | ||||||
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.
Suggested change
|
||||||
) | ||||||
|
||||||
@property | ||||||
def native_value(self) -> float: | ||||||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think we should name this device the device name as that is user recognisable. They can view to which monitor it belongs via the device info 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.
Also because i think it's a good idea that we migrate to has entity name = True, where all entity names are appended to the device name