diff --git a/custom_components/sunspec/const.py b/custom_components/sunspec/const.py index 34858c6..8b6bb91 100644 --- a/custom_components/sunspec/const.py +++ b/custom_components/sunspec/const.py @@ -3,7 +3,7 @@ NAME = "SunSpec" DOMAIN = "sunspec" DOMAIN_DATA = f"{DOMAIN}_data" -VERSION = "0.0.23" +VERSION = "0.0.24" ATTRIBUTION = "Data provided by SunSpec alliance - https://sunspec.org" ISSUE_URL = "https://github.com/cjne/ha-sunspec/issues" diff --git a/custom_components/sunspec/manifest.json b/custom_components/sunspec/manifest.json index d766522..ff7618b 100644 --- a/custom_components/sunspec/manifest.json +++ b/custom_components/sunspec/manifest.json @@ -8,5 +8,5 @@ "iot_class": "local_polling", "issue_tracker": "https://github.com/cjne/ha-sunspec/issues", "requirements": ["pysunspec2==1.0.8"], - "version": "0.0.23" + "version": "0.0.24" } diff --git a/custom_components/sunspec/sensor.py b/custom_components/sunspec/sensor.py index 2025678..9de35e7 100644 --- a/custom_components/sunspec/sensor.py +++ b/custom_components/sunspec/sensor.py @@ -99,9 +99,6 @@ async def async_setup_entry(hass, entry, async_add_devices): sunspec_unit = meta.get("units", "") ha_meta = HA_META.get(sunspec_unit, [sunspec_unit, None, None]) device_class = ha_meta[2] - if sunspec_unit == "": - _LOGGER.debug("No unit for") - _LOGGER.debug(meta) if device_class == DEVICE_CLASS_ENERGY: _LOGGER.debug("Adding energy sensor") sensors.append(SunSpecEnergySensor(coordinator, entry, data)) @@ -176,6 +173,8 @@ def __init__(self, coordinator, config_entry, data): self.use_device_class, self.unit, ) + if self.device_class == SensorDeviceClass.ENUM: + _LOGGER.debug("Valid options for ENUM: %s", self._options) # def async_will_remove_from_hass(self): # _LOGGER.debug(f"Will remove sensor {self._uniqe_id}") @@ -214,7 +213,7 @@ def native_value(self): return None vtype = self._meta["type"] if vtype in ("enum16", "bitfield32"): - symbols = self._meta.get("symbols", None) + symbols = self._point_meta.get("symbols", None) if symbols is None: return val if vtype == "enum16":