Skip to content

Commit

Permalink
🐛 FIX: set Historical Data unit Wh
Browse files Browse the repository at this point in the history
  • Loading branch information
unl0ck committed Dec 8, 2024
1 parent 244cdc8 commit 7f6ce05
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .bumpversion-edge.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.bumpversion]
current_version = "2.11.17"
current_version = "2.11.18"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
serialize = ["{major}.{minor}.{patch}"]
search = "{current_version}"
Expand Down
6 changes: 6 additions & 0 deletions GridboxConnectorAddon-edge/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<!-- https://developers.home-assistant.io/docs/add-ons/presentation#keeping-a-changelog -->

## 2.11.18

### 🔨 Fixed

- historical data now support Wh

## 2.11.17

### 🔨 Fixed
Expand Down
2 changes: 1 addition & 1 deletion GridboxConnectorAddon-edge/GridboxConnector/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,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",logger=logger, prefix="historical")
viessmann_gridbox_historical_device = HAViessmannGridboxConnector(mqtt_settings=mqtt_settings, device_name="Viessmann Gridbox Historical",device_identifiers="viessmann_gridbox_historical",logger=logger, prefix="historical", unit_of_power="Wh")


gridboxConnector = GridboxConnector(gridbox_config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,51 +27,51 @@ 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__)):
def __init__(self, mqtt_settings, device_name="Viessmann Gridbox", device_identifiers="viessmann_gridbox", device_manufacturer="Viessmann", device_model="Vitocharge 2.0", logger=logging.getLogger(__name__), unit_of_power="W"):
self.battery_sensor_dict = {}
self.ev_sensor_dict = {}
self.logger = logger
self.mqtt_settings = mqtt_settings
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="power", unique_id="gridbox_production"+prefix, device=self.device_info, unit_of_measurement="W")
production_sensor_info = SensorInfo(name="Production", device_class="power", unique_id="gridbox_production", device=self.device_info, unit_of_measurement=unit_of_power)
production_settings = Settings(mqtt=mqtt_settings, entity=production_sensor_info)

grid_sensor_info = SensorInfo(name="Grid", device_class="power", unique_id="gridbox_grid"+prefix, device=self.device_info, unit_of_measurement="W")
grid_sensor_info = SensorInfo(name="Grid", device_class="power", unique_id="gridbox_grid", device=self.device_info, unit_of_measurement=unit_of_power)
grid_settings = Settings(mqtt=mqtt_settings, entity=grid_sensor_info)

photovoltaic_sensor_info = SensorInfo(name="Photovoltaic", device_class="power", unique_id="gridbox_photovoltaic"+prefix, device=self.device_info, unit_of_measurement="W")
photovoltaic_sensor_info = SensorInfo(name="Photovoltaic", device_class="power", unique_id="gridbox_photovoltaic", device=self.device_info, unit_of_measurement=unit_of_power)
photovoltaic_settings = Settings(mqtt=mqtt_settings, entity=photovoltaic_sensor_info)

# consumption
consumption_household_sensor_info = SensorInfo(name="Consumption", device_class="power", unique_id="gridbox_consumption_household"+prefix, device=self.device_info, unit_of_measurement="W")
consumption_household_sensor_info = SensorInfo(name="Consumption", device_class="power", unique_id="gridbox_consumption_household", device=self.device_info, unit_of_measurement=unit_of_power)
consumption_household_settings = Settings(mqtt=mqtt_settings, entity=consumption_household_sensor_info)

total_consumption_household_sensor_info = SensorInfo(name="Total Consumption", device_class="power", unique_id="total_consumption_household"+prefix, device=self.device_info, unit_of_measurement="W")
total_consumption_household_sensor_info = SensorInfo(name="Total Consumption", device_class="power", unique_id="total_consumption_household", device=self.device_info, unit_of_measurement=unit_of_power)
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="power", unique_id="gridbox_direct_consumption_household"+prefix, device=self.device_info, unit_of_measurement="W")
direct_consumption_household_sensor_info = SensorInfo(name="DirectConsumptionHousehold", device_class="power", unique_id="gridbox_direct_consumption_household", device=self.device_info, unit_of_measurement=unit_of_power)
direct_consumption_household_settings = Settings(mqtt=mqtt_settings, entity=direct_consumption_household_sensor_info)

