You da man Tom. Thanks a lot. I was getting close filtering it out thru the original json call but couldn’t get rid of the OK at the front so this works without bothering.
Error loading /config/configuration.yaml: while parsing a flow mapping
in "/config/entities/sensor/sensor_rest.yaml", line 144, column 20
expected ',' or '}', but got '['
in "/config/entities/sensor/sensor_rest.yaml", line 144, column 38
So as it worked in the template screen wondering if it’s the slashes need to be escaped or something.
EDIT: put an extra slash in front of each slash and it passed. See if it works after reboot.
I found there are a couple other scenarios that basically make the sensor not created apparently if the value_template doesn’t match. So apparently if the server hasn’t been up for at least a day it’s flagged as CRITICAL and if it’s a day but not sure yet how far out, it’s labeled as WARNING so:
Not sure if this is possible, but the above will fail if it’s less than a day but also if the reported status is different. I can see three different value_template regex calls I would need to accommodate.
So run this if it’s OK: regex_findall_index(‘OK: uptime: (\d*.\s\d*.)’)
Run this if it’s WARNING: regex_findall_index(‘WARNING: uptime: (\d*.\s\S*)’)
Run this if it’s Critical: CRITICAL: uptime: (\d*\S.*)
Is that even possible?
Note I came up with this regex that seems to do it, but can’t get it into the value_template without it erroring:
Invalid config for [sensor.rest]: invalid template (TemplateSyntaxError: unexpected char '?' at 54) for dictionary value @ data['value_template']. Got '{{ value_json.lines[0].message | regex_findall_index((?:.*?:)(.*)) }}'. (See ?, line ?).
In the original output there is also a comma and then a bunch of garbage after that. Tried to terminate at the comma but kept getting it included so took a shot at the h but that may not be a static value.