Skip to content

Commit

Permalink
added device type entity
Browse files Browse the repository at this point in the history
  • Loading branch information
Tihomir Heidelberg committed Dec 26, 2021
1 parent ca628ed commit 440fcdd
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/centrometal_boiler/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"domain": "centrometal_boiler",
"name": "Centrometal Boiler System integration",
"version": "0.0.7",
"version": "0.0.8",
"config_flow": true,
"documentation": "https://github.com/9a4gl/hass-centrometal-boiler",
"issue_tracker": "https://github.com/9a4gl/hass-centrometal-boiler/issues",
Expand Down
2 changes: 2 additions & 0 deletions custom_components/centrometal_boiler/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""Support for Centrometal Boiler System sensors."""
import logging

from .sensors.WebBoilerDeviceTypeSensor import WebBoilerDeviceTypeSensor
from .sensors.WebBoilerGenericSensor import WebBoilerGenericSensor
from .sensors.WebBoilerConfigurationSensor import WebBoilerConfigurationSensor
from .sensors.WebBoilerWorkingTableSensor import WebBoilerWorkingTableSensor
Expand All @@ -25,6 +26,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
entities.extend(WebBoilerConfigurationSensor.create_entities(hass, device))
entities.extend(WebBoilerCurrentTimeSensor.create_entities(hass, device))
entities.extend(WebBoilerWorkingTableSensor.create_entities(hass, device))
entities.extend(WebBoilerDeviceTypeSensor.create_entities(hass, device))
if device["type"] == "peltec":
entities.extend(WebBoilerPelletLevelSensor.create_entities(hass, device))
entities.extend(WebBoilerFireGridSensor.create_entities(hass, device))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from typing import List
from homeassistant.components.sensor import SensorEntity

from .WebBoilerGenericSensor import WebBoilerGenericSensor
from centrometal_web_boiler.WebBoilerDeviceCollection import WebBoilerParameter


class WebBoilerDeviceTypeSensor(WebBoilerGenericSensor):
@property
def available(self):
"""Return the availablity of the sensor."""
return True

@staticmethod
def create_entities(hass, device) -> List[SensorEntity]:
parameter = WebBoilerParameter()
parameter["name"] = "Device_Type"
parameter["value"] = device["type"]
entities = []
entities.append(
WebBoilerDeviceTypeSensor(
hass,
device,
["", "mdi:star-circle", None, "Device Type"],
parameter,
)
)
return entities

0 comments on commit 440fcdd

Please sign in to comment.