cjaliaga / home-assistant-aquarea

Home Assistant integration for Panasonic Aquarea devices connected to Aquarea Smart Cloud
MIT License
70 stars 13 forks source link

Discussion: Water Entity for Water Tank implementation #18

Open cjaliaga opened 1 year ago

cjaliaga commented 1 year ago

From Home Assistant Community Post: https://community.home-assistant.io/t/panasonic-aquarea-heat-pump-integration/392095/31

The water heater entity supports the following operations, but it doesn't include a "turn_on" or "turn_off" one :frowning:

water_heater.set_temperature , water_heater.turn_away_mode_on , water_heater.turn_away_mode_off , water_heater.set_operation_mode

https://www.home-assistant.io/integrations/water_heater#services

I had a lot of doubts on how to implement the water heater entity with Aquarea devices, to support the actions "on" and "off" but also to show via the interface if the heat pump is heating the water of the water tank or not: it can be turned on but the heat pump could be heating water for the heating floor (or cooling it) so the state/operation would be like "idle".

While it doesn't support turn_off, we can define the state as "STATE_OFF" or "STATE_HEAT_PUMP": https://developers.home-assistant.io/docs/core/entity/water-heater#states

I've implemented this via operations and so far the device accepts 2: heating and off:

Turn on:

service: water_heater.set_operation_mode
target:
  entity_id: water_heater.aerotermia_tank
data:
  operation_mode: heating

Turn off:

service: water_heater.set_operation_mode
target:
  entity_id: water_heater.aerotermia_tank
data:
  operation_mode: off

Opening this issue to discuss feedback, implementations and keep track of it.

Toma82 commented 1 year ago

Hi, I did such automation for water heating and it works correctly

alias: Test description: "" trigger:

wltng commented 6 months ago

I'm not sure if a new issue is jusitified, so I figured to post my question here: I noticed that the states of the climate entity are capitalized in the frontend (e.g. Heat, Idle etc.) but the states of the water_heater entity aren't (eg. heat, idle). I found out they can be changed in const.py, but then I also need to use the capitalized states in automations. Whereas I can use the lowercase states for the climate entity. Is this a frontend issue? Since the states are also valid climate entity states, is it maybe possible to use those constants instead?

javo222 commented 1 month ago

Hi @cjaliaga , I'm testing your great integration and I've managed to make two simple automations which looks like this:

alias: Heat water to 55 if <1kr and <55deg
description: >-
  Start water heating to 55 if current price less than 100öre/kWh and water temp below 55
trigger:
  - platform: time_pattern
    minutes: "1"
  - platform: numeric_state
    entity_id:
      - sensor.electricity_price_my_house
    attribute: price_level
    below: 1
condition:
  - condition: numeric_state
    entity_id: water_heater.aquarea1_tank
    attribute: current_temperature
    below: 55
action:
  - service: water_heater.set_temperature
    data:
      temperature: 55
      operation_mode: heating
    target:
      entity_id: water_heater.aquarea1_tank
mode: single
alias: Stop heating water if >1kr and >48deg
description: >-
  Stop water heating if current price more than 100öre/kWh and water temp above
  48
trigger:
  - platform: time_pattern
    seconds: "10"
  - platform: numeric_state
    entity_id:
      - sensor.electricity_price_my_house
    attribute: price_level
    above: 1
condition:
  - condition: numeric_state
    entity_id: water_heater.aquarea1_tank
    attribute: current_temperature
    above: 48
action:
  - service: water_heater.set_temperature
    data:
      operation_mode: "off"
      temperature: 50
    target:
      entity_id: water_heater.aquarea1_tank
mode: single

I can see on my dashboad and in the Aquarea Smart Cloud that the target is changing but the state on idle. After some reading I came to the conclusion that this is what you are describing in this post; but since it is pretty old, I was wondering if you had made any change/improvements?

What is the best way to enforce heating the water tank and prevent it from heating? Should I set STATE_OFF instead of: "operation_mode: off" ? Does the operation_mode: off only applies to the water tank or also the (floor) heating? I am asking because I also have climate.aquarea1_home (which I will look at next)

Thanks a lot! /J@V0