Can't Get Hive to turn on hot water using automation

Been using HA for 3 days now, and this is my first post ever.

I have a Hive Thermostat and have been trying to automate the central heating and hot water triggered off simple time of day. Central heating is working fine. For the hot water, I’m just changing the operation_mode between off and on, using the water_heater.set_operation_mode service, but nothing happens.

I created the automation in the visual editor. When viewed in YAML it’s as follows …

service: water_heater.set_operation_mode
data:
  operation_mode: "on"
target:
  device_id: blahblahblahblahblah

But it’s staying off. I can turn it on manually from the HA dashboard and that works ok. Any thoughts on what I’m missing in the automation?

try it in dev tools ➜ services using the UI and then change it to yaml (and then copy/paste).

When I used the Hive Hub, I didn’t use the device but the entity, so mine was:

- service: water_heater.set_operation_mode
  data:
    operation_mode: "on"
  target:
    entity_id: water_heater.thermostat

you will no doubt need to change the following line (to your entity name)

    entity_id: water_heater.<entity_name>

[edited for typos]

Worked perfectly, just changing device to entity.

Strange though, I used the device for changing central heating temperature and that worked ok.

Anyway, thanks so much.

My understanding is that one should prefer entities over devices. I can’t remember where I read that though.

Seems I spoke too soon. Over the past couple of weeks the hot water has failed to turn off. It’s a very simple automation, time based only, and most of the time it works. But just a couple of times now, the hot water stayed on, even though I can see that the automation fired as expected.

service: water_heater.set_operation_mode
data:
operation_mode: “off”
target:
entity_id: water_heater.thermostat_1

As I say, most of the time it works fine, so not sure what to try next. I could add additional ‘off’ commands to the automation, separated by a few seconds/minutes, or I could go back to having the schedule in Hive, which would be a shame.

Could there be some weird dependency between the state of the heating and the state of the hot water? Any other things to check?

Thanks

can you share the automation?

Here it is. Today I added the 2nd attempt at turning it off after a 1 minute interval, to see if this helps.

alias: Heating Water Off
description: ""
trigger:
  - platform: time
    at: "08:00:00"
  - platform: time
    at: "21:00:00"
condition: []
action:
  - service: water_heater.set_operation_mode
    data:
      operation_mode: "off"
    target:
      entity_id: water_heater.thermostat_1
  - delay:
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
  - service: water_heater.set_operation_mode
    data:
      operation_mode: "off"
    target:
      entity_id: water_heater.thermostat_1
mode: single

The automation looks fine,

Are you using the official Hive integration (via the cloud)? …maybe there are some Internet/network issues?

Yes, official integration.

Pre HA, schedules in the Hive app worked fine for years.

Haven’t noticed any other automation failures, just the hot water. First time it happened I just put it down to one of those things. But then it happened again a few days later, also at 9pm. I’ll see how it goes with the extra turn off operation, but if that doesn’t work I’ll just have to go back to Hive schedules, at least for the hot water.

Thanks so much for checking the automation.

Cool.

Are you aware that the Hive integration may stop working next summer so you might want to consider moving it across to Z2M (Zigbee). Advantage is that it is faster (and local of course).

Yes, I got the recent email announcements from Hive and was wondering whether that would affect HA.

I read that it’s possible to control Hive smart switches and bulbs locally, but didn’t know about thermostat functions. Do you expect that’s feasible, and what newbie-friendly Zigbee hardware would you suggest? Is this something you’ve tried? Thanks!!

Edit, I should have mentioned that I’m running HA OS on a RPi4B

Yes and yes.

I moved Hive across to Z2M about 6 months ago and haven’t looked back. Give me a shout nearer the time and I’ll happily talk you through it,

Awesome, thanks so much.

Had another occurrence of the hot water failing to turn off this morning.

I clicked on the automation event shown in the logbook, and can see that there’s some kind of error …

Triggered by the time at 21 November 2023 at 08:00:00
Call a service ‘Water Heater: Set operation mode’ on Thermostat 1
Stopped because an error was encountered at 21 November 2023 at 08:00:00 (runtime: 0.16 seconds)
‘NoneType’ object has no attribute ‘status’

I have no idea how to debug this intermittent problem. I don’t think it’s a network issue because this is the only automation that I’m having an issue with. It’s not even a general Hive issue because the central heating schedule is working fine. It’s just the hot water turning off.

Hi, just looking through this as I’m in the same boat and I’ve found this thread very helpful
In the example above the operation_mode has been set to “off” in both cases … I expect you intended to set it to “on” in the first action.

Hi, no, it’s as intended. I’m only showing the code for turning the hot water off. Making two attempts, separated by 1 minute. Just my feeble attempt to improve the reliability, but it didn’t help. So I went back to using the Hive app for heating and hot water scheduling, but in the next few months I’d like to try moving to Z2M, hopefully with help from jchh.

I’m here - just ask when you are ready.

1 Like

FYI you can template this.

When I was using the official integration I used sensor.hive_water_target_state that reflected what the state should be and then used this simple automation:

