Problem with curl and HASS.IO (solved)

In HA this used to work:

'curl "http://192.168.1.30:11000/Status" 2>&1 | grep -oPm1 "(?<=<title2>)[^<]+"'

But now I’ve moved my configuration over to HASS.IO I get the following error:

ERROR (SyncWorker_5) [homeassistant.components.sensor.command_line] Command failed: curl "http://192.168.1.30:11000/Status" 2>&1 | grep -oPm1 "(?<=<title2>)[^<]+"

Can anybody help me work out what’s wrong with my code please?

In resinos one of the grep options is not supported.
I found a workaround.

curl "http://xxx.xxx.x.xxx/real_time_data.xml" 2>&1 | grep -E -m1 -o "<v-grid>(.*)</v-grid>" | sed -e "s,.*<v-grid>\([^<]*\)</v-grid>.*,\1,g"

This gets the v-grid value from the XML.

2 Likes

Thank you so much, that worked perfectly. You are a genius!

1 Like