Water heater service fails

Hi, I am having difficulty implementing a simple task. That is to have a button trigger the boiler and hot water to switch off. I have a hive heating system which I can successfully switch the heating from “scheduled” to “off” and back again using the generic hvac functions, however the script fails on the hot water “on / off”.

Here is the script:

  leave_home:
    sequence:
      - service: climate.set_hvac_mode
        target:
          entity_id: climate.thermostat_3
        data:
          hvac_mode: 'off'
      - service: water_heater.set_away_mode
        target:
          entity_id: water_heater.hot_water
        data:
          away_mode: true

I get an error “leave_home: Error executing script. Unexpected error for call_service at pos 2:”
The detailed error appears at this step:
" File “/usr/src/homeassistant/homeassistant/components/water_heater/init.py”, line 268, in turn_away_mode_on
raise NotImplementedError()
NotImplementedError"

I assumed I had to use the generic solution as the hive integration appears not to have a way of triggering “on / off” only “boost on / off”.

Any help or suggestions gratefully received.
Thanks

EDIT: Ignore this it is wrong.

This:

      - service: water_heater.set_away_mode
        target:
          entity_id: water_heater.hot_water
        data:
          away_mode: true

Should probably be:

    - service: climate.set_preset_mode
      target:
        entity_id: climate.thermostat_3
      data:
        preset_mode: "away" # or away_mode, check the entity's attributes in the Developer tools States menu.

See: Climate - Home Assistant

But:

@jenx — do you actually have a water_heater.hot_water entity?

1 Like

I did not realise that integration existed. Ignore my post.

Looks like this integration has a number of missing features:

    def turn_away_mode_on(self):
        """Turn away mode on."""
        raise NotImplementedError()

    async def async_turn_away_mode_on(self):
        """Turn away mode on."""
        await self.hass.async_add_executor_job(self.turn_away_mode_on)

    def turn_away_mode_off(self):
        """Turn away mode off."""
        raise NotImplementedError()

    async def async_turn_away_mode_off(self):
        """Turn away mode off."""
        await self.hass.async_add_executor_job(self.turn_away_mode_off)

    @property
    def supported_features(self):
        """Return the list of supported features."""
        raise NotImplementedError()

…with those lines being 3 years old.

Hi Troon, yes I do and the climate service only changes the heating mode, not hot water.

Since I posted the question I have found a solution to my problem. Instead of “water_heater.set_away_mode” which does not work. I found another service “water_heater.set_operation_mode” which does work and has the same effect. Its modes are “eco”, “on” and “off”.
Thanks to Tom_I and Troon for their assistance, hopefully this post will be useful to anyone else setting up hot water controls in HA.

1 Like

Thanks for sharing here. I also have a hive system. Out of interest do you get anything useful from the water heater component in terms of logging?
For me this is off most of the time and occasionally gets boosted.
I couldnt see any history tracking capability, eg know how and when it was was boosted. Do others have this capability built in?

Hi Dave,
I get a couple of entities in addition to water_heater.hot_water.
sensor.hotwater_mode - provides historical mode ie Scheduled or Manual
sensor.hotwater_state - shows whether hot water heater is on or off. Mine is set to come on for an hour in the morning and an hour in the evening for example. So history on the entity shows a time graphic.

No temperature is reported to hive.

Hi Jenx, was sensor.hotwater_mode added automatically when you set up hive? I don’t seem to have that or hotwater_state.

Maybe I need to delete and re-set up hive.

Hi Dave, yes it was. I had to reinstall the hive integration because of an issue.

Hmm, I just removed and re-added the hive integration but still see no sensor.hotwater_mode or sensor.hotwater_state.

I searched the entities for ‘hot’ and it wasn’t there.

In the hive integration under ‘thermostat’ I now see this:

Does anyone know how I could track the current hot water mode?