Climate template support

For devices supporting the Auto Discovery feature. Like ZWaveJS2MQTT, Zigbee2MQTT.

Moderator: leecollings

Post Reply
lwolf
Posts: 216
Joined: Saturday 10 November 2018 18:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Hungary
Contact:

Climate template support

Post by lwolf »

I am trying to add a climate device to MQTT Autodiscovery, but the following two (config) templates simply does not work.

Code: Select all

"temperature_state_template": "{{ value_json.thermostats[0].target_t.value}}"
"current_temperature_template": "{{ value_json.thermostats[0].tmp.value }}"
At least i got these errors from Domoticz log:

Code: Select all

Climate device unhandled temperature_state_template
Climate device unhandled current_temperature_template
Here are an example payload for the above:

Code: Select all

{
    "thermostats": [
        {
            "pos": -1,
            "target_t": {
                "enabled": true,
                "value": 24.0,
                "units": "C"
            },
            "tmp": {
                "value": 17.4,
                "units": "C",
                "is_valid": true
            },
            "schedule": false,
            "schedule_profile": 2,
            "boost_minutes": 0
        }
    ]
}
User avatar
waltervl
Posts: 5902
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Climate template support

Post by waltervl »

There is some support in 2023.2 stable. Check also this issue https://github.com/domoticz/domoticz/issues/5676
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
lwolf
Posts: 216
Joined: Saturday 10 November 2018 18:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Hungary
Contact:

Re: Climate template support

Post by lwolf »

waltervl wrote: Wednesday 23 August 2023 11:40 There is some support in 2023.2 stable. Check also this issue https://github.com/domoticz/domoticz/issues/5676
Updated to latest Domoticz V2023.2 (build 15512)

Still the same error, but i think it is because the JSON nesting level is too much for MQTTAD to handle...

Used config template:

homeassistant/climate/thermostat1/config

Code: Select all

{"unique_id":"TRV-1","name": "TRV1-setpoint",
"~":"shellies/trv-xxx/",
"temperature_command_topic": "~thermostat/0/command/target_t",
"temperature_state_template": "{{ value_json.thermostats[0].target_t.value }}",
"temperature_state_topic": "~info",
"temperature_unit": "C",
"precision": 0.1,
"temp_step": 0.5,
"max_temp": 31,
"min_temp": 4
}
Test data:

shellies/trv-xxx/info

Code: Select all

{
    "thermostats": [
        {
            "pos": -1,
            "target_t": {
                "enabled": true,
                "value": 24.0,
                "units": "C"
            },
            "tmp": {
                "value": 17.4,
                "units": "C",
                "is_valid": true
            },
            "schedule": false,
            "schedule_profile": 2,
            "boost_minutes": 0
        }
    ]
}
2023-08-23 18:39:57.714 [7f39adffb640] Error: mqttad: Climate device unhandled temperature_state_template (TRV-1)

I tried to replace value_json.thermostats[0].target_t.value with a simpler value and it works.. should i raise a new issue at Domoticz github?
User avatar
waltervl
Posts: 5902
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Climate template support

Post by waltervl »

Or perhaps add your findings in the current issue. It is not closed yet ;)
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
lwolf
Posts: 216
Joined: Saturday 10 November 2018 18:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Hungary
Contact:

Re: Climate template support

Post by lwolf »

waltervl wrote: Thursday 24 August 2023 0:19 Or perhaps add your findings in the current issue. It is not closed yet ;)
Okay i found a climate related issue on github, however the problem and the template is different i've added the above.
lwolf
Posts: 216
Joined: Saturday 10 November 2018 18:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Hungary
Contact:

Re: Climate template support

Post by lwolf »

Thanx, gizmocuz added support for array in templates in beta 15515, and now, the above example works!
User avatar
waltervl
Posts: 5902
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Climate template support

Post by waltervl »

Great!
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest