Spaßprojekt Bitcoin Thermometer

Irgendwie hatte ich heute zu viel Kaffee und bin auf die Idee gekommen, dass man mit Hilfe von hih und Node RED vielleicht den aktuellen Bitcoin Kurs in einem virtuellen Gerät darstellen könnte. Also habe ich die Kaffeemaschine gleich noch mal angeschmissen und mich an den Rechner gesetzt. Hier das (vorläufige) Ergebnis meines kleinen BTC Thermometers :slight_smile:
image

Wer möchte kann das gerne verfeinern und hier vorstellen.

[
    {
        "id": "3dab5e2c.e93f02",
        "type": "tab",
        "label": "Bitcoin",
        "disabled": false,
        "info": ""
    },
    {
        "id": "3fbcc579.1dc12a",
        "type": "inject",
        "z": "3dab5e2c.e93f02",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "600",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 270,
        "y": 380,
        "wires": [
            [
                "dea77fd.b480f8"
            ]
        ]
    },
    {
        "id": "dea77fd.b480f8",
        "type": "http request",
        "z": "3dab5e2c.e93f02",
        "name": "",
        "method": "GET",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "https://api.coinpaprika.com/v1/tickers/btc-bitcoin",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "x": 470,
        "y": 380,
        "wires": [
            [
                "2e0f1b6c.b00ab4",
                "2bea4933.c1a716"
            ]
        ]
    },
    {
        "id": "2e0f1b6c.b00ab4",
        "type": "template",
        "z": "3dab5e2c.e93f02",
        "name": "",
        "field": "payload",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "{{payload.quotes.USD.percent_change_24h}}",
        "output": "str",
        "x": 640,
        "y": 380,
        "wires": [
            [
                "70a028ab.946078"
            ]
        ]
    },
    {
        "id": "82d5d190.ac73e",
        "type": "function",
        "z": "3dab5e2c.e93f02",
        "name": "Set BTC Price",
        "func": "var price = Math.round(msg.payload);\nmsg.payload = {\"attribute\":{ \"id\": 91, \"value\": price}};\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 820,
        "y": 320,
        "wires": [
            [
                "5d925528.ae80ac"
            ]
        ]
    },
    {
        "id": "70a028ab.946078",
        "type": "function",
        "z": "3dab5e2c.e93f02",
        "name": "Set 24h Change",
        "func": "var change24 = Math.ceil(msg.payload * 100) / 100;\nmsg.payload = {\"attribute\":{ \"id\": 92, \"value\": change24}};\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 820,
        "y": 380,
        "wires": [
            [
                "5d925528.ae80ac"
            ]
        ]
    },
    {
        "id": "5d925528.ae80ac",
        "type": "homeeDevice",
        "z": "3dab5e2c.e93f02",
        "virtual-homee": "",
        "name": "Bitcoin",
        "nodeId": "90",
        "showNodeId": false,
        "profile": "3001",
        "icon": "nodeicon_temperature",
        "attributes": [
            {
                "instance": 0,
                "minimum": 0,
                "maximum": 1000000,
                "current_value": 60000,
                "target_value": 60000,
                "last_value": 60000,
                "unit": "%24",
                "step_value": 1,
                "editable": 0,
                "type": 5,
                "state": 1,
                "last_changed": 1572966224,
                "changed_by": 1,
                "changed_by_id": 0,
                "based_on": 4,
                "data": "",
                "id": "91",
                "node_id": "90"
            },
            {
                "instance": 0,
                "minimum": -100,
                "maximum": 100,
                "current_value": 1,
                "target_value": 1,
                "last_value": 1,
                "unit": "%25",
                "step_value": 0.01,
                "editable": 0,
                "type": 7,
                "state": 1,
                "last_changed": 1572966224,
                "changed_by": 1,
                "changed_by_id": 0,
                "based_on": 4,
                "data": "",
                "id": "92",
                "node_id": "90"
            }
        ],
        "statusTemplate": "",
        "x": 1150,
        "y": 340,
        "wires": [
            []
        ]
    },
    {
        "id": "2bea4933.c1a716",
        "type": "template",
        "z": "3dab5e2c.e93f02",
        "name": "",
        "field": "payload",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "{{payload.quotes.USD.price}}",
        "output": "str",
        "x": 640,
        "y": 320,
        "wires": [
            [
                "82d5d190.ac73e"
            ]
        ]
    },
    {
        "id": "6dab98e4.b787c8",
        "type": "comment",
        "z": "3dab5e2c.e93f02",
        "name": "Coinpaprika API",
        "info": "Powered by\nhttps://api.coinpaprika.com/",
        "x": 460,
        "y": 340,
        "wires": []
    },
    {
        "id": "b1c4a602.01dce8",
        "type": "comment",
        "z": "3dab5e2c.e93f02",
        "name": "Node 90",
        "info": "",
        "x": 1160,
        "y": 300,
        "wires": []
    }
]

Gruß
chiroptera

9 Like

:crazy_face::joy: sehr schön, nun noch ein HG wenn Kurs um x% fällt dann kaufe Optionsschein y .

:+1::+1:

2 Like

Interessant mal wieder: Die Android App dichtet einfach eine Nachkommastelle hinzu, wo keine ist (.0) und die Y-Achsenbeschriftung klappt auch nicht :roll_eyes:

Bild

Jo ist lustig :stuck_out_tongue_closed_eyes:
Muss ich nur noch die real-time Kurse irgendwoher bekommen :joy:

1 Like

Find ich super, dann muss ich mich wohl auch mal mit Node Red beschäftigen :slight_smile: