[{"hours":16,"minutes":4,"day":10,"month":12,"year":2023,"temp_in":20.56,"temp_out":19.50,"hum_in":34.00,"hum_out":34.00,"abs_hum_in":6.07,"abs_hum_out":5.71,"on":0,"operating_hours":0,"message":air not dry enough}]
Firefox means it’s not a valid JSON string:
SyntaxError: JSON.parse: unexpected character at line 1 column 199 of the JSON data
I see 2 things: the square brackets at the beginning/end and the spaces in the last value (message).
However I cannot get it running.
Either no sensor is getting created when adding it to the yaml or the state stays at “unknown”.
I understand your explanation why the JSON is invalid, however I cannot change the device’s output so I just hoped I can use the other values at least. I was able to successfully add other device’s APIs with the same lines, however it does not work for this device
Hi!
Thanks for that hint to regex, however the file editor check says: unknown escape sequence.
I am now considering to build a regex that just extracts me the values from the first colon to the next comma for hours, from the second colon to the next comma for minutes and so on, so I should be able to get these values.
Wish me luck
What “file editor check” are you referring to? If possible,
post a screenshot of it.
You can see from the screenshot I posted above, from the Template Editor, that there are no complaints and regex_findall is successfully able to use the supplied regex pattern to get the value of temp_out.