Node-RED nodes for hubitat

Ok I have copied the fields to the change node, but it says "Invalid properties -Rules"
image

You have msg.msg.command, etc.

Really everything about that command node is wrong.

1 Like

Even with it like this it says invalid properties.
image

I know it shows how serious my NOOBness is, and I do apologize

When I start to type , lets say "P" the available selections with the letter p in the field comes up i.e"PAYLOAD"
and when I type "c" for command or "a" for argument there is no such field, which makes me wonder if there is something missing on my setup, maybe additional pallets?

you're misinterpreting the fields....

Set [what you want to set, it's name]
TO [where's the value you want changed?]

Here's a multi-change node I have that may help....

This one node shows three different changes occurring... (There's a + at the bottom left to add more Rows.) You'll need two Set rows.

Screen Shot 2022-02-09 at 7.17.20 AM

1 Like

Set that Change node between an inject and a Debug node:

Click on the "pad" on the left end of the Inject node and you'll see the Debug output.

(alter the Debug node to show the entire msg:)

Screen Shot 2022-02-09 at 7.23.36 AM

This is the output from the debug:
09/02/2022, 17:29:21node: 805ab320afea930dmsg.payload : number

1644420560490

Import this:

Import Code

[{"id":"6d193a54.a97a94","type":"change","z":"ec93d979d8826270","name":"SOC_Change_Node","rules":[{"t":"set","p":"command","pt":"msg","to":"Set Temperature","tot":"str"},{"t":"set","p":"arguments","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":80,"wires":[["bdc2c0a8.b2596"]]},{"id":"b22230fa.20802","type":"inject","z":"ec93d979d8826270","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":"2.7","topic":"","payload":"true","payloadType":"bool","x":210,"y":80,"wires":[["6d193a54.a97a94"]]},{"id":"bdc2c0a8.b2596","type":"debug","z":"ec93d979d8826270","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":590,"y":80,"wires":[]}]

Click the Hamburger Menu in the upper right, click Import. Copy paste the code above and click Import. The entire set of three nodes should now be floating above your workspace. Click to paste it down somewhere and take a look at the differences.

1 Like

Ok the debug messages are as follows:
09/02/2022, 17:42:59node: 805ab320afea930dbattery_soc : msg.payload : number

0x62

09/02/2022, 17:43:00node: 805ab320afea930dbattery_soc : msg.payload : number

98

09/02/2022, 17:43:00node: 805ab320afea930dmsg.payload : boolean

true

09/02/2022, 17:43:02node: 805ab320afea930dbattery_soc : msg.payload : number

0x62

09/02/2022, 17:43:03node: 805ab320afea930dbattery_soc : msg.payload : number

0x62

09/02/2022, 17:43:05node: 805ab320afea930dbattery_soc : msg.payload : number

98

09/02/2022, 17:43:06node: 805ab320afea930dbattery_soc : msg.payload : number

0x62

09/02/2022, 17:43:08node: 805ab320afea930dbattery_soc : msg.payload : number

98

09/02/2022, 17:43:09node: 805ab320afea930dbattery_soc : msg.payload : number

98

09/02/2022, 17:43:11node: 805ab320afea930dbattery_soc : msg.payload : number

97

IT WORKS!!!
THANK YOU SO MUCH.
WOW, I would never have got this on my own, man you guys are smart, thank you for your help!
image

4 Likes

Glad you got it sorted! I should have posted more than what I did, but I was away from the keyboard.

I see you were in good hands though!

Yes you guys are great, thank you for your willingness to share your knowledge, with idiots like me...:wink:

1 Like

Hi everyone, a new version has been 1.8.0 released :kissing_heart:

  • Reduce default log verbosity to avoid to fill log file

  • mode: set name dynamically according the label. It will be updated when the node will be saved.
    mode-setter-update-name

  • config: improve documentation when using authentication

10 Likes

How can i acheive 2 different msg.payloads in the 1 switch node?

I would like to have msg.payload[0].userid & payload[0].confidence in 1 switch node, so ideally the 3rd output would be userid, 1st 2 are confidence

image

If not possible, any suggestion how i can achieve what im after??
Cheers

You could try this node:

2 Likes

Couple of ways to do this -

  1. You could do it with 2 switch nodes (filter for userid="unknown" in first and then for confidence <=0.87 or => 0.88)
  2. You could do it in a function node if you are comfortable with javascript

UPDATE: @bdydrp Here is a flow that uses a function node that sends the payload to different outputs based on the criteria you specified:

[{"id":"83175fd7.2de19","type":"function","z":"2140a9d4.13a7fe","name":"","func":"const userid = msg.payload[0].userid\nconst confidence = msg.payload[0].confidence\n\nlet msg1 = {}\nlet msg2 = {}\nlet msg3 = {}\n\nif (userid == 'unknown') {\n    msg3= msg.payload;\n    return [null,null,msg3]\n} \nelse {\nif (confidence >= 0.88) {\n        msg1 = msg.payload;\n        return [msg1,null,null];\n    } else {\n        msg2= msg.payload;\n        return [null,msg2,null]\n    }\n}\n\nreturn [msg1, msg2, msg3];","outputs":3,"noerr":0,"initialize":"","finalize":"","libs":[],"x":449.3333435058594,"y":783.0000381469727,"wires":[["20dfb9fe.fb5c36"],["9d15e93a.4ed46"],["374a8772.812a2"]]},{"id":"20dfb9fe.fb5c36","type":"debug","z":"2140a9d4.13a7fe","name":"debug1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":652.3333435058594,"y":716.0000839233398,"wires":[]},{"id":"505fda95.994b7c","type":"inject","z":"2140a9d4.13a7fe","name":"Inject3","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"userid\":\"unknown\",\"confidence\":0.9}]","payloadType":"json","x":230.33334350585938,"y":854.0000839233398,"wires":[["83175fd7.2de19"]]},{"id":"9d15e93a.4ed46","type":"debug","z":"2140a9d4.13a7fe","name":"debug2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":651.6665954589844,"y":782.6667098999023,"wires":[]},{"id":"374a8772.812a2","type":"debug","z":"2140a9d4.13a7fe","name":"debug3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":652.6665954589844,"y":843.6667098999023,"wires":[]},{"id":"8c16148b.03b2a","type":"inject","z":"2140a9d4.13a7fe","name":"Inject1","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"userid\":\"known\",\"confidence\":0.9}]","payloadType":"json","x":227.66665649414062,"y":731.6667098999023,"wires":[["83175fd7.2de19"]]},{"id":"fe01ff89.7f48b","type":"inject","z":"2140a9d4.13a7fe","name":"Inject2","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"userid\":\"known\",\"confidence\":0.86}]","payloadType":"json","x":227.66665649414062,"y":782.6667098999023,"wires":[["83175fd7.2de19"]]}]
2 Likes

You could also use JSONATA to test individual items..

4 Likes

I have some of those nodes already and cant believe i didnt think to try that!

Thanks. Never used function nodes, so wouldt have a clue where to begin to use one.. Appreciate the code.

Thanks
Again, not used much JSONATA so bit lost with how to use it... This gives me a good start

Thanks to you all.....

2 Likes

What is this doing? I imported the flow, but I am not sure I understand what it is for?