Skip to content

Commit

Permalink
Add Reolink CPU usage sensor (#126386)
Browse files Browse the repository at this point in the history
  • Loading branch information
starkillerOG authored Sep 22, 2024
1 parent 53d7635 commit 286c22c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions homeassistant/components/reolink/icons.json
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@
"wifi_signal": {
"default": "mdi:wifi"
},
"cpu_usage": {
"default": "mdi:cpu-64-bit"
},
"hdd_storage": {
"default": "mdi:harddisk"
},
Expand Down
11 changes: 11 additions & 0 deletions homeassistant/components/reolink/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ class ReolinkHostSensorEntityDescription(
value=lambda api: api.wifi_signal,
supported=lambda api: api.supported(None, "wifi") and api.wifi_connection,
),
ReolinkHostSensorEntityDescription(
key="cpu_usage",
cmd_key="GetPerformance",
translation_key="cpu_usage",
native_unit_of_measurement=PERCENTAGE,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
value=lambda api: api.cpu_usage,
supported=lambda api: api.supported(None, "performance"),
),
)

HDD_SENSORS = (
Expand Down
3 changes: 3 additions & 0 deletions homeassistant/components/reolink/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,9 @@
"wifi_signal": {
"name": "Wi-Fi signal"
},
"cpu_usage": {
"name": "CPU usage"
},
"ptz_pan_position": {
"name": "PTZ pan position"
},
Expand Down

0 comments on commit 286c22c

Please sign in to comment.