Received text string data

Can we extract data from space delimited "name value" pairs in a connected device's received text string and then use that data in a variable?

Yeah, you can do this sort of thing with Rule Machine. If the "received text" is an attribute of the connected device, its value can be fetched into a string variable. Then you can extract elements with the Token operation on the string.

Thanks Bravenel!

The text string is found and updated/updateable in the Haas TI ZigBee Switch device. It is being sent to the device from an arduino via serial connection which is then relayed to HE.

Using Rule machine, I can find part of what was sent in the device’s attributes but I do not see the entire string. There are 9 pairs being sent (temp1 xx.xx temp2 xx.xx temp3 xx.xx …).

I am also unclear on how to indicate to Rule Machine which pair to use to capture the temp value for use in setting a variable’s value ... edit, I think I can set the "which Pair" by setting "Delimiter" or "Index" but cannot seem to find "String to get token from"

I've only attempted something like this once, but it looks like this. My string is just numbers and commas.

weatherTempLowForecast is an attribute (string csv) from my Ecobee thermostat.

First step was to create a string variable (forecast) and then set the value of the variable equal to the device attribute (first action in the rule).

Then each separate value was stored as its own string and finally stored as decimal-type variable.

1 Like

How were you able to do this? When I create a local variable I can only enter a facsimile of the string not a link to the actual string I need

You can't really "link" your local variable to the device attribute. You have to use a rule action to read the attribute and then write that value into the variable. The first action in my rule uses the "set variable" command. I can post a screenshot of creating that action later, if needed.