From a77ea1c39003d2be959c8e73fc8f4e7521a09e84 Mon Sep 17 00:00:00 2001 From: Corbeno Date: Wed, 15 Jun 2022 01:49:55 -0500 Subject: [PATCH] Add device class to proxmoxve binary sensor (#73465) * add device class property to binary sensor * add newline --- homeassistant/components/proxmoxve/binary_sensor.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/proxmoxve/binary_sensor.py b/homeassistant/components/proxmoxve/binary_sensor.py index e52b91d4cba..780e7240267 100644 --- a/homeassistant/components/proxmoxve/binary_sensor.py +++ b/homeassistant/components/proxmoxve/binary_sensor.py @@ -1,7 +1,10 @@ """Binary sensor to read Proxmox VE data.""" from __future__ import annotations -from homeassistant.components.binary_sensor import BinarySensorEntity +from homeassistant.components.binary_sensor import ( + BinarySensorDeviceClass, + BinarySensorEntity, +) from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType @@ -66,7 +69,7 @@ def create_binary_sensor(coordinator, host_name, node_name, vm_id, name): return ProxmoxBinarySensor( coordinator=coordinator, unique_id=f"proxmox_{node_name}_{vm_id}_running", - name=f"{node_name}_{name}_running", + name=f"{node_name}_{name}", icon="", host_name=host_name, node_name=node_name, @@ -77,6 +80,8 @@ def create_binary_sensor(coordinator, host_name, node_name, vm_id, name): class ProxmoxBinarySensor(ProxmoxEntity, BinarySensorEntity): """A binary sensor for reading Proxmox VE data.""" + _attr_device_class = BinarySensorDeviceClass.RUNNING + def __init__( self, coordinator: DataUpdateCoordinator,