Commit 8c5c42f
Add on_new_device support and parent device via_device linking
Register devices in HA device registry via on_new_device callback,
which fires before on_new_metric in topological order. Sub-devices
(like SwitchableOutputs) are linked to their parent via via_device.
Changes:
- _on_new_device: registers devices in HA device registry proactively
- _map_device_info: uses device.parent_device for via_device instead
of hardcoding system_0
- DeviceType check for system device instead of unique_id comparison
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 0582a09 commit 8c5c42f
1 file changed
Lines changed: 22 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
| 110 | + | |
| 111 | + | |
109 | 112 | | |
110 | 113 | | |
111 | 114 | | |
| |||
127 | 130 | | |
128 | 131 | | |
129 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
130 | 148 | | |
131 | 149 | | |
132 | 150 | | |
| |||
155 | 173 | | |
156 | 174 | | |
157 | 175 | | |
158 | | - | |
159 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
160 | 180 | | |
161 | 181 | | |
162 | 182 | | |
| |||
0 commit comments