I used node-red-dashboard v.3.6.5
i wanted to make a voice alert via alexa, when the price of a cryptocurrency reaches a certain value.
i wrote this flow, but it only works with the first cryptomonrency (tao) in the list i think it's due to the type of global variable. that i inserted in the second cryptomonrency (btc) can someone help me?
[
{
"id": "e9de822530ca3411",
"type": "ui_text_input",
"z": "9583b8de.96bc48",
"name": "",
"label": "TAO",
"tooltip": "",
"group": "2fdfab82bfaf51d2",
"order": 3,
"width": "0",
"height": "0",
"passthru": true,
"mode": "number",
"delay": 300,
"topic": "topic",
"sendOnBlur": true,
"className": "",
"topicType": "msg",
"x": 90,
"y": 40,
"wires": [
[
"a7b9dd13de88bc27"
]
]
},
{
"id": "bed1b5b891d99371",
"type": "switch",
"z": "9583b8de.96bc48",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "taoprice",
"vt": "global"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 630,
"y": 280,
"wires": [
[
"55d70149b08a6964"
]
]
},
{
"id": "3cb559bec57f027c",
"type": "inject",
"z": "9583b8de.96bc48",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "5",
"crontab": "",
"once": false,
"onceDelay": "1",
"topic": "",
"payload": "taoprice",
"payloadType": "global",
"x": 120,
"y": 280,
"wires": [
[
"94e7c7b0f6507882"
]
]
},
{
"id": "b193cb95d8755df8",
"type": "http request",
"z": "9583b8de.96bc48",
"name": "TAO",
"method": "GET",
"ret": "obj",
"paytoqs": "ignore",
"url": "https://api.bybit.com/v5/market/kline?category=linear&symbol=TAOUSDT&interval=1",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 1090,
"y": 280,
"wires": [
[
"9f1e3d016105896b"
]
]
},
{
"id": "9f1e3d016105896b",
"type": "function",
"z": "9583b8de.96bc48",
"name": "json to TAO in USDT",
"func": "var tao = msg.payload.result.list[0][1]\n\n\n\n\nvar a = \" Allarme il prezzo di tao è <break time='0.1s'/>\";\nvar b = \" dollari <break time='0.25s'/>\";\n\n//whisper message\nvar k, l;\nif (msg.payload.Quiet == \"On\") {\n k = ' <amazon:effect name=\"whispered\">'\n l = ' </amazon:effect>'\n}\nelse {\n k = \"\"\n l = \"\"\n}\n\nvar message = k + a + tao + b + l;\nmsg.payload = message;\n\n\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1260,
"y": 280,
"wires": [
[
"4079b4b48cf2b12c"
]
]
},
{
"id": "4079b4b48cf2b12c",
"type": "alexa-remote-routine",
"z": "9583b8de.96bc48",
"name": "",
"account": "e0d0608560b4720d",
"routineNode": {
"type": "speakAtVolume",
"payload": {
"type": "regular",
"text": {
"type": "msg",
"value": "payload"
},
"volume": {
"type": "num",
"value": "25"
},
"mode": "set",
"devices": [
"G0922H8523240SMD",
"G090XG01456518WL"
]
}
},
"x": 1510,
"y": 280,
"wires": [
[]
]
},
{
"id": "042c064ce59ad6a4",
"type": "delay",
"z": "9583b8de.96bc48",
"name": "",
"pauseType": "delay",
"timeout": "100",
"timeoutUnits": "milliseconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 950,
"y": 280,
"wires": [
[
"b193cb95d8755df8"
]
]
},
{
"id": "a7b9dd13de88bc27",
"type": "change",
"z": "9583b8de.96bc48",
"name": "taoprice",
"rules": [
{
"t": "move",
"p": "payload",
"pt": "msg",
"to": "taoprice",
"tot": "global"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 220,
"y": 40,
"wires": [
[]
]
},
{
"id": "183dceab7f9aa564",
"type": "function",
"z": "9583b8de.96bc48",
"name": "json to TAO in USDT",
"func": "var tao = msg.payload.result.list[0][1];\nmsg.payload = tao;\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 460,
"y": 280,
"wires": [
[
"bed1b5b891d99371"
]
]
},
{
"id": "94e7c7b0f6507882",
"type": "http request",
"z": "9583b8de.96bc48",
"name": "TAO",
"method": "GET",
"ret": "obj",
"paytoqs": "ignore",
"url": "https://api.bybit.com/v5/market/kline?category=linear&symbol=TAOUSDT&interval=1",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 270,
"y": 280,
"wires": [
[
"183dceab7f9aa564"
]
]
},
{
"id": "55d70149b08a6964",
"type": "time-range-switch",
"z": "9583b8de.96bc48",
"name": "",
"lat": "",
"lon": "",
"startTime": "23:59",
"endTime": "6:00",
"startOffset": 0,
"endOffset": 0,
"x": 770,
"y": 280,
"wires": [
[],
[
"042c064ce59ad6a4"
]
]
},
{
"id": "23d6b7978eba489b",
"type": "ui_text_input",
"z": "9583b8de.96bc48",
"name": "",
"label": "BTC",
"tooltip": "",
"group": "2fdfab82bfaf51d2",
"order": 3,
"width": "0",
"height": "0",
"passthru": true,
"mode": "number",
"delay": 300,
"topic": "topic",
"sendOnBlur": true,
"className": "",
"topicType": "msg",
"x": 90,
"y": 100,
"wires": [
[
"5649a6db5ddfdae1"
]
]
},
{
"id": "5649a6db5ddfdae1",
"type": "change",
"z": "9583b8de.96bc48",
"name": "btcprice",
"rules": [
{
"t": "move",
"p": "payload",
"pt": "msg",
"to": "btcprice",
"tot": "global"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 220,
"y": 100,
"wires": [
[]
]
},
{
"id": "e9c4155901807cb5",
"type": "ui_text_input",
"z": "9583b8de.96bc48",
"name": "",
"label": "ETH3L",
"tooltip": "",
"group": "2fdfab82bfaf51d2",
"order": 3,
"width": "0",
"height": "0",
"passthru": true,
"mode": "number",
"delay": 300,
"topic": "topic",
"sendOnBlur": true,
"className": "",
"topicType": "msg",
"x": 440,
"y": 40,
"wires": [
[
"d4cbddec54a95ede"
]
]
},
{
"id": "d4cbddec54a95ede",
"type": "change",
"z": "9583b8de.96bc48",
"name": "eth3lprice",
"rules": [
{
"t": "move",
"p": "payload",
"pt": "msg",
"to": "eth3lprice",
"tot": "global"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 600,
"y": 40,
"wires": [
[]
]
},
{
"id": "b819b93aa6896e4f",
"type": "ui_text_input",
"z": "9583b8de.96bc48",
"name": "",
"label": "FET",
"tooltip": "",
"group": "2fdfab82bfaf51d2",
"order": 3,
"width": "0",
"height": "0",
"passthru": true,
"mode": "number",
"delay": 300,
"topic": "topic",
"sendOnBlur": true,
"className": "",
"topicType": "msg",
"x": 430,
"y": 100,
"wires": [
[
"64dd4a4c0b2ef1ee"
]
]
},
{
"id": "64dd4a4c0b2ef1ee",
"type": "change",
"z": "9583b8de.96bc48",
"name": "fetprice",
"rules": [
{
"t": "move",
"p": "payload",
"pt": "msg",
"to": "fetprice",
"tot": "global"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 600,
"y": 100,
"wires": [
[]
]
},
{
"id": "ebe52f0cb64cba83",
"type": "debug",
"z": "9583b8de.96bc48",
"name": "debug 1",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1000,
"y": 180,
"wires": []
},
{
"id": "300bc64e17208247",
"type": "switch",
"z": "9583b8de.96bc48",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "btcprice",
"vt": "global"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 630,
"y": 400,
"wires": [
[
"4356a8757e48ee91"
]
]
},
{
"id": "0c7dc780312eb452",
"type": "inject",
"z": "9583b8de.96bc48",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "5",
"crontab": "",
"once": false,
"onceDelay": "1",
"topic": "",
"payload": "btcprice",
"payloadType": "global",
"x": 120,
"y": 400,
"wires": [
[
"2e57d1502b2c3d59"
]
]
},
{
"id": "5c16c91e99ad36bb",
"type": "http request",
"z": "9583b8de.96bc48",
"name": "BTC",
"method": "GET",
"ret": "obj",
"paytoqs": "ignore",
"url": "https://api.bybit.com/v5/market/kline?category=linear&symbol=BTCUSDT&interval=1",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 1090,
"y": 400,
"wires": [
[
"0f752386bbc0ed02"
]
]
},
{
"id": "0f752386bbc0ed02",
"type": "function",
"z": "9583b8de.96bc48",
"name": "json to BTC in USDT",
"func": "var btc = msg.payload.result.list[0][1]\n\n\n\n\nvar a = \" Allarme il prezzo di bitcoin è <break time='0.1s'/>\";\nvar b = \" dollari <break time='0.25s'/>\";\n\n//whisper message\nvar k, l;\nif (msg.payload.Quiet == \"On\") {\n k = ' <amazon:effect name=\"whispered\">'\n l = ' </amazon:effect>'\n}\nelse {\n k = \"\"\n l = \"\"\n}\n\nvar message = k + a + btc + b + l;\nmsg.payload = message;\n\n\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1260,
"y": 400,
"wires": [
[
"728ac4b3e60a6434"
]
]
},
{
"id": "728ac4b3e60a6434",
"type": "alexa-remote-routine",
"z": "9583b8de.96bc48",
"name": "",
"account": "e0d0608560b4720d",
"routineNode": {
"type": "speakAtVolume",
"payload": {
"type": "regular",
"text": {
"type": "msg",
"value": "payload"
},
"volume": {
"type": "num",
"value": "30"
},
"mode": "set",
"devices": [
"G0922H8523240SMD",
"G090XG01456518WL"
]
}
},
"x": 1510,
"y": 400,
"wires": [
[]
]
},
{
"id": "e3e8fdd82fd317fd",
"type": "delay",
"z": "9583b8de.96bc48",
"name": "",
"pauseType": "delay",
"timeout": "100",
"timeoutUnits": "milliseconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 950,
"y": 400,
"wires": [
[
"5c16c91e99ad36bb"
]
]
},
{
"id": "e10f602ebabfce64",
"type": "function",
"z": "9583b8de.96bc48",
"name": "json to BTC in USDT",
"func": "var btc = msg.payload.result.list[0][1];\nmsg.payload = btc;\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 460,
"y": 400,
"wires": [
[
"300bc64e17208247"
]
]
},
{
"id": "2e57d1502b2c3d59",
"type": "http request",
"z": "9583b8de.96bc48",
"name": "BTC",
"method": "GET",
"ret": "obj",
"paytoqs": "ignore",
"url": "https://api.bybit.com/v5/market/kline?category=spot&symbol=BTCUSDT&interval=1",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 270,
"y": 400,
"wires": [
[
"e10f602ebabfce64"
]
]
},
{
"id": "4356a8757e48ee91",
"type": "time-range-switch",
"z": "9583b8de.96bc48",
"name": "",
"lat": "",
"lon": "",
"startTime": "23:59",
"endTime": "6:00",
"startOffset": 0,
"endOffset": 0,
"x": 790,
"y": 400,
"wires": [
[],
[
"e3e8fdd82fd317fd"
]
]
},
{
"id": "2fdfab82bfaf51d2",
"type": "ui_group",
"name": "CRYPTO alert",
"tab": "0aca579870c98df1",
"order": 1,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "e0d8568560b4120d",
"type": "alexa-remote-account",
"name": "opt",
"authMethod": "proxy",
"proxyOwnIp": "192.168.0.202",
"proxyPort": "3456",
"cookieFile": "/data/authFile.cookie",
"refreshInterval": "0",
"alexaServiceHost": "alexa.amazon.it",
"pushDispatchHost": "",
"amazonPage": "amazon.it",
"acceptLanguage": "it-IT",
"onKeywordInLanguage": "",
"userAgent": "",
"usePushConnection": "on",
"autoInit": "on",
"autoQueryActivityOnTrigger": "on"
},
{
"id": "0aca579870c98df1",
"type": "ui_tab",
"name": "Home",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]