Skip to content

Commit

Permalink
Merge pull request #179 from dougiteixeira/disk-smart-remove-hours
Browse files Browse the repository at this point in the history
Remove power hours info disks
  • Loading branch information
dougiteixeira authored Nov 16, 2023
2 parents 9b15aae + 94f91f6 commit 2272ff4
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ logger:
![image](https://github.com/dougiteixeira/proxmoxve/assets/31328123/fb290802-95d7-4dcc-8538-d31636a2f6f8)
* Physical disks
![image](https://github.com/dougiteixeira/proxmoxve/assets/31328123/eafb4652-63ed-4f2b-a288-30eca3ad26c9)
![image](https://github.com/dougiteixeira/proxmoxve/assets/31328123/f6174806-0ba8-4f60-ada7-cf5f29a1f629)
## Proxmox Permissions
Expand Down
3 changes: 1 addition & 2 deletions custom_components/proxmoxve/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ def poll_api_attributes() -> dict[str, Any] | None:
disk_attributes = {}
disk_attributes_api = await self.hass.async_add_executor_job(poll_api_attributes)
for disk_attribute in disk_attributes_api["attributes"]:
if disk_attribute["name"] in ("Power_Cycle_Count", "Power_On_Hours"):
if disk_attribute["name"] == "Power_Cycle_Count":
disk_attributes[disk_attribute["name"]]=disk_attribute["raw"]
elif disk_attribute["name"] == "Temperature_Celsius":
disk_attributes[disk_attribute["name"]]=disk_attribute["raw"].split(" ", 1)[0]
Expand All @@ -695,7 +695,6 @@ def poll_api_attributes() -> dict[str, Any] | None:
disk_type=disk["type"],
temperature=disk_attributes["Temperature_Celsius"] if "Temperature_Celsius" in disk_attributes else None,
power_cycles=disk_attributes["Power_Cycle_Count"] if "Power_Cycle_Count" in disk_attributes else None,
power_hours=disk_attributes["Power_On_Hours"] if "Power_On_Hours" in disk_attributes else None,
)

raise UpdateFailed(f"Disk {self.resource_id} not found on node {self.node_name}.")
Expand Down
3 changes: 1 addition & 2 deletions custom_components/proxmoxve/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,4 @@ class ProxmoxDiskData:
disk_rpm: float
disk_type: str
temperature: float
power_cycles: int
power_hours: int
power_cycles: int
10 changes: 0 additions & 10 deletions custom_components/proxmoxve/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,16 +394,6 @@ class ProxmoxSensorEntityDescription(ProxmoxEntityDescription, SensorEntityDescr
suggested_display_precision=0,
translation_key="power_cycles",
),
ProxmoxSensorEntityDescription(
key="power_hours",
name="Time on",
icon="mdi:database-clock",
native_unit_of_measurement=UnitOfTime.HOURS,
device_class=SensorDeviceClass.DURATION,
state_class=SensorStateClass.TOTAL,
suggested_display_precision=0,
translation_key="power_hours",
),
)

async def async_setup_entry(
Expand Down
3 changes: 0 additions & 3 deletions custom_components/proxmoxve/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,6 @@
"power_cycles": {
"name": "Power cycles"
},
"power_hours": {
"name": "Time on"
},
"node": {
"name": "Node"
},
Expand Down
3 changes: 0 additions & 3 deletions custom_components/proxmoxve/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,6 @@
"power_cycles": {
"name": "Power cycles"
},
"power_hours": {
"name": "Time on"
},
"status_raw": {
"name": "Status",
"state": {
Expand Down
3 changes: 0 additions & 3 deletions custom_components/proxmoxve/translations/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,6 @@
"power_cycles": {
"name": "Ciclos de energia"
},
"power_hours": {
"name": "Tempo ligado"
},
"status_raw": {
"name": "Status",
"state": {
Expand Down

0 comments on commit 2272ff4

Please sign in to comment.