direct_consumption_heatpump_sensor_info = SensorInfo(name="DirectConsumptionHeatPump", device_class="power", unique_id="gridbox_direct_consumption_heatpump"+prefix, device=self.device_info, unit_of_measurement="W")
direct_consumption_heatpump_sensor_info = SensorInfo(name="DirectConsumptionHeatPump", device_class="power", unique_id="gridbox_direct_consumption_heatpump", device=self.device_info, unit_of_measurement=unit_of_power)
direct_consumption_heatpump_settings = Settings(mqtt=mqtt_settings, entity=direct_consumption_heatpump_sensor_info)

direct_consumption_ev_sensor_info = SensorInfo(name="DirectConsumptionEV", device_class="power", unique_id="gridbox_direct_consumption_ev"+prefix, device=self.device_info, unit_of_measurement="W")
direct_consumption_ev_sensor_info = SensorInfo(name="DirectConsumptionEV", device_class="power", unique_id="gridbox_direct_consumption_ev", device=self.device_info, unit_of_measurement=unit_of_power)
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_sensor_info = SensorInfo(name="DirectConsumptionRate", device_class="power_factor", unique_id="gridbox_direct_consumption_rate", 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="power",unique_id="gridbox_self_supply"+prefix, device=self.device_info, unit_of_measurement="W")
self_supply_sensor_info = SensorInfo(name="SelfSupply", device_class="power",unique_id="gridbox_self_supply", device=self.device_info, unit_of_measurement=unit_of_power)
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="%")
self_consumption_rate_sensor_info = SensorInfo(name="SelfConsumptionRate", device_class="power_factor", unique_id="gridbox_self_consumption_rate", device=self.device_info, unit_of_measurement="%")
self_consumption_rate_settings = Settings(mqtt=mqtt_settings, entity=self_consumption_rate_sensor_info)

self_sufficiency_rate_sensor_info = SensorInfo(name="SelfSufficiencyRate", device_class="power_factor", unique_id="gridbox_self_sufficiency_rate"+prefix, device=self.device_info, unit_of_measurement="%")
self_sufficiency_rate_sensor_info = SensorInfo(name="SelfSufficiencyRate", device_class="power_factor", unique_id="gridbox_self_sufficiency_rate", device=self.device_info, unit_of_measurement="%")
self_sufficiency_rate_settings = Settings(mqtt=mqtt_settings, entity=self_sufficiency_rate_sensor_info)

# Instantiate the sensors
Expand All @@ -81,13 +81,13 @@ def __init__(self, mqtt_settings, device_name="Viessmann Gridbox", device_identi
self.photovoltaic_sensor = Sensor(photovoltaic_settings)

# Battery sum
self.battery_sum = HAViessmannBattery(mqtt_settings, self.device_info, "sum", ""+prefix)
self.battery_sum = HAViessmannBattery(mqtt_settings, self.device_info, "sum", "")

# Heater
self.heater_sensor = HAViessmannHeater(mqtt_settings, self.device_info, "", ""+prefix)
self.heater_sensor = HAViessmannHeater(mqtt_settings, self.device_info, "", "")

# EV
self.ev_sum = HAViessmannEVChargingStation(mqtt_settings, self.device_info, "sum", ""+prefix)
self.ev_sum = HAViessmannEVChargingStation(mqtt_settings, self.device_info, "sum", "")

# Consumption
self.consumption_household_sensor = Sensor(consumption_household_settings)
Expand Down
2 changes: 1 addition & 1 deletion GridboxConnectorAddon-edge/cloudSettings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.11.17",
"version": "2.11.18",
"urls": {
"login": "https://gridx.eu.auth0.com/oauth/token",
"gateways": "https://api.gridx.de/gateways",
Expand Down
2 changes: 1 addition & 1 deletion GridboxConnectorAddon-edge/config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config
---
name: Viessmann Gridbox Connector (edge)
version: "2.11.17"
version: "2.11.18"
slug: "gridbox_connector_edge"
description: "Viessmann Gridbox Connector (edge)"
url: "https://github.com/unl0ck/homeassistant-addon-viessmann-gridbox/tree/main/GridboxConnectorAddon-edge"
Expand Down
2 changes: 1 addition & 1 deletion GridboxConnectorAddon-edge/rootfs/share/cloudSettings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.11.17",
"version": "2.11.18",
"urls": {
"login": "https://gridx.eu.auth0.com/oauth/token",
"gateways": "https://api.gridx.de/gateways",
Expand Down

0 comments on commit 7f6ce05

Please sign in to comment.