generated from home-assistant/addons-example
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
👌 IMPROVE: Heater now show Temperature
- Loading branch information
Showing
9 changed files
with
104 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
GridboxConnectorAddon-edge/GridboxConnector/ha_viessmann_heater.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from ha_mqtt_discoverable.sensors import Sensor, SensorInfo | ||
from ha_mqtt_discoverable import Settings, DeviceInfo | ||
|
||
|
||
class HAViessmannHeater: | ||
def __init__(self, mqtt_settings, device_info, name, id): | ||
self.id: str = id | ||
self.name: str = name | ||
self.device_info: DeviceInfo = device_info | ||
self.mqtt_settings: Settings.MQTT = mqtt_settings | ||
|
||
self.heater_sensor_power = SensorInfo( | ||
name=f"Heater {name} Power", device_class="energy", unique_id=f"gridbox_heater_power_{name}", device=device_info, unit_of_measurement="W") | ||
self.heater_power_settings = Settings( | ||
mqtt=mqtt_settings, entity=self.heater_sensor_power) | ||
self.heater_power = Sensor(self.heater_power_settings) | ||
|
||
self.heater_sensor_temperature = SensorInfo( | ||
name=f"Heater {name} Temperature", device_class="temperature", unique_id=f"gridbox_heater_temperature_{name}", device=device_info, unit_of_measurement="C") | ||
self.heater_temperature_settings = Settings( | ||
mqtt=mqtt_settings, entity=self.heater_sensor_temperature) | ||
self.heater_temperature = Sensor(self.heater_temperature_settings) | ||
|
||
|
||
def get_name(self): | ||
return self.name | ||
|
||
def set_states(self, power, temperature): | ||
self.heater_power.set_state(power) | ||
self.heater_temperature.set_state(temperature) | ||
|
45 changes: 45 additions & 0 deletions
45
GridboxConnectorAddon-edge/GridboxConnector/tests/mock_data/mock_data_with_heater.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"batteries": [ | ||
{ | ||
"applianceID": "a1731af4-0399-495b-92c2-523fd61ab681", | ||
"capacity": 10000, | ||
"nominalCapacity": 10000, | ||
"power": -102, | ||
"remainingCharge": 10000, | ||
"stateOfCharge": 1 | ||
} | ||
], | ||
"battery": { | ||
"capacity": 10000, | ||
"nominalCapacity": 10000, | ||
"power": -102, | ||
"remainingCharge": 10000, | ||
"stateOfCharge": 1 | ||
}, | ||
"consumption": 847, | ||
"directConsumption": 4523, | ||
"directConsumptionEV": 0, | ||
"directConsumptionHeatPump": 0, | ||
"directConsumptionHeater": 3676, | ||
"directConsumptionHousehold": 847, | ||
"directConsumptionRate": 0.5465200579990334, | ||
"grid": -3651, | ||
"gridMeterReadingNegative": 5630400000, | ||
"gridMeterReadingPositive": 5344920000, | ||
"heaters": [ | ||
{ | ||
"applianceID": "12bdd8ec-9b1e-465e-8f26-feae00e5af0f", | ||
"power": 3676, | ||
"temperature": 70.9 | ||
} | ||
], | ||
"heating": 3676, | ||
"measuredAt": "2024-07-12T12:52:47Z", | ||
"photovoltaic": 8276, | ||
"production": 8276, | ||
"selfConsumption": 4625, | ||
"selfConsumptionRate": 0.5588448525857902, | ||
"selfSufficiencyRate": 1, | ||
"selfSupply": 4523, | ||
"totalConsumption": 4523 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters