Koenkk / zigbee-herdsman-converters

Collection of device converters to be used with zigbee-herdsman
MIT License
921 stars 3.04k forks source link

Hive SLR2 Climate device unhandled current_temperature_template #3971

Closed russdan closed 2 years ago

russdan commented 2 years ago

Hi, I'm trying to resolve a few errors in the Hive SLR2 device, and currently see the following error in Domoticz using the MQTT native hardware:

Climate device unhandled current_temperature_template (0x001e5e000000cd00_climate_water_zigbee2mqtt)

Using MQTT explorer I can see

{
  "action_template": "{% set values = {None:None,'idle':'off','heat':'heating','cool':'cooling','fan_only':'fan'} %}{{ values[value_json.running_state_water] }}",
  "action_topic": "zigbee2mqtt/Hive Controller",
  "availability": [
    {
      "topic": "zigbee2mqtt/bridge/state"
    }
  ],
  "current_temperature_template": "{{ value_json.local_temperature_water }}",
  "current_temperature_topic": "zigbee2mqtt/Hive Controller",
  "device": {
    "identifiers": [
      "zigbee2mqtt_0x001e5e000000cd00"
    ],
    "manufacturer": "Hive",
    "model": "Dual channel heating and hot water thermostat (SLR2)",
    "name": "Hive Controller"
  },
  "json_attributes_topic": "zigbee2mqtt/Hive Controller",
  "max_temp": "22",
  "min_temp": "22",
  "mode_command_topic": "zigbee2mqtt/Hive Controller/water/set/system_mode",
  "mode_state_template": "{{ value_json.system_mode_water }}",
  "mode_state_topic": "zigbee2mqtt/Hive Controller",
  "modes": [
    "off",
    "auto",
    "heat",
    "emergency_heating"
  ],
  "name": "Hive Controller water",
  "temp_step": 1,
  "temperature_command_topic": "zigbee2mqtt/Hive Controller/water/set/occupied_heating_setpoint",
  "temperature_state_template": "{{ value_json.occupied_heating_setpoint_water }}",
  "temperature_state_topic": "zigbee2mqtt/Hive Controller",
  "temperature_unit": "C",
  "unique_id": "0x001e5e000000cd00_climate_water_zigbee2mqtt"
}

and so if I understand correctly its trying to populate current_temperature_template with value_json.local_temperature_water however in the message there is no local_temperature_water (there is a local_temperature_heat for the heat endpoint but no water endpoint of the same). Example message:

info  2022-02-08 05:35:10: MQTT publish: topic 'zigbee2mqtt/Hive Controller', payload '{"linkquality":18,"local_temperature_heat":18.23,"occupied_heating_setpoint_heat":18,"occupied_heating_setpoint_water":22,"running_state_heat":"idle","running_state_water":"idle","system_mode":"emergency_heating","system_mode_heat":"heat","system_mode_water":"off","temperature_setpoint_hold_duration_heat":65535,"temperature_setpoint_hold_duration_water":0,"temperature_setpoint_hold_heat":true,"temperature_setpoint_hold_water":false,"weekly_schedule_water":{"days":["saturday"],"transitions":[{"heating_setpoint":99,"time":300},{"heating_setpoint":0,"time":345},{"heating_setpoint":99,"time":450},{"heating_setpoint":0,"time":480},{"heating_setpoint":0,"time":960},{"heating_setpoint":0,"time":1290}]}}'

I've tried removing the .withLocalTemperature() from line 293 exposes.climate().withSetpoint('occupied_heating_setpoint', 22, 22, 1) of devices\hive.js but this just generates other errors in zigbee2mqtt so I'm not sure where to go next? What I think I need to do is remove current_temperature_template from the climate_water message definition as the hotwater side doesn't know the temperature so it isn't valid, but can't see where this is defined. Thanks!

russdan commented 2 years ago

So I removed the withSetpoint('occupied_heating_setpoint', 22, 22, 1).withLocalTemperature() from line 293 of hive.js, as neither are valid for water (the setpoint cannot be changed / is artificially fixed at 22C and as above there is no LocalTemperature) and two results:

  1. The error Climate device unhandled current_temperature_template (0x001e5e000000cd00_climate_water_zigbee2mqtt) still persisted in Domoticz;
  2. Zigbee2MQTT showed error Failed to call 'HomeAssistant' 'start' (AssertionError [ERR_ASSERTION]: No setpoint found at HomeAssistant.exposeToConfig (/opt/zigbee2mqtt/lib/extension/homeassistant.ts:204:19)... I assume as it was expecting a setpoint and now wasn't getting one...

In the definition of the device

        model: 'SLR2',
        vendor: 'Hive',
        description: 'Dual channel heating and hot water thermostat',
        fromZigbee: [fz.thermostat, fz.thermostat_weekly_schedule],
        toZigbee: [tz.thermostat_local_temperature, tz.thermostat_system_mode, tz.thermostat_running_state,
            tz.thermostat_occupied_heating_setpoint, tz.thermostat_control_sequence_of_operation, tz.thermostat_weekly_schedule,
            tz.thermostat_clear_weekly_schedule, tz.thermostat_temperature_setpoint_hold, tz.thermostat_temperature_setpoint_hold_duration],
        endpoint: (device) => {
            return {'heat': 5, 'water': 6};
        },

is there a way to define different toZigbee parameters for heat (device 5) and water (device 6)? The ones at present are good for heat but tz.thermostat_local_temperature should be dropped for water....

Whether this fixes the unhandled current_temperature_template error of course is another question!

russdan commented 2 years ago

OK coming at this from another angle, through the Web UI I added a Reporting attribute of localTemp for endpoint 6 and now I get "local_temperature_water":21 in the MQTT message which stops the error in Domoticz... I assume therefore we need a await reporting.thermostatTemperature(waterEndpoint); to replicate that via the device adapter....

russdan commented 2 years ago

PR #3978 raised with the above fix