Hi all, i have an image detector that sends me a string via MQTT.
The MQTT message is: ‘person (98.99%) | person (96.92%) |’
I then have the following code tested in the “developer tools template” page:
{% set value = 'person (98.99%) | person (96.92%) |' %}
Filtered value is: {{ value|regex_findall_index('\((.*?)\%') }}
Result is:
Filtered value is: 98.99
Now i go then and create a MQTT sensor:
# Front yard camera
- platform: mqtt
name: "image detector front yard confidence"
state_topic: "BlueIris/motion_frontyard"
value_template: {{ value | regex_findall_index('\((.*?)\%') }}
Then i get the following message from the “check configuration option”
in "/config/sensors/others.yaml", line 12, column 20
expected ',' or '}', but got '?'
in "/config/sensors/others.yaml", line 12, column 56
line 12 corresponds to the value_template line. I do have other MQTT sensors on the same file working well.
Can anyone help to understand why this works on the test developer page, but not in this sensor? what am i doing wrong?