From 9302a6295405aac4e99c0d0509793ca31db2fbbf Mon Sep 17 00:00:00 2001 From: unl0ck Date: Wed, 11 Dec 2024 09:08:17 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20FIX:=20added=20state=5Fclass=20t?= =?UTF-8?q?o=20historical?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion-edge.toml | 2 +- GridboxConnectorAddon-edge/CHANGELOG.md | 5 +++++ .../GridboxConnector/__main__.py | 2 +- .../ha_viessmann_gridbox_connector.py | 20 +++++++++---------- GridboxConnectorAddon-edge/cloudSettings.json | 2 +- GridboxConnectorAddon-edge/config.yaml | 2 +- .../rootfs/share/cloudSettings.json | 2 +- 7 files changed, 20 insertions(+), 15 deletions(-) diff --git a/.bumpversion-edge.toml b/.bumpversion-edge.toml index 2b51ff7..1bf66f7 100644 --- a/.bumpversion-edge.toml +++ b/.bumpversion-edge.toml @@ -1,5 +1,5 @@ [tool.bumpversion] -current_version = "2.11.22" +current_version = "2.11.23" parse = "(?P\\d+)\\.(?P\\d+)\\.(?P\\d+)" serialize = ["{major}.{minor}.{patch}"] search = "{current_version}" diff --git a/GridboxConnectorAddon-edge/CHANGELOG.md b/GridboxConnectorAddon-edge/CHANGELOG.md index 047d2f7..2407aa8 100644 --- a/GridboxConnectorAddon-edge/CHANGELOG.md +++ b/GridboxConnectorAddon-edge/CHANGELOG.md @@ -1,5 +1,10 @@ +## 2.11.23 + +### 🔨 Fixed + +- historical devices added state_class ## 2.11.22 ### 🔨 Fixed diff --git a/GridboxConnectorAddon-edge/GridboxConnector/__main__.py b/GridboxConnectorAddon-edge/GridboxConnector/__main__.py index bf23475..a32a4bf 100644 --- a/GridboxConnectorAddon-edge/GridboxConnector/__main__.py +++ b/GridboxConnectorAddon-edge/GridboxConnector/__main__.py @@ -118,7 +118,7 @@ def run_addon(): viessmann_gridbox_device = HAViessmannGridboxConnector(mqtt_settings=mqtt_settings, logger=logger) - viessmann_gridbox_historical_device = HAViessmannGridboxConnector(mqtt_settings=mqtt_settings, device_name="Viessmann Gridbox Historical", device_identifiers="viessmann_gridbox_historical", prefix="historical", logger=logger, unit_of_power="Wh", device_class_of_power="energy") + viessmann_gridbox_historical_device = HAViessmannGridboxConnector(mqtt_settings=mqtt_settings, device_name="Viessmann Gridbox Historical", device_identifiers="viessmann_gridbox_historical", prefix="historical", logger=logger, unit_of_power="Wh", device_class_of_power="energy", state_class="total") gridboxConnector = GridboxConnector(gridbox_config) diff --git a/GridboxConnectorAddon-edge/GridboxConnector/ha_viessmann_gridbox_connector.py b/GridboxConnectorAddon-edge/GridboxConnector/ha_viessmann_gridbox_connector.py index 584c5e8..6c13894 100644 --- a/GridboxConnectorAddon-edge/GridboxConnector/ha_viessmann_gridbox_connector.py +++ b/GridboxConnectorAddon-edge/GridboxConnector/ha_viessmann_gridbox_connector.py @@ -27,7 +27,7 @@ class HAViessmannGridboxConnector: heater_sensor: HAViessmannHeater logger: logging.Logger - def __init__(self, mqtt_settings, device_name="Viessmann Gridbox", device_identifiers="viessmann_gridbox", device_manufacturer="Viessmann", device_model="Vitocharge 2.0", prefix="", logger=logging.getLogger(__name__),device_class_of_power="power", unit_of_power="W"): + def __init__(self, mqtt_settings, device_name="Viessmann Gridbox", device_identifiers="viessmann_gridbox", device_manufacturer="Viessmann", device_model="Vitocharge 2.0", prefix="", logger=logging.getLogger(__name__),device_class_of_power="power", unit_of_power="W",state_class=None): self.battery_sensor_dict = {} self.ev_sensor_dict = {} self.logger = logger @@ -35,37 +35,37 @@ def __init__(self, mqtt_settings, device_name="Viessmann Gridbox", device_identi self.device_info = DeviceInfo( name=device_name, identifiers=device_identifiers, manufacturer=device_manufacturer, model=device_model) self.logger.info(f"Device Info: {self.device_info}") - production_sensor_info = SensorInfo(name="Production", device_class=device_class_of_power, unique_id="gridbox_production"+prefix, device=self.device_info, unit_of_measurement=unit_of_power) + production_sensor_info = SensorInfo(name="Production", device_class=device_class_of_power, unique_id="gridbox_production"+prefix, device=self.device_info, unit_of_measurement=unit_of_power, state_class=state_class) production_settings = Settings(mqtt=mqtt_settings, entity=production_sensor_info) - grid_sensor_info = SensorInfo(name="Grid", device_class=device_class_of_power, unique_id="gridbox_grid"+prefix, device=self.device_info, unit_of_measurement=unit_of_power) + grid_sensor_info = SensorInfo(name="Grid", device_class=device_class_of_power, unique_id="gridbox_grid"+prefix, device=self.device_info, unit_of_measurement=unit_of_power, state_class=state_class) grid_settings = Settings(mqtt=mqtt_settings, entity=grid_sensor_info) - photovoltaic_sensor_info = SensorInfo(name="Photovoltaic", device_class=device_class_of_power, unique_id="gridbox_photovoltaic"+prefix, device=self.device_info, unit_of_measurement=unit_of_power) + photovoltaic_sensor_info = SensorInfo(name="Photovoltaic", device_class=device_class_of_power, unique_id="gridbox_photovoltaic"+prefix, device=self.device_info, unit_of_measurement=unit_of_power, state_class=state_class) photovoltaic_settings = Settings(mqtt=mqtt_settings, entity=photovoltaic_sensor_info) # consumption - consumption_household_sensor_info = SensorInfo(name="Consumption", device_class=device_class_of_power, unique_id="gridbox_consumption_household"+prefix, device=self.device_info, unit_of_measurement=unit_of_power) + consumption_household_sensor_info = SensorInfo(name="Consumption", device_class=device_class_of_power, unique_id="gridbox_consumption_household"+prefix, device=self.device_info, unit_of_measurement=unit_of_power, state_class=state_class) consumption_household_settings = Settings(mqtt=mqtt_settings, entity=consumption_household_sensor_info) - total_consumption_household_sensor_info = SensorInfo(name="Total Consumption", device_class=device_class_of_power, unique_id="total_consumption_household"+prefix, device=self.device_info, unit_of_measurement=unit_of_power) + total_consumption_household_sensor_info = SensorInfo(name="Total Consumption", device_class=device_class_of_power, unique_id="total_consumption_household"+prefix, device=self.device_info, unit_of_measurement=unit_of_power, state_class=state_class) total_consumption_household_settings = Settings(mqtt=mqtt_settings, entity=total_consumption_household_sensor_info) # Direct Consumption - direct_consumption_household_sensor_info = SensorInfo(name="DirectConsumptionHousehold", device_class=device_class_of_power, unique_id="gridbox_direct_consumption_household"+prefix, device=self.device_info, unit_of_measurement=unit_of_power) + direct_consumption_household_sensor_info = SensorInfo(name="DirectConsumptionHousehold", device_class=device_class_of_power, unique_id="gridbox_direct_consumption_household"+prefix, device=self.device_info, unit_of_measurement=unit_of_power, state_class=state_class) direct_consumption_household_settings = Settings(mqtt=mqtt_settings, entity=direct_consumption_household_sensor_info) - direct_consumption_heatpump_sensor_info = SensorInfo(name="DirectConsumptionHeatPump", device_class=device_class_of_power, unique_id="gridbox_direct_consumption_heatpump"+prefix, device=self.device_info, unit_of_measurement=unit_of_power) + direct_consumption_heatpump_sensor_info = SensorInfo(name="DirectConsumptionHeatPump", device_class=device_class_of_power, unique_id="gridbox_direct_consumption_heatpump"+prefix, device=self.device_info, unit_of_measurement=unit_of_power, state_class=state_class) direct_consumption_heatpump_settings = Settings(mqtt=mqtt_settings, entity=direct_consumption_heatpump_sensor_info) - direct_consumption_ev_sensor_info = SensorInfo(name="DirectConsumptionEV", device_class=device_class_of_power, unique_id="gridbox_direct_consumption_ev"+prefix, device=self.device_info, unit_of_measurement=unit_of_power) + direct_consumption_ev_sensor_info = SensorInfo(name="DirectConsumptionEV", device_class=device_class_of_power, unique_id="gridbox_direct_consumption_ev"+prefix, device=self.device_info, unit_of_measurement=unit_of_power, state_class=state_class) direct_consumption_ev_settings = Settings(mqtt=mqtt_settings, entity=direct_consumption_ev_sensor_info) direct_consumption_rate_sensor_info = SensorInfo(name="DirectConsumptionRate", device_class="power_factor", unique_id="gridbox_direct_consumption_rate"+prefix, device=self.device_info, unit_of_measurement="%") direct_consumption_rate_settings = Settings(mqtt=mqtt_settings, entity=direct_consumption_rate_sensor_info) # Self Consumption - self_supply_sensor_info = SensorInfo(name="SelfSupply", device_class=device_class_of_power,unique_id="gridbox_self_supply"+prefix, device=self.device_info, unit_of_measurement=unit_of_power) + self_supply_sensor_info = SensorInfo(name="SelfSupply", device_class=device_class_of_power,unique_id="gridbox_self_supply"+prefix, device=self.device_info, unit_of_measurement=unit_of_power, state_class=state_class) self_supply_settings = Settings(mqtt=mqtt_settings, entity=self_supply_sensor_info) self_consumption_rate_sensor_info = SensorInfo(name="SelfConsumptionRate", device_class="power_factor", unique_id="gridbox_self_consumption_rate"+prefix, device=self.device_info, unit_of_measurement="%") diff --git a/GridboxConnectorAddon-edge/cloudSettings.json b/GridboxConnectorAddon-edge/cloudSettings.json index badf497..6ba4882 100644 --- a/GridboxConnectorAddon-edge/cloudSettings.json +++ b/GridboxConnectorAddon-edge/cloudSettings.json @@ -1,5 +1,5 @@ { - "version": "2.11.22", + "version": "2.11.23", "urls": { "login": "https://gridx.eu.auth0.com/oauth/token", "gateways": "https://api.gridx.de/gateways", diff --git a/GridboxConnectorAddon-edge/config.yaml b/GridboxConnectorAddon-edge/config.yaml index 8a80f87..c9e2acc 100644 --- a/GridboxConnectorAddon-edge/config.yaml +++ b/GridboxConnectorAddon-edge/config.yaml @@ -1,7 +1,7 @@ # https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config --- name: Viessmann Gridbox Connector (edge) -version: "2.11.22" +version: "2.11.23" slug: "gridbox_connector_edge" description: "Viessmann Gridbox Connector (edge)" url: "https://github.com/unl0ck/homeassistant-addon-viessmann-gridbox/tree/main/GridboxConnectorAddon-edge" diff --git a/GridboxConnectorAddon-edge/rootfs/share/cloudSettings.json b/GridboxConnectorAddon-edge/rootfs/share/cloudSettings.json index badf497..6ba4882 100644 --- a/GridboxConnectorAddon-edge/rootfs/share/cloudSettings.json +++ b/GridboxConnectorAddon-edge/rootfs/share/cloudSettings.json @@ -1,5 +1,5 @@ { - "version": "2.11.22", + "version": "2.11.23", "urls": { "login": "https://gridx.eu.auth0.com/oauth/token", "gateways": "https://api.gridx.de/gateways",