Bitcoin to USD
Receives the current Bitcoin price in USD from Coingecko.
About this flow
| System | Node-RED |
|---|---|
| AWTRIX version | AWTRIX 3 |
| Topic | Miscellaneous |
| Built by | RobG |
| File | MzB23Oe0orLJ.json · 3.7 KB |
| Icons | 1 |
| Published | 9 May 2023 · updated 10 May 2023 |
| Downloads | 40 |
Is this your flow?
If you created this flow, open your saved edit link to add it to your account. You can then manage it whenever you sign in. Adding it to your account replaces the edit link.
Description
This nodered flow will get the bitcoin price in USD from the coingecko API and shows it on your awtrix light matrix.
Settings
- Modify the MQTT broker (Server) in MQTT Out Node: awtrix/custom/bitcoin
- Keep the inject node around 10 minutes to not trigger the API limit from coingecko.
- It is possible to change the currency from USD to another currency by editing the change node in the flow. Modify the msg.currency value. All possible currencies can be found here
Profit?!
MzB23Oe0orLJ.json
[
{
"id":"d47d5dd5564bc167",
"type":"mqtt out",
"z":"e80c6f6f5e6792b3",
"name":"",
"topic":"awtrix/custom/bitcoin",
"qos":"",
"retain":"",
"respTopic":"",
"contentType":"",
"userProps":"",
"correl":"",
"expiry":"",
"broker":"11ca2309265fca75",
"x":920,
"y":720,
"wires":[
]
},
{
"id":"d9c33d1f02954660",
"type":"function",
"z":"e80c6f6f5e6792b3",
"name":"Create Message",
"func":"var id = msg.id;\nvar currency = msg.currency;\n\nvar price = msg.payload[id][currency];\n\n//msg.payload = price;\n\nmsg.payload = { \n \"text\": String(price), \n \"icon\": 12460, \n \"duration\": 10, \n \"pushIcon\": 3 \n};\n\nnode.status({ fill: 'green', shape: 'ring', text: 'Price: ' + price});\n\nreturn msg;",
"outputs":1,
"noerr":0,
"initialize":"",
"finalize":"",
"libs":[
],
"x":700,
"y":720,
"wires":[
[
"d47d5dd5564bc167"
]
]
},
{
"id":"a7544a6b7ee9f8ed",
"type":"change",
"z":"e80c6f6f5e6792b3",
"name":"BTC to USD",
"rules":[
{
"t":"set",
"p":"id",
"pt":"msg",
"to":"bitcoin",
"tot":"str"
},
{
"t":"set",
"p":"currency",
"pt":"msg",
"to":"usd",
"tot":"str"
},
{
"t":"set",
"p":"headers",
"pt":"msg",
"to":"{\"USER-AGENT\":\"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36\"}",
"tot":"jsonata"
}
],
"action":"",
"property":"",
"from":"",
"to":"",
"reg":false,
"x":270,
"y":720,
"wires":[
[
"2cad191e8152d41c"
]
]
},
{
"id":"2cad191e8152d41c",
"type":"http request",
"z":"e80c6f6f5e6792b3",
"name":"Get CoinGecko Price",
"method":"GET",
"ret":"obj",
"paytoqs":"ignore",
"url":"https://api.coingecko.com/api/v3/simple/price?ids={{{id}}}&vs_currencies={{{currency}}}",
"tls":"",
"persist":false,
"proxy":"",
"authType":"",
"senderr":false,
"credentials":{
},
"x":480,
"y":720,
"wires":[
[
"d9c33d1f02954660"
]
]
},
{
"id":"4ee9e3555739095c",
"type":"inject",
"z":"e80c6f6f5e6792b3",
"name":"",
"props":[
],
"repeat":"600",
"crontab":"",
"once":true,
"onceDelay":"10",
"topic":"",
"x":110,
"y":720,
"wires":[
[
"a7544a6b7ee9f8ed"
]
]
},
{
"id":"11ca2309265fca75",
"type":"mqtt-broker",
"name":"",
"broker":"",
"port":"1883",
"clientid":"",
"autoConnect":true,
"usetls":false,
"protocolVersion":"4",
"keepalive":"60",
"cleansession":true,
"birthTopic":"",
"birthQos":"0",
"birthPayload":"",
"birthMsg":{
},
"closeTopic":"",
"closeQos":"0",
"closePayload":"",
"closeMsg":{
},
"willTopic":"",
"willQos":"0",
"willPayload":"",
"willMsg":{
},
"userProps":"",
"sessionExpiry":""
}
]
This flow uses the following icons. Add them to your AWTRIX along with the flow.
8×8 px
More flows for Node-RED or Miscellaneous
Something wrong with this flow? Report it.