Hi there, I have the following output from my esp8266 sensor with DHT11:
Humidity: 55.00%\n
Temperature: 19.00°C
This is my current config in configuration.yaml, but it seems that I can not access the digits by index?
mqtt:
sensor:
- name: "Temperatur"
unique_id: sensor_esp8266_c
state_topic: "sensor/esp8266"
value_template: '{{ value|regex_findall("\d{2}")[2] }}'
unit_of_measurement: "°C"
availability_topic: "sensor/esp8266/LWT"
- name: "Luftfeuchtigkeit"
unique_id: sensor_esp8266_p
state_topic: "sensor/esp8266"
value_template: '{{ value|regex_findall("\d{2}")[0] }}'
unit_of_measurement: "%"
availability_topic: "sensor/esp8266/LWT"
Maybe someone can help my. I also tried different other methods, but with no effect. Thx
Edit: (also tried this)
mqtt:
sensor:
- name: "Temperatur"
unique_id: sensor_esp8266_c
state_topic: "sensor/esp8266"
value_template: '{{ value|regex_findall_index("(\d+\.?\d+)", index=1) }}'
unit_of_measurement: "°C"
availability_topic: "sensor/esp8266/LWT"
- name: "Luftfeuchtigkeit"
unique_id: sensor_esp8266_p
state_topic: "sensor/esp8266"
value_template: '{{ value|regex_findall_index("\\d{2}", index=1) }}'
unit_of_measurement: "%"
availability_topic: "sensor/esp8266/LWT"