Skip to content

Commit 18aefc6

Browse files
committed
1 parent da5bfb0 commit 18aefc6

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎src/ha_addon_sunsynk_multi/a_sensor.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
TimeRWSensor,
3535
resolve_num,
3636
)
37-
from sunsynk.sensors import BinarySensor, EnumSensor
37+
from sunsynk.sensors import BinarySensor, EnumSensor, TextSensor
3838

3939
from .options import OPT
4040
from .sensor_options import SensorOption
@@ -109,7 +109,7 @@ def visible_on(self, ist: AInverter) -> bool:
109109
return False
110110
return True
111111

112-
def create_entity(self, ist: AInverter, /) -> MQTTEntity: # noqa: PLR0911
112+
def create_entity(self, ist: AInverter, /) -> MQTTEntity: # noqa: PLR0911, PLR0912
113113
"""Create HASS entity."""
114114
dev_id = ist.opt.serial_nr
115115
if not self.visible_on(ist):
@@ -143,6 +143,8 @@ def create_entity(self, ist: AInverter, /) -> MQTTEntity: # noqa: PLR0911
143143
ent["device_class"] = hass_device_class(unit=sensor.unit)
144144
if isinstance(sensor, BinarySensor):
145145
self.entity = MQTTBinarySensorEntity(**ent)
146+
elif isinstance(sensor, TextSensor):
147+
self.entity = MQTTSensorEntity(**ent)
146148
else:
147149
if self.is_measurement(sensor.unit):
148150
ent["state_class"] = "measurement"

0 commit comments

Comments
 (0)