I have been wanting to get some basic stats into HomeSeer, mostly Temperature, CPU, etc. Here's an example on how to get a Temperature value into HomeSeer:
Create a Virtual Device in HS. Give the Status/Graphics a range for your value. Since this is Temperature, I'm just giving it 0-100. You can always change it later:
Save your Virtual Device and go into Node-Red.
Start with an Inject Node and set the msg.payload to a JSON name/value pair:
At the bottom, repeat it every 'X' interval you want - I'm doing every minute.
Next, wire up your exec command to get your temperature and send it to a Function.
Note the 3 dots on the exec node - make sure you wire it up to the top dot - that is for stdout, which contains the value:
The function will replace that original payload from the inject and replace it with the value:
Now, wire up your HomeSeer node and select the virtual device you created above.
Deploy your changes and that's it!
This should work for any Value you want to get into HS. I havent played around with device status, but this works great.
Create a Virtual Device in HS. Give the Status/Graphics a range for your value. Since this is Temperature, I'm just giving it 0-100. You can always change it later:
Save your Virtual Device and go into Node-Red.
Start with an Inject Node and set the msg.payload to a JSON name/value pair:
At the bottom, repeat it every 'X' interval you want - I'm doing every minute.
Next, wire up your exec command to get your temperature and send it to a Function.
Note the 3 dots on the exec node - make sure you wire it up to the top dot - that is for stdout, which contains the value:
The function will replace that original payload from the inject and replace it with the value:
Code:
//Temperature comes in as temp=999.9'C var rawTemp = msg.payload; var n = rawTemp.indexOf("'"); var wholeTemp = rawTemp.substring(5,n); //Now, put the temp into the msg payload var obj = {}; obj['value'] = wholeTemp; msg.payload = obj; return msg;
Now, wire up your HomeSeer node and select the virtual device you created above.
Deploy your changes and that's it!
This should work for any Value you want to get into HS. I havent played around with device status, but this works great.
Comment