Intressting, I will have a look at this later!
I guess I should re-install home assistant on my pi as an docker container for best result?
Intressting, I will have a look at this later!
I guess I should re-install home assistant on my pi as an docker container for best result?
You donāt need to run the docker image on the pi. You can run it on any other machine as long as it is connected to Internet, be it on your network or not. You can even run it on AWS cloud if you want.
Once you put your email/password and get the security token, you will control your own installation.
Thanks! I canāt see what I was doing wrong to make the set_target_heat_flow_temperature
call hang.
Incidentally, I switched from melcloudexp
to using the closed PR WIP: Add separate flow mode climates for ATW devices by vilppuvuorinen Ā· Pull Request #56099 Ā· home-assistant/core Ā· GitHub it seems to work fine. I can add a nice thermostat card which gives me a dial to set the flow temp in a nice way. It tries to add the daily_energy_consumed
sensor which throws an exception because the pymelcloud
device doesnāt have that attribute.
Has anyone made any progress with this recently? The PR you mention above bwduncan seems to be closed. I have also failed to get melcloudexp to install (āConfig flow could not be loadedā error).
It would be great to be able to control flow temps easily in HA!
Hey Iām not the person to push this PR to merging.
However there is a small change I had to make to get it running for me, and itās working well enough since then. When I get home I will dig that out and post it here
This is a patch for the code Iām currently using to get flow temp climate entities. It works, but whenever you power on/off the device from HA, it resets to room temp, not flow temp, and there is no way to change back to flow mode from HA. So I am still powering on my HP directly in the melcloud web interface. Once you have turned it on, though, everything works as expected.
--- a/sensor.py 2023-09-08 13:30:21.621357036 +0100 [145/1925]
+++ b/sensor.py 2023-01-05 01:53:08.285834585 +0000
@@ -1,21 +1,23 @@
"""Support for MelCloud device sensors."""
from __future__ import annotations
+from collections.abc import Callable
from dataclasses import dataclass
-from typing import Any, Callable
+from typing import Any
from pymelcloud import DEVICE_TYPE_ATA, DEVICE_TYPE_ATW
from pymelcloud.atw_device import Zone
from homeassistant.components.sensor import (
- DEVICE_CLASS_ENERGY,
- DEVICE_CLASS_TEMPERATURE,
- STATE_CLASS_MEASUREMENT,
- STATE_CLASS_TOTAL_INCREASING,
+ SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
+ SensorStateClass,
)
-from homeassistant.const import ENERGY_KILO_WATT_HOUR, TEMP_CELSIUS
+from homeassistant.config_entries import ConfigEntry
+from homeassistant.const import UnitOfEnergy, UnitOfTemperature
+from homeassistant.core import HomeAssistant
+from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import MelCloudDevice
from .const import DOMAIN
@@ -41,8 +43,8 @@
key="room_temperature",
name="Room Temperature",
icon="mdi:thermometer",
- native_unit_of_measurement=TEMP_CELSIUS,
- device_class=DEVICE_CLASS_TEMPERATURE,
+ native_unit_of_measurement=UnitOfTemperature.CELSIUS,
+ device_class=SensorDeviceClass.TEMPERATURE,
value_fn=lambda x: x.device.room_temperature,
enabled=lambda x: True,
),
@@ -50,19 +52,28 @@
key="energy",
name="Energy",
icon="mdi:factory",
- native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
- device_class=DEVICE_CLASS_ENERGY,
+ native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
+ device_class=SensorDeviceClass.ENERGY,
value_fn=lambda x: x.device.total_energy_consumed,
enabled=lambda x: x.device.has_energy_consumed_meter,
),
+ MelcloudSensorEntityDescription(
+ key="daily_energy",
+ name="Daily Energy Consumed",
+ icon="mdi:factory",
+ native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
+ device_class=SensorDeviceClass.ENERGY,
+ value_fn=lambda x: x.device.daily_energy_consumed,
+ enabled=lambda x: True,
+ ),
)
ATW_SENSORS: tuple[MelcloudSensorEntityDescription, ...] = (
MelcloudSensorEntityDescription(
key="outside_temperature",
name="Outside Temperature",
icon="mdi:thermometer",
- native_unit_of_measurement=TEMP_CELSIUS,
- device_class=DEVICE_CLASS_TEMPERATURE,
+ native_unit_of_measurement=UnitOfTemperature.CELSIUS,
+ device_class=SensorDeviceClass.TEMPERATURE,
value_fn=lambda x: x.device.outside_temperature,
enabled=lambda x: True,
),
@@ -70,46 +81,28 @@
key="tank_temperature",
name="Tank Temperature",
icon="mdi:thermometer",
- native_unit_of_measurement=TEMP_CELSIUS,
- device_class=DEVICE_CLASS_TEMPERATURE,
+ native_unit_of_measurement=UnitOfTemperature.CELSIUS,
+ device_class=SensorDeviceClass.TEMPERATURE,
value_fn=lambda x: x.device.tank_temperature,
enabled=lambda x: True,
),
- MelcloudSensorEntityDescription(
- key="flow_temperature_boiler",
- name="Boiler Flow Temperature",
- icon="mdi:thermometer",
- native_unit_of_measurement=TEMP_CELSIUS,
- device_class=DEVICE_CLASS_TEMPERATURE,
- value_fn=lambda x: x.device.flow_temperature_boiler,
- enabled=lambda x: True,
- ),
- MelcloudSensorEntityDescription(
- key="return_temperature_boiler",
- name="Boiler Return Temperature",
- icon="mdi:thermometer",
- native_unit_of_measurement=TEMP_CELSIUS,
- device_class=DEVICE_CLASS_TEMPERATURE,
- value_fn=lambda x: x.device.return_temperature_boiler,
- enabled=lambda x: True,
- ),
- MelcloudSensorEntityDescription(
- key="mixing_tank_temperature",
- name="Mixing Tank Temperature",
- icon="mdi:thermometer",
- native_unit_of_measurement=TEMP_CELSIUS,
- device_class=DEVICE_CLASS_TEMPERATURE,
- value_fn=lambda x: x.device.mixing_tank_temperature,
- enabled=lambda x: True,
- ),
+# MelcloudSensorEntityDescription(
+# key="daily_energy",
+# name="Daily Energy Consumed",
+# icon="mdi:factory",
+# native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
+# device_class=SensorDeviceClass.ENERGY,
+# value_fn=lambda x: x.device.daily_energy_consumed,
+# enabled=lambda x: True,
+# ),
)
ATW_ZONE_SENSORS: tuple[MelcloudSensorEntityDescription, ...] = (
MelcloudSensorEntityDescription(
key="room_temperature",
name="Room Temperature",
icon="mdi:thermometer",
- native_unit_of_measurement=TEMP_CELSIUS,
- device_class=DEVICE_CLASS_TEMPERATURE,
+ native_unit_of_measurement=UnitOfTemperature.CELSIUS,
+ device_class=SensorDeviceClass.TEMPERATURE,
value_fn=lambda zone: zone.room_temperature,
enabled=lambda x: True,
),
@@ -117,8 +110,8 @@
key="flow_temperature",
name="Flow Temperature",
icon="mdi:thermometer",
- native_unit_of_measurement=TEMP_CELSIUS,
- device_class=DEVICE_CLASS_TEMPERATURE,
+ native_unit_of_measurement=UnitOfTemperature.CELSIUS,
+ device_class=SensorDeviceClass.TEMPERATURE,
value_fn=lambda zone: zone.flow_temperature,
enabled=lambda x: True,
),
@@ -126,15 +119,17 @@
key="return_temperature",
name="Flow Return Temperature",
icon="mdi:thermometer",
- native_unit_of_measurement=TEMP_CELSIUS,
- device_class=DEVICE_CLASS_TEMPERATURE,
+ native_unit_of_measurement=UnitOfTemperature.CELSIUS,
+ device_class=SensorDeviceClass.TEMPERATURE,
value_fn=lambda zone: zone.return_temperature,
enabled=lambda x: True,
),
)
-async def async_setup_entry(hass, entry, async_add_entities):
+async def async_setup_entry(
+ hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
+) -> None:
"""Set up MELCloud device sensors based on config_entry."""
mel_devices = hass.data[DOMAIN].get(entry.entry_id)
@@ -178,17 +173,17 @@
self._attr_name = f"{api.name} {description.name}"
self._attr_unique_id = f"{api.device.serial}-{api.device.mac}-{description.key}"
- if description.device_class == DEVICE_CLASS_ENERGY:
- self._attr_state_class = STATE_CLASS_TOTAL_INCREASING
+ if description.device_class == SensorDeviceClass.ENERGY:
+ self._attr_state_class = SensorStateClass.TOTAL_INCREASING
else:
- self._attr_state_class = STATE_CLASS_MEASUREMENT
+ self._attr_state_class = SensorStateClass.MEASUREMENT
@property
def native_value(self):
"""Return the state of the sensor."""
return self.entity_description.value_fn(self._api)
- async def async_update(self):
+ async def async_update(self) -> None:
"""Retrieve latest state."""
await self._api.async_update()
Hi! Iāve installed your docker package, and everything works fine! thanks!
Iāve only issues integrating in HA; have you already a Node-Red configuration you can share, or a HA automation I can take inspiration?
thanks!
Hi Fernando,
I tried your code using docker on my laptop and it seems to do just what I want it to, but I don;t want it to be on my laptop as thatās not running all the time. Iām not an IT expert, just OK at fiddling around, but Iām stumped as to how to install your code to work with HA. I have an Odroid N2+ with pre-installed HA. I donāt actually know if itās running in a Docker container or not, nor do I know how to find out. If I just go into the terminal/SSH add-on in HA and run your command line, it doesnāt work, but I assume thatās becuase when you open the terminal from HA you are already in the HA container (if itās containersied, if not, then Iām guessing the Docker command wonāt mean anything becuase docker isnāt installed!). I appreciate this is not a problem related to your code, but if you have any ideas, or if youāre planning to also release it as an āunauthorisedā HACS addon, Iād really appreciate it.
Hi,
I also have an Ecodan ATW and I am very interested in flow temperature control. We are currently on a 5p / kWh rate through the night and I want to up the flow temperature during this time and drop it when the price goes to the peak rate.
Is this capability being worked on at the moment through the MELCloud integration or is it dead. I think the docker solution is beyond my abilities to get up and running
I have found the easiest way to setup is with a custom_component based on the fork. Below is a zip you can just drop into the folder and it will load instead of the core version. Let me know how you setup your flow optimisation, I have some basic automations setup for Octopus Agile.
Hi Tim,
I just ask for the rights to DL the zip. As soon as you will release it Iāll try it and Iāll let you know!
thanks in advance,
Mauro
No problem I have updated the permissions so you can download the file.
Tim
Hi Tim. Iāve copied your folder and now I can see the Zone1 Heat flow climate entity!
thanks a lot!
Mauro
Hi Tim, tanks a lot, so I need to knnow if is necessary install first de melcloud_custom and later upload your zip, i do it so my integration now said that the integration not iniciated, but the zone 1 flow control is still working
And the other question, can you share your automatizations for flow optimization?
Thanks a lot.
can you share your automations?