Instead of using the args
, just set msg.payload to the value. (and make sure to convert it into a number first).
Example flow
[{"id":"1f72d32a49767a16","type":"osc","z":"8aa85d80400c0533","name":"","path":"","metadata":false,"x":722,"y":288,"wires":[[]]},{"id":"3dad1c4660752002","type":"function","z":"8aa85d80400c0533","name":"","func":"key = Object.keys(msg.payload)[0]\ntopic = `/${key}`\npayload = msg.payload[key].usd\nreturn {topic:topic,payload:payload};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":564,"y":312,"wires":[["4c9b305142fd2c5c","1f72d32a49767a16"]]},{"id":"8f8557af3524373f","type":"http request","z":"8aa85d80400c0533","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":406,"y":312,"wires":[["3dad1c4660752002","76985b8a8558c181"]]},{"id":"e125e032da3a0e98","type":"inject","z":"8aa85d80400c0533","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":252,"y":312,"wires":[["8f8557af3524373f"]]},{"id":"4c9b305142fd2c5c","type":"debug","z":"8aa85d80400c0533","name":"osc formatted","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":752,"y":360,"wires":[]},{"id":"76985b8a8558c181","type":"debug","z":"8aa85d80400c0533","name":"request","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":564,"y":384,"wires":[]}]