Possible to monitor PC hardware in Vera?

can i get a debug after the http request to vera, full msg

there should be a msg.req.

I’ve added a second Debug node and selected it, but nothing else is shown in the debug window:

The other idea was could we use the MIOS out node to feed the virtual devices variable value maybe.

image

I’ve gotta pop out and do a favour for my old man.

Maybe catch you later.

Are you using InfluxDB and Grafana btw ?

That is not the full msg. In the debug node select the drop down and select full msg.

Try site sensor plugin it will monitor the rest api and can prase out the percent var, you can then access the value in reactor, possibly pleg(but i do not use.)

edit / Influx/Grafana
I am not a graph user, but i have looked at the use of it in node-red.

I set them to Comlete Msg Object

I now see this:

18/09/2020, 14:29:41node: Debug
msg : Object
object
_msgid: "1d8019a0.b6ff06"
payload: "{"percent": 46.4}"
topic: ""
statusCode: 200
headers: object
date: "Fri, 18 Sep 2020 13:29:43 GMT"
server: "WSGIServer/0.2 CPython/3.8.5"
access-control-allow-origin: "*"
access-control-allow-methods: "GET, POST, PUT, OPTIONS"
access-control-allow-headers: "Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token"
content-type: "application/json; charset=utf-8"
content-encoding: "identity"
content-length: "17"
x-node-red-request-node: "c4a4d750"
responseUrl: "http://192.168.0.2:61208/api/3/mem/percent"
redirectList: array[0]

I think the previous http requests headers is overriding the following.
try this in the function.

var hold = msg;
msg = {};
msg.payload = {"id":  "variableset",
 "DeviceNum": "100",
"serviceId": "urn:micasaverde-com:serviceId:GenericSensor1",
"Variable": "CurrentLevel",
"Value": hold.payload.percent}
return msg;

Hi

I’m back, tried the new code but I am getting a socket hang up for some reason.

object
_msgid: "c1b6fcff.b97f3"
payload: "{"percent": 46.9}"
topic: ""
statusCode: 200
headers: object
date: "Fri, 18 Sep 2020 16:55:43 GMT"
server: "WSGIServer/0.2 CPython/3.8.5"
access-control-allow-origin: "*"
access-control-allow-methods: "GET, POST, PUT, OPTIONS"
access-control-allow-headers: "Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token"
content-type: "application/json; charset=utf-8"
content-encoding: "identity"
content-length: "17"
x-node-red-request-node: "2858e6d6"
responseUrl: "http://192.168.0.2:61208/api/3/mem/percent"
redirectList: array[0]
18/09/2020, 17:55:42node: HTTP Request to Virtual Device
msg : error
"Error: socket hang up"
18/09/2020, 17:55:42node: Debug
msg : Object
object
payload: "Error: socket hang up : http://192.168.0.248:3480/data_request"
_msgid: "c1b6fcff.b97f3"
statusCode: "ECONNRESET"

Try just deleting the msg.headers

msg.headers = {};
msg.payload = {"id":  "variableset",
 "DeviceNum": "100",
"serviceId": "urn:micasaverde-com:serviceId:GenericSensor1",
"Variable": "CurrentLevel",
"Value": msg.payload.percent}
return msg;

Seems to be the same

No the response url has changed.(edit bad eyes it has not changed)
Just as a test try it in this test flow. edit to correct ip etc then press the inject button

[{"id":"3bf648d6.a72d98","type":"debug","z":"1838876b.1af279","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":670,"y":140,"wires":[]},{"id":"238d48a0.09ac6","type":"http request","z":"1838876b.1af279","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"http://192.168.1.11:3480/data_request","tls":"","persist":false,"proxy":"","authType":"","x":490,"y":140,"wires":[["3bf648d6.a72d98"]]},{"id":"472834f8.9aa77c","type":"function","z":"1838876b.1af279","name":"","func":"msg.headers = {};\nmsg.payload = {\"id\":  \"variableset\",\n \"DeviceNum\": \"100\",\n\"serviceId\": \"urn:micasaverde-com:serviceId:GenericSensor1\",\n\"Variable\": \"CurrentLevel\",\n\"Value\": msg.payload.percent}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":310,"y":140,"wires":[["238d48a0.09ac6"]]},{"id":"498b0b24.026864","type":"inject","z":"1838876b.1af279","name":"","props":[{"p":"payload,percent","v":"25","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":120,"y":140,"wires":[["472834f8.9aa77c"]]}]

Also try restarting node-red

18/09/2020, 18:42:58node: 76bd0966.0cf6d8
function : (error)
"TypeError: Cannot read property 'percent' of undefined"

It doesn’t like the missing payload.

I’m rebooting the Pi now

Typo in inject node has a comma not a period
msg.payload,percent should be msg.payload.percent

edit/
you can just stop node-red and then restart. on my device in console window press control c and then type node-red.

I’ve fixed the comma in the inject node.

Now getting this

18/09/2020, 18:47:08node: 4dbe31e6.1c05a
msg : error
"Error: socket hang up"
18/09/2020, 18:47:08node: 89c2835f.bef55
msg : Object
object
_msgid: "f03d076b.429f08"
payload: "Error: socket hang up : http://192.168.0.248:3480/data_request"
topic: ""
headers: object
empty
statusCode: "ECONNRESET"

Rebooting the Vera Edge now.

EDIT:

18/09/2020, 18:48:42node: Vera-Edge
msg : string[23]
"mios.error.invalid-json"
18/09/2020, 18:48:43node: Vera-Edge
msg : error
"Error: socket hang up"

Try with your original request that worked in browser, in the test flow function.

//msg.headers = {};
msg.payload = {"id":  "lu_variableset",
 "DeviceNum": "100",
"serviceId": "urn:micasaverde-com:serviceId:GenericSensor1",
"Variable": "CurrentLevel",
"Value": msg.payload.percent}
return msg;

This ?

http://192.168.0.248/port_3480/data_request?id=lu_variableset&DeviceNum=100&serviceId=urn:micasaverde-com:serviceId:GenericSensor1&Variable=CurrentLevel&Value=7.0

That works in the browser and changes the devices CurrentLevel.

yes my last response has the edit id property set to “lu_variableset”.

See screen shot above that is the debug for that change.

My bad try http node like this using GET

[{"id":"238d48a0.09ac6","type":"http request","z":"1838876b.1af279","name":"","method":"GET","ret":"txt","paytoqs":"query","url":"http://192.168.1.11:3480/data_request","tls":"","persist":false,"proxy":"","authType":"","x":490,"y":140,"wires":[["3bf648d6.a72d98"]]}]

or like this

[{"id":"238d48a0.09ac6","type":"http request","z":"1838876b.1af279","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://VERA-IP/port_3480/data_request?id=lu_variableset&DeviceNum=100&serviceId=urn:micasaverde-com:serviceId:GenericSensor1&Variable=CurrentLevel&Value={{{payload.percent}}}","tls":"","persist":false,"proxy":"","authType":"","x":490,"y":140,"wires":[["3bf648d6.a72d98"]]}]

That works its set the virtual device in Vera to CurrentLevel = 25

ok then copy that http node to the original flows second http request