yaml
automation:
  - alias: Hive water
    id: "hive_water"
    description: ''
    mode: queued
    initial_state: true #ensure automation is turned on when restarting HA to set/reset water correctly
    trigger:
      - platform: state
        entity_id: sensor.hive_water_target_state # target state changes
        id: "target state change"
      - platform: state
        entity_id: input_button.set_hive_water    # reset state back to target
        id: "target state change"
      - platform: homeassistant
        event: start                              # reset state on restart
        id: "target state change"
      - platform: state
        entity_id: input_select.hive_water_mode   # mode change
        to: 'Boost'
        id: "boost start"
      - platform: state
        entity_id: input_select.hive_water_mode   # mode change
        from: Boost
        id: "boost over"
      - platform: state
        entity_id: timer.hive_water_boost         # boost completed
        to: idle
        id: "boost over"
    action:
      - choose:
          - conditions: #-------------------------------------------------------
              - condition: trigger
                id: "target state change"
            sequence:
              - service: water_heater.set_operation_mode
                data_template:
                  operation_mode: "{{ states('sensor.hive_water_target_state') }}"
                target:
                  entity_id: water_heater.thermostat
          - conditions: #-------------------------------------------------------
              - condition: trigger
                id: "boost start"
            sequence:
              - service: timer.start
                target:
                  entity_id: timer.hive_heating_boost
                data:
                  duration:  "{{ (states('input_number.hive_water_boost_time') |float()) *3600 }}"
          - conditions: #-------------------------------------------------------
              - condition: trigger
                id: "boost over"
            sequence:
              - service: input_select.select_option           # return mode if timer finished
                target:
                  entity_id: input_select.hive_water_mode
                data:
                  option: "On"
              - service: timer.finish                         # finish timer if mode changed
                target:
                  entity_id: timer.hive_water_boost

The sensor looked like this:

yaml
template:
  - sensor:
      - name: Hive water target state
        state: >
          {% set shed1 = states('input_boolean.hive_water_1_scheduled') %}
          {% set shed2 = states('input_boolean.hive_water_2_scheduled') %}
          {% set shed3 = states('input_boolean.hive_water_3_scheduled') %}
          {% set shed4 = states('input_boolean.hive_water_4_scheduled') %}

          {% set on1 = states('input_datetime.hive_water_1_on')[:5] %}
          {% set on2 = states('input_datetime.hive_water_2_on')[:5] %}
          {% set on3 = states('input_datetime.hive_water_3_on')[:5] %}
          {% set on4 = states('input_datetime.hive_water_4_on')[:5] %}

          {% set off1 = states('input_datetime.hive_water_1_off')[:5] %}
          {% set off2 = states('input_datetime.hive_water_2_off')[:5] %}
          {% set off3 = states('input_datetime.hive_water_3_off')[:5] %}
          {% set off4 = states('input_datetime.hive_water_4_off')[:5] %}

          {% set mode = states('input_select.hive_water_mode') %}
          {% set time = states('sensor.time') %}

          {%   if mode == 'Boost' %}                                      on
          {% elif mode == 'On'    %}
            {%   if shed1 == 'on' and (time >= on1) and (time < off1) %}  on
            {% elif shed2 == 'on' and (time >= on2) and (time < off2) %}  on
            {% elif shed3 == 'on' and (time >= on3) and (time < off3) %}  on
            {% elif shed4 == 'on' and (time >= on4) and (time < off4) %}  on
            {% else %}                                                    off
            {% endif %}
          {% else %}                                                      off
          {% endif %}

It was based on setting both off and on times but I since changed it to on and duration.
If any of this interests you, I’d be happy to share all the entities behind it etc.

Thanks John. Your automations look like they’ll be useful once I’ve got things running but I need to get the basics down first. ie. Turning the water heating on and off at all
Also, I’m using zigbee2MQTT and think that the devices and operations available to me might be a bit different to what you’re seeing.

I think I’ve made some good progress this evening. I took a look at the page Zigbee2MQTT → Hive Receiver → Exposes and I played around with the values there. What I learned was that simply changing the System Mode’ (ie. the operation_mode) isn’t enough to make the boiler turn on. I (probably) also need to set the “Temperature setpoint hold duration” to 65535 and crucially I need to set the “Temperature setpoint hold” to True.
From what I can tell, the idea is that you queue up the setting(s) that you want to make (whether its turning the water off or to heat or whatever) and then throwing the “Temperature setpoint hold” switch to True is the action that makes the system actually act on the requested changes.

So my (work in progress) automation for heating the water for 30mins looks like this:

  • Turn off Hive receiver Temperature setpoint hold water
  • Set value for Hive receiver Temperature setpoint hold duration water
    • 65535
  • Water Heater: Set operation mode
    • “heat”
  • Turn on Hive receiver Temperature setpoint hold water
  • Delay
    • 30mins
  • Turn off Hive receiver Temperature setpoint hold water
  • Set value for Hive receiver Temperature setpoint hold duration water
    • 0
  • Water Heater: Set operation mode
    • “off”
  • Turn on Hive receiver Temperature setpoint hold water
  • Turn off Hive receiver Temperature setpoint hold water

I suspect that I might be able to just set “Hive receiver Temperature setpoint hold duration water” to 30 and skip all the stuff from the Delay onwards but thats an experiment for tomorrow.

:+1:

My name isn’t John though.

People seem to mis-read my initials (jchh) as John so I do understand the mistake.