Move Intellifire error codes to individual sensors (#68249)

This commit is contained in:
Jeef 2022-03-30 01:41:25 -06:00 committed by GitHub
parent a5c729b724
commit 18517fda65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 84 additions and 9 deletions

View file

@ -7,11 +7,13 @@ from dataclasses import dataclass
from intellifire4py import IntellifirePollData from intellifire4py import IntellifirePollData
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity, BinarySensorEntity,
BinarySensorEntityDescription, BinarySensorEntityDescription,
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import IntellifireDataUpdateCoordinator from . import IntellifireDataUpdateCoordinator
@ -58,6 +60,85 @@ INTELLIFIRE_BINARY_SENSORS: tuple[IntellifireBinarySensorEntityDescription, ...]
icon="mdi:home-thermometer-outline", icon="mdi:home-thermometer-outline",
value_fn=lambda data: data.thermostat_on, value_fn=lambda data: data.thermostat_on,
), ),
IntellifireBinarySensorEntityDescription(
key="error_pilot_flame",
name="Pilot Flame Error",
entity_category=EntityCategory.DIAGNOSTIC,
value_fn=lambda data: data.error_pilot_flame,
device_class=BinarySensorDeviceClass.PROBLEM,
),
IntellifireBinarySensorEntityDescription(
key="error_flame",
name="Flame Error",
entity_category=EntityCategory.DIAGNOSTIC,
value_fn=lambda data: data.error_flame,
device_class=BinarySensorDeviceClass.PROBLEM,
),
IntellifireBinarySensorEntityDescription(
key="error_fan_delay",
name="Fan Delay Error",
icon="mdi:fan-alert",
entity_category=EntityCategory.DIAGNOSTIC,
value_fn=lambda data: data.error_fan_delay,
device_class=BinarySensorDeviceClass.PROBLEM,
),
IntellifireBinarySensorEntityDescription(
key="error_maintenance",
name="Maintenance Error",
entity_category=EntityCategory.DIAGNOSTIC,
value_fn=lambda data: data.error_maintenance,
device_class=BinarySensorDeviceClass.PROBLEM,
),
IntellifireBinarySensorEntityDescription(
key="error_disabled",
name="Disabled Error",
entity_category=EntityCategory.DIAGNOSTIC,
value_fn=lambda data: data.error_disabled,
device_class=BinarySensorDeviceClass.PROBLEM,
),
IntellifireBinarySensorEntityDescription(
key="error_fan",
name="Fan Error",
icon="mdi:fan-alert",
entity_category=EntityCategory.DIAGNOSTIC,
value_fn=lambda data: data.error_fan,
device_class=BinarySensorDeviceClass.PROBLEM,
),
IntellifireBinarySensorEntityDescription(
key="error_lights",
name="Lights Error",
entity_category=EntityCategory.DIAGNOSTIC,
value_fn=lambda data: data.error_lights,
device_class=BinarySensorDeviceClass.PROBLEM,
),
IntellifireBinarySensorEntityDescription(
key="error_accessory",
name="Accessory Error",
entity_category=EntityCategory.DIAGNOSTIC,
value_fn=lambda data: data.error_accessory,
device_class=BinarySensorDeviceClass.PROBLEM,
),
IntellifireBinarySensorEntityDescription(
key="error_soft_lock_out",
name="Soft Lock Out Error",
entity_category=EntityCategory.DIAGNOSTIC,
value_fn=lambda data: data.error_soft_lock_out,
device_class=BinarySensorDeviceClass.PROBLEM,
),
IntellifireBinarySensorEntityDescription(
key="error_ecm_offline",
name="ECM Offline Error",
entity_category=EntityCategory.DIAGNOSTIC,
value_fn=lambda data: data.error_ecm_offline,
device_class=BinarySensorDeviceClass.PROBLEM,
),
IntellifireBinarySensorEntityDescription(
key="error_offline",
name="Offline Error",
entity_category=EntityCategory.DIAGNOSTIC,
value_fn=lambda data: data.error_offline,
device_class=BinarySensorDeviceClass.PROBLEM,
),
) )

View file

@ -3,7 +3,7 @@
"name": "IntelliFire", "name": "IntelliFire",
"config_flow": true, "config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/intellifire", "documentation": "https://www.home-assistant.io/integrations/intellifire",
"requirements": ["intellifire4py==1.0.1"], "requirements": ["intellifire4py==1.0.2"],
"codeowners": ["@jeeftor"], "codeowners": ["@jeeftor"],
"iot_class": "local_polling", "iot_class": "local_polling",
"loggers": ["intellifire4py"], "loggers": ["intellifire4py"],

View file

@ -114,12 +114,6 @@ INTELLIFIRE_SENSORS: tuple[IntellifireSensorEntityDescription, ...] = (
value_fn=lambda data: data.connection_quality, value_fn=lambda data: data.connection_quality,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
), ),
IntellifireSensorEntityDescription(
key="errors",
name="Errors",
entity_category=EntityCategory.DIAGNOSTIC,
value_fn=lambda data: data.error_codes_string,
),
IntellifireSensorEntityDescription( IntellifireSensorEntityDescription(
key="ecm_latency", key="ecm_latency",
name="ECM Latency", name="ECM Latency",

View file

@ -875,7 +875,7 @@ influxdb-client==1.24.0
influxdb==5.3.1 influxdb==5.3.1
# homeassistant.components.intellifire # homeassistant.components.intellifire
intellifire4py==1.0.1 intellifire4py==1.0.2
# homeassistant.components.iotawatt # homeassistant.components.iotawatt
iotawattpy==0.1.0 iotawattpy==0.1.0

View file

@ -607,7 +607,7 @@ influxdb-client==1.24.0
influxdb==5.3.1 influxdb==5.3.1
# homeassistant.components.intellifire # homeassistant.components.intellifire
intellifire4py==1.0.1 intellifire4py==1.0.2
# homeassistant.components.iotawatt # homeassistant.components.iotawatt
iotawattpy==0.1.0 iotawattpy==0.1.0