Add device class to proxmoxve binary sensor (#73465)

* add device class property to binary sensor

* add newline
This commit is contained in:
Corbeno 2022-06-15 01:49:55 -05:00 committed by GitHub
parent 16dd70ba99
commit a77ea1c390
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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,