diff --git a/custom_components/solarfocus/binary_sensor.py b/custom_components/solarfocus/binary_sensor.py index 0cd0b8e..cae9ccf 100644 --- a/custom_components/solarfocus/binary_sensor.py +++ b/custom_components/solarfocus/binary_sensor.py @@ -24,16 +24,24 @@ BUFFER_PREFIX, CONF_BIOMASS_BOILER, CONF_BUFFER, + CONF_FRESH_WATER_MODULE, CONF_HEATING_CIRCUIT, CONF_HEATPUMP, + CONF_PHOTOVOLTAIC, DATA_COORDINATOR, DOMAIN, + FRESH_WATER_MODULE_COMPONENT, + FRESH_WATER_MODULE_COMPONENT_PREFIX, + FRESH_WATER_MODULE_PREFIX, HEAT_PUMP_COMPONENT, HEAT_PUMP_COMPONENT_PREFIX, HEAT_PUMP_PREFIX, HEATING_CIRCUIT_COMPONENT, HEATING_CIRCUIT_COMPONENT_PREFIX, HEATING_CIRCUIT_PREFIX, + PHOTOVOLTAIC_COMPONENT, + PHOTOVOLTAIC_COMPONENT_PREFIX, + PHOTOVOLTAIC_PREFIX, ) from .entity import ( SolarfocusEntity, @@ -106,6 +114,32 @@ async def async_setup_entry( entity = SolarfocusBinarySensorEntity(coordinator, _description) entities.append(entity) + if config_entry.options[CONF_PHOTOVOLTAIC]: + for description in PHOTOVOLTAIC_BINARY_SENSOR_TYPES: + _description = create_description( + PHOTOVOLTAIC_PREFIX, + PHOTOVOLTAIC_COMPONENT, + PHOTOVOLTAIC_COMPONENT_PREFIX, + "", + description, + ) + + entity = SolarfocusBinarySensorEntity(coordinator, _description) + entities.append(entity) + + if config_entry.options[CONF_FRESH_WATER_MODULE]: + for description in FRESH_WATER_MODULE_BINARY_SENSOR_TYPES: + _description = create_description( + FRESH_WATER_MODULE_PREFIX, + FRESH_WATER_MODULE_COMPONENT, + FRESH_WATER_MODULE_COMPONENT_PREFIX, + "", + description, + ) + + entity = SolarfocusBinarySensorEntity(coordinator, _description) + entities.append(entity) + async_add_entities(filterVersionAndSystem(config_entry, entities)) @@ -195,3 +229,24 @@ def is_on(self): unsupported_systems=[Systems.THERMINATOR, Systems.VAMPAIR], ), ] + +PHOTOVOLTAIC_BINARY_SENSOR_TYPES = [ + SolarfocusBinarySensorEntityDescription( + key="overcharge_possible", + device_class=BinarySensorDeviceClass.POWER, + on_state="1", + ), + SolarfocusBinarySensorEntityDescription( + key="overcharge_active", + device_class=BinarySensorDeviceClass.RUNNING, + on_state="1", + ), +] + +FRESH_WATER_MODULE_BINARY_SENSOR_TYPES = [ + SolarfocusBinarySensorEntityDescription( + key="valve", + device_class=BinarySensorDeviceClass.OPENING, + on_state="1", + ), +] diff --git a/custom_components/solarfocus/config_flow.py b/custom_components/solarfocus/config_flow.py index 0450e86..99da061 100644 --- a/custom_components/solarfocus/config_flow.py +++ b/custom_components/solarfocus/config_flow.py @@ -50,6 +50,7 @@ # CONF_API_VERSION SOLARFOCUS_API_VERSIONS = [ + selector.SelectOptionDict(value="23.040", label="v23.040"), selector.SelectOptionDict(value="23.020", label="v23.020"), selector.SelectOptionDict(value="23.010", label="v23.010"), selector.SelectOptionDict(value="22.090", label="v22.090"), @@ -228,7 +229,10 @@ async def async_step_component( return self.async_show_form( step_id="component", data_schema=STEP_COMP_VAMPAIR_SELECTION_SCHEMA ) - if self.data[CONF_SOLARFOCUS_SYSTEM] in [Systems.THERMINATOR, Systems.ECOTOP]: + if self.data[CONF_SOLARFOCUS_SYSTEM] in [ + Systems.THERMINATOR, + Systems.ECOTOP, + ]: return self.async_show_form( step_id="component", data_schema=STEP_COMP_THERMINATOR_SELECTION_SCHEMA, @@ -295,7 +299,10 @@ async def async_step_init( if self.config_entry.data[CONF_SOLARFOCUS_SYSTEM] == Systems.VAMPAIR: self.options[CONF_HEATPUMP] = user_input[CONF_HEATPUMP] self.options[CONF_BIOMASS_BOILER] = False - elif self.config_entry.data[CONF_SOLARFOCUS_SYSTEM] in [Systems.THERMINATOR, Systems.ECOTOP]: + elif self.config_entry.data[CONF_SOLARFOCUS_SYSTEM] in [ + Systems.THERMINATOR, + Systems.ECOTOP, + ]: self.options[CONF_BIOMASS_BOILER] = user_input[CONF_BIOMASS_BOILER] self.options[CONF_HEATPUMP] = False @@ -396,7 +403,10 @@ async def _show_init_form(self, user_input, errors): } ) - elif self.config_entry.data[CONF_SOLARFOCUS_SYSTEM] in [Systems.THERMINATOR, Systems.ECOTOP]: + elif self.config_entry.data[CONF_SOLARFOCUS_SYSTEM] in [ + Systems.THERMINATOR, + Systems.ECOTOP, + ]: data_schema = vol.Schema( { vol.Required( diff --git a/custom_components/solarfocus/manifest.json b/custom_components/solarfocus/manifest.json index 9f0dc40..a977381 100644 --- a/custom_components/solarfocus/manifest.json +++ b/custom_components/solarfocus/manifest.json @@ -9,8 +9,8 @@ "integration_type": "hub", "iot_class": "local_polling", "issue_tracker": "https://github.com/lavermanjj/home-assistant-solarfocus/issues", - "requirements": ["pysolarfocus==4.1.0"], + "requirements": ["pysolarfocus==4.2.0"], "ssdp": [], - "version": "4.0.1", + "version": "4.1.0", "zeroconf": [] } diff --git a/custom_components/solarfocus/sensor.py b/custom_components/solarfocus/sensor.py index 5162abb..252c0fe 100644 --- a/custom_components/solarfocus/sensor.py +++ b/custom_components/solarfocus/sensor.py @@ -596,7 +596,7 @@ def native_value(self): icon="mdi:format-list-bulleted", device_class=SensorDeviceClass.ENUM, options=list(range(0, 2)), - unsupported_systems=[Systems.VAMPAIR, Systems.ECOTOP], + unsupported_systems=[Systems.VAMPAIR, Systems.ECOTOP], ), SolarfocusSensorEntityDescription( key="pellet_usage_last_fill", @@ -717,4 +717,27 @@ def native_value(self): options=list(range(0, 5)), min_required_version="23.020", ), + SolarfocusSensorEntityDescription( + key="supply_temperature", + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + icon="mdi:thermometer", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + min_required_version="23.040", + ), + SolarfocusSensorEntityDescription( + key="flow_rate", + native_unit_of_measurement=VOLUME_FLOW_RATE_LITER_PER_HOUR, + icon="mdi:speedometer", + state_class=SensorStateClass.MEASUREMENT, + min_required_version="23.040", + ), + SolarfocusSensorEntityDescription( + key="target_temperature", + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + icon="mdi:thermometer", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + min_required_version="23.040", + ), ]