Hi,
I am new with node red and now I love it.
I have already connected my Fronius and Volkszähler with node-red-contrib-fronius-solar and node-red-contrib-volkszaehler withe no problems.
Now I want to connect our heating from ETA Heiztechnik GmbH
I can read the amount of wood pellets via:
http://192.168.0.77:8080/user/var/40/10201/0/0/12015
With HTTP-request I get that as a one string:
<eta xmlns="http://www.eta.co.at/rest/v1" version="1.0"> <value uri="/user/var/40/10201/0/0/12015" strValue="2673" unit="kg" decPlaces="0" scaleFactor="10" advTextOffset="0">26730</value>
</eta>
With a funktion
msg.payload = msg.payload.split('strValue="')[1].substr(0,4);
msg.payload = Number(msg.payload);
return msg;
I can extract the amount of pellets = 2673
Now I have a problem:
If there is only 999 , than substr(0,4) will not work.
So how can I serach and extract the value for 4 digits and 3 digits or 2 digets?