Home Assistant Unofficial Reference
2024.12.1
entity.py
Go to the documentation of this file.
1
"""Proxmox parent entity class."""
2
3
from
homeassistant.helpers.update_coordinator
import
(
4
CoordinatorEntity,
5
DataUpdateCoordinator,
6
)
7
8
9
class
ProxmoxEntity
(
CoordinatorEntity
):
10
"""Represents any entity created for the Proxmox VE platform."""
11
12
def
__init__
(
13
self,
14
coordinator: DataUpdateCoordinator,
15
unique_id: str,
16
name: str,
17
icon: str,
18
host_name: str,
19
node_name: str,
20
vm_id: int |
None
=
None
,
21
) ->
None
:
22
"""Initialize the Proxmox entity."""
23
super().
__init__
(coordinator)
24
25
self.
coordinator
coordinator = coordinator
26
self.
_attr_unique_id
_attr_unique_id = unique_id
27
self.
_attr_name
_attr_name = name
28
self.
_host_name
_host_name = host_name
29
self.
_attr_icon
_attr_icon = icon
30
self.
_available
_available =
True
31
self.
_node_name
_node_name = node_name
32
self.
_vm_id
_vm_id = vm_id
33
34
self.
_state
_state =
None
35
36
@property
37
def
available
(self) -> bool:
38
"""Return True if entity is available."""
39
return
self.
coordinator
coordinator.last_update_success
and
self.
_available
_available
homeassistant.components.proxmoxve.entity.ProxmoxEntity
Definition:
entity.py:9
homeassistant.components.proxmoxve.entity.ProxmoxEntity._attr_name
_attr_name
Definition:
entity.py:27
homeassistant.components.proxmoxve.entity.ProxmoxEntity._host_name
_host_name
Definition:
entity.py:28
homeassistant.components.proxmoxve.entity.ProxmoxEntity._state
_state
Definition:
entity.py:34
homeassistant.components.proxmoxve.entity.ProxmoxEntity.available
bool available(self)
Definition:
entity.py:37
homeassistant.components.proxmoxve.entity.ProxmoxEntity._vm_id
_vm_id
Definition:
entity.py:32
homeassistant.components.proxmoxve.entity.ProxmoxEntity.__init__
None __init__(self, DataUpdateCoordinator coordinator, str unique_id, str name, str icon, str host_name, str node_name, int|None vm_id=None)
Definition:
entity.py:21
homeassistant.components.proxmoxve.entity.ProxmoxEntity._attr_unique_id
_attr_unique_id
Definition:
entity.py:26
homeassistant.components.proxmoxve.entity.ProxmoxEntity.coordinator
coordinator
Definition:
entity.py:25
homeassistant.components.proxmoxve.entity.ProxmoxEntity._attr_icon
_attr_icon
Definition:
entity.py:29
homeassistant.components.proxmoxve.entity.ProxmoxEntity._available
_available
Definition:
entity.py:30
homeassistant.components.proxmoxve.entity.ProxmoxEntity._node_name
_node_name
Definition:
entity.py:31
homeassistant.helpers.update_coordinator.CoordinatorEntity
Definition:
update_coordinator.py:568
homeassistant.helpers.update_coordinator
Definition:
update_coordinator.py:1
core
homeassistant
components
proxmoxve
entity.py
Generated by
1.9.1