Compare commits
4 Commits
v0.6.0-bet
...
v0.6.0-bet
Author | SHA1 | Date | |
---|---|---|---|
2aa1d3df01 | |||
e2f7f15a5f | |||
d91b3edb40 | |||
83c5e3479e |
@ -124,7 +124,7 @@ BINARY_SENSORS: dict[str, tuple[HonBinarySensorEntityDescription, ...]] = {
|
|||||||
icon="mdi:power-cycle",
|
icon="mdi:power-cycle",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
"IV": (
|
"IH": (
|
||||||
HonBinarySensorEntityDescription(
|
HonBinarySensorEntityDescription(
|
||||||
key="attributes.lastConnEvent.category",
|
key="attributes.lastConnEvent.category",
|
||||||
name="Connection",
|
name="Connection",
|
||||||
@ -167,11 +167,11 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non
|
|||||||
coordinators = hass.data[DOMAIN]["coordinators"]
|
coordinators = hass.data[DOMAIN]["coordinators"]
|
||||||
appliances = []
|
appliances = []
|
||||||
for device in hon.appliances:
|
for device in hon.appliances:
|
||||||
if device.mac_address in coordinators:
|
if device.unique_id in coordinators:
|
||||||
coordinator = hass.data[DOMAIN]["coordinators"][device.mac_address]
|
coordinator = hass.data[DOMAIN]["coordinators"][device.unique_id]
|
||||||
else:
|
else:
|
||||||
coordinator = HonCoordinator(hass, device)
|
coordinator = HonCoordinator(hass, device)
|
||||||
hass.data[DOMAIN]["coordinators"][device.mac_address] = coordinator
|
hass.data[DOMAIN]["coordinators"][device.unique_id] = coordinator
|
||||||
await coordinator.async_config_entry_first_refresh()
|
await coordinator.async_config_entry_first_refresh()
|
||||||
|
|
||||||
if descriptions := BINARY_SENSORS.get(device.appliance_type):
|
if descriptions := BINARY_SENSORS.get(device.appliance_type):
|
||||||
|
@ -26,7 +26,7 @@ BUTTONS: dict[str, tuple[ButtonEntityDescription, ...]] = {
|
|||||||
icon="mdi:power-off",
|
icon="mdi:power-off",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
"IV": (
|
"IH": (
|
||||||
ButtonEntityDescription(
|
ButtonEntityDescription(
|
||||||
key="startProgram",
|
key="startProgram",
|
||||||
name="Start Program",
|
name="Start Program",
|
||||||
@ -41,11 +41,11 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non
|
|||||||
coordinators = hass.data[DOMAIN]["coordinators"]
|
coordinators = hass.data[DOMAIN]["coordinators"]
|
||||||
appliances = []
|
appliances = []
|
||||||
for device in hon.appliances:
|
for device in hon.appliances:
|
||||||
if device.mac_address in coordinators:
|
if device.unique_id in coordinators:
|
||||||
coordinator = hass.data[DOMAIN]["coordinators"][device.mac_address]
|
coordinator = hass.data[DOMAIN]["coordinators"][device.unique_id]
|
||||||
else:
|
else:
|
||||||
coordinator = HonCoordinator(hass, device)
|
coordinator = HonCoordinator(hass, device)
|
||||||
hass.data[DOMAIN]["coordinators"][device.mac_address] = coordinator
|
hass.data[DOMAIN]["coordinators"][device.unique_id] = coordinator
|
||||||
await coordinator.async_config_entry_first_refresh()
|
await coordinator.async_config_entry_first_refresh()
|
||||||
|
|
||||||
if descriptions := BUTTONS.get(device.appliance_type):
|
if descriptions := BUTTONS.get(device.appliance_type):
|
||||||
|
@ -22,12 +22,12 @@ class HonEntity(CoordinatorEntity):
|
|||||||
self._hass = hass
|
self._hass = hass
|
||||||
self._device = device
|
self._device = device
|
||||||
|
|
||||||
self._attr_unique_id = self._device.mac_address
|
self._attr_unique_id = self._device.unique_id
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self):
|
def device_info(self):
|
||||||
return DeviceInfo(
|
return DeviceInfo(
|
||||||
identifiers={(DOMAIN, self._device.mac_address)},
|
identifiers={(DOMAIN, self._device.unique_id)},
|
||||||
manufacturer=self._device.get("brand", ""),
|
manufacturer=self._device.get("brand", ""),
|
||||||
name=self._device.nick_name
|
name=self._device.nick_name
|
||||||
if self._device.nick_name
|
if self._device.nick_name
|
||||||
@ -43,7 +43,7 @@ class HonCoordinator(DataUpdateCoordinator):
|
|||||||
super().__init__(
|
super().__init__(
|
||||||
hass,
|
hass,
|
||||||
_LOGGER,
|
_LOGGER,
|
||||||
name=device.mac_address,
|
name=device.unique_id,
|
||||||
update_interval=timedelta(seconds=30),
|
update_interval=timedelta(seconds=30),
|
||||||
)
|
)
|
||||||
self._device = device
|
self._device = device
|
||||||
|
@ -6,6 +6,6 @@
|
|||||||
"documentation": "https://github.com/Andre0512/hon/",
|
"documentation": "https://github.com/Andre0512/hon/",
|
||||||
"iot_class": "cloud_polling",
|
"iot_class": "cloud_polling",
|
||||||
"issue_tracker": "https://github.com/Andre0512/hon/issues",
|
"issue_tracker": "https://github.com/Andre0512/hon/issues",
|
||||||
"requirements": ["pyhOn==0.8.0b2"],
|
"requirements": ["pyhOn==0.8.0b5"],
|
||||||
"version": "0.6.0-beta.1"
|
"version": "0.6.0-beta.4"
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from pyhon import Hon
|
from pyhon import Hon
|
||||||
from pyhon.parameter import HonParameterRange
|
from pyhon.parameter.range import HonParameterRange
|
||||||
|
|
||||||
from homeassistant.components.number import (
|
from homeassistant.components.number import (
|
||||||
NumberEntity,
|
NumberEntity,
|
||||||
@ -106,7 +106,7 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
|
|||||||
native_unit_of_measurement=UnitOfTime.MINUTES,
|
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
"IV": (
|
"IH": (
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key="startProgram.temp",
|
key="startProgram.temp",
|
||||||
name="Temperature",
|
name="Temperature",
|
||||||
@ -128,11 +128,11 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non
|
|||||||
coordinators = hass.data[DOMAIN]["coordinators"]
|
coordinators = hass.data[DOMAIN]["coordinators"]
|
||||||
appliances = []
|
appliances = []
|
||||||
for device in hon.appliances:
|
for device in hon.appliances:
|
||||||
if device.mac_address in coordinators:
|
if device.unique_id in coordinators:
|
||||||
coordinator = hass.data[DOMAIN]["coordinators"][device.mac_address]
|
coordinator = hass.data[DOMAIN]["coordinators"][device.unique_id]
|
||||||
else:
|
else:
|
||||||
coordinator = HonCoordinator(hass, device)
|
coordinator = HonCoordinator(hass, device)
|
||||||
hass.data[DOMAIN]["coordinators"][device.mac_address] = coordinator
|
hass.data[DOMAIN]["coordinators"][device.unique_id] = coordinator
|
||||||
await coordinator.async_config_entry_first_refresh()
|
await coordinator.async_config_entry_first_refresh()
|
||||||
|
|
||||||
if descriptions := NUMBERS.get(device.appliance_type):
|
if descriptions := NUMBERS.get(device.appliance_type):
|
||||||
|
@ -4,7 +4,7 @@ import logging
|
|||||||
|
|
||||||
from pyhon import Hon
|
from pyhon import Hon
|
||||||
from pyhon.appliance import HonAppliance
|
from pyhon.appliance import HonAppliance
|
||||||
from pyhon.parameter import HonParameterFixed
|
from pyhon.parameter.fixed import HonParameterFixed
|
||||||
|
|
||||||
from homeassistant.components.select import SelectEntity, SelectEntityDescription
|
from homeassistant.components.select import SelectEntity, SelectEntityDescription
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
@ -76,7 +76,7 @@ SELECTS = {
|
|||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
"IV": (
|
"IH": (
|
||||||
SelectEntityDescription(
|
SelectEntityDescription(
|
||||||
key="startProgram.program",
|
key="startProgram.program",
|
||||||
name="Program",
|
name="Program",
|
||||||
@ -92,11 +92,11 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non
|
|||||||
coordinators = hass.data[DOMAIN]["coordinators"]
|
coordinators = hass.data[DOMAIN]["coordinators"]
|
||||||
appliances = []
|
appliances = []
|
||||||
for device in hon.appliances:
|
for device in hon.appliances:
|
||||||
if device.mac_address in coordinators:
|
if device.unique_id in coordinators:
|
||||||
coordinator = hass.data[DOMAIN]["coordinators"][device.mac_address]
|
coordinator = hass.data[DOMAIN]["coordinators"][device.unique_id]
|
||||||
else:
|
else:
|
||||||
coordinator = HonCoordinator(hass, device)
|
coordinator = HonCoordinator(hass, device)
|
||||||
hass.data[DOMAIN]["coordinators"][device.mac_address] = coordinator
|
hass.data[DOMAIN]["coordinators"][device.unique_id] = coordinator
|
||||||
await coordinator.async_config_entry_first_refresh()
|
await coordinator.async_config_entry_first_refresh()
|
||||||
|
|
||||||
if descriptions := SELECTS.get(device.appliance_type):
|
if descriptions := SELECTS.get(device.appliance_type):
|
||||||
|
@ -221,7 +221,7 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
|
|||||||
icon="mdi:thermometer",
|
icon="mdi:thermometer",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
"IV": (
|
"IH": (
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="remainingTimeMM",
|
key="remainingTimeMM",
|
||||||
name="Remaining Time",
|
name="Remaining Time",
|
||||||
@ -245,11 +245,11 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non
|
|||||||
coordinators = hass.data[DOMAIN]["coordinators"]
|
coordinators = hass.data[DOMAIN]["coordinators"]
|
||||||
appliances = []
|
appliances = []
|
||||||
for device in hon.appliances:
|
for device in hon.appliances:
|
||||||
if device.mac_address in coordinators:
|
if device.unique_id in coordinators:
|
||||||
coordinator = hass.data[DOMAIN]["coordinators"][device.mac_address]
|
coordinator = hass.data[DOMAIN]["coordinators"][device.unique_id]
|
||||||
else:
|
else:
|
||||||
coordinator = HonCoordinator(hass, device)
|
coordinator = HonCoordinator(hass, device)
|
||||||
hass.data[DOMAIN]["coordinators"][device.mac_address] = coordinator
|
hass.data[DOMAIN]["coordinators"][device.unique_id] = coordinator
|
||||||
await coordinator.async_config_entry_first_refresh()
|
await coordinator.async_config_entry_first_refresh()
|
||||||
|
|
||||||
if descriptions := SENSORS.get(device.appliance_type):
|
if descriptions := SENSORS.get(device.appliance_type):
|
||||||
|
@ -8,6 +8,7 @@ from homeassistant.config_entries import ConfigEntry
|
|||||||
from homeassistant.const import EntityCategory
|
from homeassistant.const import EntityCategory
|
||||||
from pyhon import Hon
|
from pyhon import Hon
|
||||||
from pyhon.appliance import HonAppliance
|
from pyhon.appliance import HonAppliance
|
||||||
|
from pyhon.parameter.range import HonParameterRange
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
from .hon import HonCoordinator, HonEntity
|
from .hon import HonCoordinator, HonEntity
|
||||||
@ -97,11 +98,11 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non
|
|||||||
coordinators = hass.data[DOMAIN]["coordinators"]
|
coordinators = hass.data[DOMAIN]["coordinators"]
|
||||||
appliances = []
|
appliances = []
|
||||||
for device in hon.appliances:
|
for device in hon.appliances:
|
||||||
if device.mac_address in coordinators:
|
if device.unique_id in coordinators:
|
||||||
coordinator = hass.data[DOMAIN]["coordinators"][device.mac_address]
|
coordinator = hass.data[DOMAIN]["coordinators"][device.unique_id]
|
||||||
else:
|
else:
|
||||||
coordinator = HonCoordinator(hass, device)
|
coordinator = HonCoordinator(hass, device)
|
||||||
hass.data[DOMAIN]["coordinators"][device.mac_address] = coordinator
|
hass.data[DOMAIN]["coordinators"][device.unique_id] = coordinator
|
||||||
await coordinator.async_config_entry_first_refresh()
|
await coordinator.async_config_entry_first_refresh()
|
||||||
|
|
||||||
if descriptions := SWITCHES.get(device.appliance_type):
|
if descriptions := SWITCHES.get(device.appliance_type):
|
||||||
|
@ -459,7 +459,7 @@
|
|||||||
"iot_standard_frying": "Frying",
|
"iot_standard_frying": "Frying",
|
||||||
"iot_standard_keep_warm": "Keep Warm",
|
"iot_standard_keep_warm": "Keep Warm",
|
||||||
"iot_standard_melting": "Melting",
|
"iot_standard_melting": "Melting",
|
||||||
"iot_standard_simmering": "Simmering",
|
"iot_standard_simmering": "Simmering"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user