Skip to content

Commit

Permalink
Sensor entity category error fix (#15)
Browse files Browse the repository at this point in the history
* Updated sensor creation to use correct EntityCategory

* Replacing string entry for EntityCategory enum as will be deprecated in 2022.4
  • Loading branch information
danialclements authored Feb 6, 2022
1 parent 758c54d commit e145be7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
2 changes: 0 additions & 2 deletions custom_components/thermia/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@

MDI_TIMER_COG_OUTLINE_ICON = "mdi:timer-cog-outline"
MDI_TEMPERATURE_ICON = "mdi:thermometer"

DIAGNOSTIC_ENTITY_CATEGORY = "diagnostic"
34 changes: 17 additions & 17 deletions custom_components/thermia/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import TEMP_CELSIUS, TIME_HOURS
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from .sensors.active_alarms_sensor import ThermiaActiveAlarmsSensor
from .sensors.generic_sensor import ThermiaGenericSensor

from .const import (
DIAGNOSTIC_ENTITY_CATEGORY,
DOMAIN,
MDI_TEMPERATURE_ICON,
MDI_TIMER_COG_OUTLINE_ICON,
Expand Down Expand Up @@ -41,7 +41,7 @@ async def async_setup_entry(
"is_online",
"Outdoor Temperature",
MDI_TEMPERATURE_ICON,
"sensor",
EntityCategory.DIAGNOSTIC,
"temperature",
"measurement",
"outdoor_temperature",
Expand All @@ -60,7 +60,7 @@ async def async_setup_entry(
"is_online",
"Indoor Temperature",
MDI_TEMPERATURE_ICON,
"sensor",
EntityCategory.DIAGNOSTIC,
"temperature",
"measurement",
"indoor_temperature",
Expand All @@ -79,7 +79,7 @@ async def async_setup_entry(
"is_online",
"Hot Water Temperature",
MDI_TEMPERATURE_ICON,
"sensor",
EntityCategory.DIAGNOSTIC,
"temperature",
"measurement",
"hot_water_temperature",
Expand All @@ -99,7 +99,7 @@ async def async_setup_entry(
"is_online",
"Supply Line Temperature",
MDI_TEMPERATURE_ICON,
"sensor",
EntityCategory.DIAGNOSTIC,
"temperature",
"measurement",
"supply_line_temperature",
Expand All @@ -115,7 +115,7 @@ async def async_setup_entry(
"is_online",
"Desired Supply Line Temperature",
MDI_TEMPERATURE_ICON,
"sensor",
EntityCategory.DIAGNOSTIC,
"temperature",
"measurement",
"desired_supply_line_temperature",
Expand All @@ -131,7 +131,7 @@ async def async_setup_entry(
"is_online",
"Return Line Temperature",
MDI_TEMPERATURE_ICON,
"sensor",
EntityCategory.DIAGNOSTIC,
"temperature",
"measurement",
"return_line_temperature",
Expand All @@ -147,7 +147,7 @@ async def async_setup_entry(
"is_online",
"Brine Out Temperature",
MDI_TEMPERATURE_ICON,
"sensor",
EntityCategory.DIAGNOSTIC,
"temperature",
"measurement",
"brine_out_temperature",
Expand All @@ -163,7 +163,7 @@ async def async_setup_entry(
"is_online",
"Brine In Temperature",
MDI_TEMPERATURE_ICON,
"sensor",
EntityCategory.DIAGNOSTIC,
"temperature",
"measurement",
"brine_in_temperature",
Expand All @@ -179,7 +179,7 @@ async def async_setup_entry(
"is_online",
"Cooling Tank Temperature",
MDI_TEMPERATURE_ICON,
"sensor",
EntityCategory.DIAGNOSTIC,
"temperature",
"measurement",
"cooling_tank_temperature",
Expand All @@ -195,7 +195,7 @@ async def async_setup_entry(
"is_online",
"Cooling Supply Line Temperature",
MDI_TEMPERATURE_ICON,
"sensor",
EntityCategory.DIAGNOSTIC,
"temperature",
"measurement",
"cooling_supply_line_temperature",
Expand All @@ -215,7 +215,7 @@ async def async_setup_entry(
"is_online",
"Operational Status",
"mdi:thermostat",
"sensor",
EntityCategory.DIAGNOSTIC,
None,
"measurement",
"operational_status",
Expand All @@ -235,7 +235,7 @@ async def async_setup_entry(
"is_online",
"Compressor Operational Time",
MDI_TIMER_COG_OUTLINE_ICON,
DIAGNOSTIC_ENTITY_CATEGORY,
EntityCategory.DIAGNOSTIC,
None,
"total_increasing",
"compressor_operational_time",
Expand All @@ -251,7 +251,7 @@ async def async_setup_entry(
"is_online",
"Hot Water Operational Time",
MDI_TIMER_COG_OUTLINE_ICON,
DIAGNOSTIC_ENTITY_CATEGORY,
EntityCategory.DIAGNOSTIC,
None,
"total_increasing",
"hot_water_operational_time",
Expand All @@ -267,7 +267,7 @@ async def async_setup_entry(
"is_online",
"Auxiliary Heater 1 Operational Time",
MDI_TIMER_COG_OUTLINE_ICON,
DIAGNOSTIC_ENTITY_CATEGORY,
EntityCategory.DIAGNOSTIC,
None,
"total_increasing",
"auxiliary_heater_1_operational_time",
Expand All @@ -283,7 +283,7 @@ async def async_setup_entry(
"is_online",
"Auxiliary Heater 2 Operational Time",
MDI_TIMER_COG_OUTLINE_ICON,
DIAGNOSTIC_ENTITY_CATEGORY,
EntityCategory.DIAGNOSTIC,
None,
"total_increasing",
"auxiliary_heater_2_operational_time",
Expand All @@ -299,7 +299,7 @@ async def async_setup_entry(
"is_online",
"Auxiliary Heater 3 Operational Time",
MDI_TIMER_COG_OUTLINE_ICON,
DIAGNOSTIC_ENTITY_CATEGORY,
EntityCategory.DIAGNOSTIC,
None,
"total_increasing",
"auxiliary_heater_3_operational_time",
Expand Down

0 comments on commit e145be7

Please sign in to comment.