Hi,
my wifi bbq thermometer publishes a json with all the values that I use for the Rest integration. This is what the json looks like:
{
"temp_unit": "celsius",
"pit": {
"enabled": false
},
"pit2": {
"enabled": false
},
"cpu_load": 61.671836714703,
"cpu_temp": 57.8,
"channel": {
"0": {
"temp": 29.92,
"color": "green",
"state": "ok",
"temp_min": 0,
"temp_max": 200,
"name": "Garraum",
"alert": false,
"show": true
},
"1": {
[...]
I am trying to set the template to the temp attribute for the entity state the same way I did it with the values in the json root (cpu_temp, cpu_load …) but I am not able to get the value. Tried different syntax and approaches (see below and way more) but nothing works.
sensor:
- name: "WlanThermo CPU-Temp"
device_class: temperature
unit_of_measurement: "°C"
value_template: "{{ value_json.cpu_temp | round(1) }}"
- name: "WlanThermo CPU-Last"
unit_of_measurement: "%"
value_template: "{{ value_json.cpu_load | round(0) }}"
- name: "WlanThermo Zeitstempel"
device_class: timestamp
value_template: "{{ value_json.timestamp }}"
- name: "Kanal 0"
# value_template: "{{ value_json['channel']['0']['temp'] | round(1) }}"
json_attributes_path: "$.channel[0]"
# value_template: "{{ value_json | map(attribute='temp') | first | default }}"
# device_class: temperature
# unit_of_measurement: "°C"
# value_template: "OK"
json_attributes:
- "temp"
- "color"
- "state"
- "temp_min"
- "temp_max"
- "name"
- "alert"
- "show"
How do I properly set the value_templates for the specific channels?