Node Red Number from payload

Sorry to trouble you, with what I imagine is a very simple question. I am trying to use switch to make a decision on a number. I think I need to moce the number to a seperate msg, but don’t know how. I have study1: object Number. Any help would be appreciated.
Thanks
Mark

[{"id":"53d32f50.2e197","type":"tab","label":"HVAC","disabled":false,"info":""},{"id":"c302d0fd.8fa23","type":"inject","z":"53d32f50.2e197","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":300,"wires":[["49e63bb5.d91264"]]},{"id":"49e63bb5.d91264","type":"api-current-state","z":"53d32f50.2e197","name":"","server":"b2974c85.b2003","version":2,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"climate.study","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entity"},{"property":"state","propertyType":"global","value":"","valueType":"entityState"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":320,"y":300,"wires":[["407247c0.dfe6f8"]]},{"id":"407247c0.dfe6f8","type":"function","z":"53d32f50.2e197","name":"study heat required ","func":"msg.study1 = {Number: ((msg.payload.attributes.target_temp_low - msg.payload.attributes.current_temperature) / msg.payload.attributes.current_temperature ) * 100};\nreturn [msg];","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":570,"y":300,"wires":[["41c01cf0.d93b84"]]},{"id":"d7eefbf2.1e4ab8","type":"debug","z":"53d32f50.2e197","name":"Less Than 10","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"study1","targetType":"msg","statusVal":"","statusType":"auto","x":1060,"y":220,"wires":[]},{"id":"41107ed1.0cb53","type":"debug","z":"53d32f50.2e197","name":"10 to 20","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1040,"y":260,"wires":[]},{"id":"41c01cf0.d93b84","type":"switch","z":"53d32f50.2e197","name":"","property":"study1","propertyType":"msg","rules":[{"t":"btwn","v":"0","vt":"num","v2":"10","v2t":"num"},{"t":"btwn","v":"10","vt":"num","v2":"20","v2t":"num"},{"t":"btwn","v":"20","vt":"num","v2":"30","v2t":"num"},{"t":"btwn","v":"30","vt":"num","v2":"100","v2t":"num"},{"t":"eq","v":"study1","vt":"msg"}],"checkall":"true","repair":false,"outputs":5,"x":750,"y":300,"wires":[["d7eefbf2.1e4ab8"],["41107ed1.0cb53"],["f76038bf.4550e8"],["b67de3db.5eb8b"],["8b178011.8527c"]]},{"id":"f76038bf.4550e8","type":"debug","z":"53d32f50.2e197","name":"20 to 30","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1040,"y":300,"wires":[]},{"id":"8b178011.8527c","type":"debug","z":"53d32f50.2e197","name":"Message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1040,"y":400,"wires":[]},{"id":"b67de3db.5eb8b","type":"debug","z":"53d32f50.2e197","name":"30 to 100","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1040,"y":340,"wires":[]},{"id":"b2974c85.b2003","type":"server","name":"Home Assistant","version":1,"legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

Have you tried this?

@mbonani Thank you so much. That works. So simple. Have a great day.

1 Like