Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Node-Red
    5. [GELÖST] Heizungssteuerung mit Alexa & NodeRed

    NEWS

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    [GELÖST] Heizungssteuerung mit Alexa & NodeRed

    This topic has been deleted. Only users with topic management privileges can see it.
    • smarteule
      smarteule last edited by smarteule

      Hallo,

      ich möchte gern mit Alexa über Node Red meine Innentemperatur, Luftfeuchtigkeit und Heizungstemperatur abfragen.
      Dazu habe ich Folgendes angelegt:

      abb3b463-1b94-4fdc-8beb-e9097b467792-image.png

      Unter dem Join Node habe ich bei allen Abfragen das hier eingestellt:

      9aca32bb-88d7-4029-9e9f-2d871d9dbd06-image.png

      Im function Node ist folgendes eingetragen (Text in Zeile 5 variiert pro Abfrage natürlich):
      5777b48c-6880-43a4-ad8b-158712093212-image.png

      Unter dem speak Node habe ich dann meine Alexa ausgewählt.

      Jetzt zu meinem Problem:

      Wenn ich Alexa frage, wie die Temperatur im Raum ist, dann sagt sie mir:
      "Es sind NaN Grad im Raum."
      Das Gleiche verhält sich so mit Luftfeuchtigkeit und Wunschtemperatur.

      Was habe ich da falsch eingetragen bzw. warum wird der Wert nicht übermittelt?

      Des Weiteren möchte ich meine Heizung bzw. den Datenpunkt "Wunschtemperatur" mit dem gewünschten Wert steuern. Das heißt ich sage bspw. "Alexa, stelle Wunschtemperatur auf 22 Grad." Sie sagt mir daraufhin ok, hat den Wunschwert im Datenpunkt aber nicht eingetragen.

      Hierzu habe ich folgendes erstellt:

      1ca71edd-859c-4181-933d-400418ddf00e-image.png

      Im function Node habe ich das eingetragen.

      69eaa616-1e85-42d0-8278-52843b5650a7-image.png

      Warum wird der Wunschwert nicht im Datenpunkt eingetragen?

      Danke für Eure Hilfe.

      Edit: Ich habe mal einen Debug an den function Node gehangen und erhalte folgende Debugnachricht:

      TypeError: Cannot read property 'substr' of undefined
      
      frankthegreat 1 Reply Last reply Reply Quote 0
      • smarteule
        smarteule last edited by smarteule

        Ihr werdet es kaum für möglich halten, ich habe einen Teil selbst herausgefunden. Warum auch immer, es hat sich die Zuweisung

        var device = msg.payload[1]
        var str = msg.payload[0];
        

        geändert. Aus device als 0 wurde jetzt 1. Warum?

        Jetzt bleibt nur noch die Frage:
        Warum kann ich die Wunschtemperatur auf den Datenpunkt nicht setzen?

        msg.bri = msg.bri / 255 * 100
        msg.bri = Math.round (msg.bri)
        var newMsg = { payload: msg.bri } ;
        return newMsg;
        

        Edit: Hat sich erledigt. Habe Wunschtemperatur gelöscht, neu eingelesen und jetzt geht es.

        1 Reply Last reply Reply Quote 0
        • frankthegreat
          frankthegreat @smarteule last edited by

          @smarteule Hey, das gefällt mir ausgesprochen gut 👏
          Ich arbeite auch lieber mit Node Red als mit Blockly 😋

          Magst du vielleicht mal deinen kompletten Flow hier reinstellen?
          Danke schonmal.

          1 Reply Last reply Reply Quote 0
          • smarteule
            smarteule last edited by

            [
                {
                    "id": "e9e7d8ac.8f4e78",
                    "type": "tab",
                    "label": "Heizung",
                    "disabled": false,
                    "info": ""
                },
                {
                    "id": "3213224b.d4f74e",
                    "type": "ioBroker get",
                    "z": "e9e7d8ac.8f4e78",
                    "name": "serialNumber",
                    "topic": "alexa2.0.History.serialNumber",
                    "attrname": "payload",
                    "payloadType": "value",
                    "x": 440,
                    "y": 80,
                    "wires": [
                        [
                            "db514597.8c2138"
                        ]
                    ]
                },
                {
                    "id": "22f1d6e4.72f40a",
                    "type": "ioBroker get",
                    "z": "e9e7d8ac.8f4e78",
                    "name": "Temperature",
                    "topic": "zigbee.0.00158d00034d13af.temperature",
                    "attrname": "payload",
                    "payloadType": "value",
                    "x": 430,
                    "y": 140,
                    "wires": [
                        [
                            "db514597.8c2138"
                        ]
                    ]
                },
                {
                    "id": "db514597.8c2138",
                    "type": "join",
                    "z": "e9e7d8ac.8f4e78",
                    "name": "Temperatur Wz",
                    "mode": "custom",
                    "build": "array",
                    "property": "payload",
                    "propertyType": "msg",
                    "key": "topic",
                    "joiner": "\\n",
                    "joinerType": "str",
                    "accumulate": false,
                    "timeout": "",
                    "count": "2",
                    "reduceRight": false,
                    "reduceExp": "",
                    "reduceInit": "",
                    "reduceInitType": "",
                    "reduceFixup": "",
                    "x": 660,
                    "y": 80,
                    "wires": [
                        [
                            "fb78a805.b51678"
                        ]
                    ]
                },
                {
                    "id": "fb78a805.b51678",
                    "type": "function",
                    "z": "e9e7d8ac.8f4e78",
                    "name": "Temperatur auslesen",
                    "func": "var device = msg.payload[1]\nvar str = msg.payload[0];\nvar res = str.substr(0, 5);\nmsg.payload = Math.round(res);\nmsg.payload = \"Es sind \" + msg.payload + \" Grad in der Wohnstube\";\nmsg.url = \"\";\nvar command = \"alexa2.0.Echo-Devices.\" + device + \".Commands.speak\"\nmsg.topic = command;\nreturn msg",
                    "outputs": 1,
                    "noerr": 0,
                    "x": 880,
                    "y": 80,
                    "wires": [
                        [
                            "a033855.4b88978"
                        ]
                    ]
                },
                {
                    "id": "a033855.4b88978",
                    "type": "ioBroker out",
                    "z": "e9e7d8ac.8f4e78",
                    "name": "speak",
                    "topic": "alexa2.0.Echo-Devices.SerialAlexa.Commands.speak",
                    "ack": "false",
                    "autoCreate": "false",
                    "x": 1090,
                    "y": 80,
                    "wires": []
                },
                {
                    "id": "33b761ab.7501ae",
                    "type": "ioBroker get",
                    "z": "e9e7d8ac.8f4e78",
                    "name": "serialNumber",
                    "topic": "alexa2.0.History.serialNumber",
                    "attrname": "payload",
                    "payloadType": "value",
                    "x": 440,
                    "y": 320,
                    "wires": [
                        [
                            "102d8814.4bcfa8"
                        ]
                    ]
                },
                {
                    "id": "2a371beb.969094",
                    "type": "ioBroker get",
                    "z": "e9e7d8ac.8f4e78",
                    "name": "wunschtemperatur",
                    "topic": "0_userdata.0.aktoren.heizung.wunschtemperatur",
                    "attrname": "payload",
                    "payloadType": "value",
                    "x": 450,
                    "y": 380,
                    "wires": [
                        [
                            "102d8814.4bcfa8"
                        ]
                    ]
                },
                {
                    "id": "102d8814.4bcfa8",
                    "type": "join",
                    "z": "e9e7d8ac.8f4e78",
                    "name": "",
                    "mode": "custom",
                    "build": "array",
                    "property": "payload",
                    "propertyType": "msg",
                    "key": "topic",
                    "joiner": "\\n",
                    "joinerType": "str",
                    "accumulate": false,
                    "timeout": "",
                    "count": "2",
                    "reduceRight": false,
                    "reduceExp": "",
                    "reduceInit": "",
                    "reduceInitType": "",
                    "reduceFixup": "",
                    "x": 630,
                    "y": 320,
                    "wires": [
                        [
                            "7b655e83.843b8"
                        ]
                    ]
                },
                {
                    "id": "7b655e83.843b8",
                    "type": "function",
                    "z": "e9e7d8ac.8f4e78",
                    "name": "Temperatur auslesen",
                    "func": "var device = msg.payload[1]\nvar str = msg.payload[0];\nvar res = str.substr(0, 5);\nmsg.payload = Math.round(res);\nmsg.payload = \"Es sind \" + msg.payload + \" Grad Wunschtemperatur eingestellt.\";\nmsg.url = \"\";\nvar command = \"alexa2.0.Echo-Devices.\" + device + \".Commands.speak\"\nmsg.topic = command;\nreturn msg;\n",
                    "outputs": 1,
                    "noerr": 0,
                    "x": 880,
                    "y": 320,
                    "wires": [
                        [
                            "2a46cd4.d67b832"
                        ]
                    ]
                },
                {
                    "id": "2a46cd4.d67b832",
                    "type": "ioBroker out",
                    "z": "e9e7d8ac.8f4e78",
                    "name": "speak",
                    "topic": "alexa2.0.Echo-Devices.SerialAlexa.Commands.speak",
                    "ack": "false",
                    "autoCreate": "false",
                    "x": 1090,
                    "y": 320,
                    "wires": []
                },
                {
                    "id": "f3a4cdf2.3f046",
                    "type": "ioBroker out",
                    "z": "e9e7d8ac.8f4e78",
                    "name": "wunschtemperatur",
                    "topic": "0_userdata.0.aktoren.heizung.wunschtemperatur",
                    "ack": "false",
                    "autoCreate": "false",
                    "x": 1130,
                    "y": 460,
                    "wires": []
                },
                {
                    "id": "422c4f73.dff2b",
                    "type": "function",
                    "z": "e9e7d8ac.8f4e78",
                    "name": "Heizung rechnen",
                    "func": "msg.bri = msg.bri / 255 * 100\nmsg.bri = Math.round (msg.bri)\nvar newMsg = { payload: msg.bri } ;\nreturn newMsg;",
                    "outputs": 1,
                    "noerr": 0,
                    "x": 450,
                    "y": 460,
                    "wires": [
                        [
                            "f3a4cdf2.3f046"
                        ]
                    ]
                },
                {
                    "id": "ff7d49c1.faac28",
                    "type": "ioBroker get",
                    "z": "e9e7d8ac.8f4e78",
                    "name": "serialNumber",
                    "topic": "alexa2.0.History.serialNumber",
                    "attrname": "payload",
                    "payloadType": "value",
                    "x": 440,
                    "y": 200,
                    "wires": [
                        [
                            "eb296190.3980a"
                        ]
                    ]
                },
                {
                    "id": "dc466cfd.528cf",
                    "type": "ioBroker get",
                    "z": "e9e7d8ac.8f4e78",
                    "name": "Luftfeuchtigkeit",
                    "topic": "zigbee.0.00158d00034d13af.humidity",
                    "attrname": "payload",
                    "payloadType": "value",
                    "x": 440,
                    "y": 260,
                    "wires": [
                        [
                            "eb296190.3980a"
                        ]
                    ]
                },
                {
                    "id": "eb296190.3980a",
                    "type": "join",
                    "z": "e9e7d8ac.8f4e78",
                    "name": "",
                    "mode": "custom",
                    "build": "array",
                    "property": "payload",
                    "propertyType": "msg",
                    "key": "topic",
                    "joiner": "\\n",
                    "joinerType": "str",
                    "accumulate": false,
                    "timeout": "",
                    "count": "2",
                    "reduceRight": false,
                    "reduceExp": "",
                    "reduceInit": "",
                    "reduceInitType": "",
                    "reduceFixup": "",
                    "x": 630,
                    "y": 200,
                    "wires": [
                        [
                            "dff7e76.12d1a18"
                        ]
                    ]
                },
                {
                    "id": "dff7e76.12d1a18",
                    "type": "function",
                    "z": "e9e7d8ac.8f4e78",
                    "name": "Luftfeuchtigkeit auslesen",
                    "func": "var device = msg.payload[1]\nvar str = msg.payload[0];\nvar res = str.substr(0, 5);\nmsg.payload = Math.round(res);\nmsg.payload = \"Es ist eine Luftfeuchtigkeit von  \" + msg.payload + \" Prozent in der Wohnstube\";\nmsg.url = \"\";\nvar command = \"alexa2.0.Echo-Devices.\" + device + \".Commands.speak\"\nmsg.topic = command;\nreturn msg;\n",
                    "outputs": 1,
                    "noerr": 0,
                    "x": 870,
                    "y": 200,
                    "wires": [
                        [
                            "2716dd84.5a4b32"
                        ]
                    ]
                },
                {
                    "id": "2716dd84.5a4b32",
                    "type": "ioBroker out",
                    "z": "e9e7d8ac.8f4e78",
                    "name": "speak",
                    "topic": "alexa2.0.Echo-Devices.SerialAlexa.Commands.speak",
                    "ack": "false",
                    "autoCreate": "false",
                    "x": 1090,
                    "y": 200,
                    "wires": []
                },
                {
                    "id": "d359650.ab0be98",
                    "type": "link in",
                    "z": "e9e7d8ac.8f4e78",
                    "name": "Heizung",
                    "links": [
                        "f5d27eab.70924"
                    ],
                    "x": 135,
                    "y": 20,
                    "wires": [
                        [
                            "e6074353.d796a",
                            "cec227b4.4bd128",
                            "96c7480f.c836a8",
                            "553d16f3.93ae28"
                        ]
                    ]
                },
                {
                    "id": "60d78bd2.c9c064",
                    "type": "comment",
                    "z": "e9e7d8ac.8f4e78",
                    "name": "4 Geräte",
                    "info": "",
                    "x": 440,
                    "y": 20,
                    "wires": []
                },
                {
                    "id": "e6074353.d796a",
                    "type": "amazon-echo-device",
                    "z": "e9e7d8ac.8f4e78",
                    "name": "Abfrage Temperatur Wz",
                    "topic": "",
                    "x": 150,
                    "y": 100,
                    "wires": [
                        [
                            "22f1d6e4.72f40a",
                            "3213224b.d4f74e"
                        ]
                    ]
                },
                {
                    "id": "cec227b4.4bd128",
                    "type": "amazon-echo-device",
                    "z": "e9e7d8ac.8f4e78",
                    "name": "Abfrage Luftfeuchtigkeit WZ",
                    "topic": "",
                    "x": 160,
                    "y": 220,
                    "wires": [
                        [
                            "dc466cfd.528cf",
                            "ff7d49c1.faac28"
                        ]
                    ]
                },
                {
                    "id": "96c7480f.c836a8",
                    "type": "amazon-echo-device",
                    "z": "e9e7d8ac.8f4e78",
                    "name": "Abfrage Wunschtemperatur Wz",
                    "topic": "",
                    "x": 170,
                    "y": 360,
                    "wires": [
                        [
                            "2a371beb.969094",
                            "33b761ab.7501ae"
                        ]
                    ]
                },
                {
                    "id": "553d16f3.93ae28",
                    "type": "amazon-echo-device",
                    "z": "e9e7d8ac.8f4e78",
                    "name": "Wunschtemperatur Wohnstube",
                    "topic": "",
                    "x": 170,
                    "y": 460,
                    "wires": [
                        [
                            "422c4f73.dff2b"
                        ]
                    ]
                }
            ]
            

            falls sich jemand interessiert

            "SerialAlexa" ist durch Eure Alexa Serialnumber zu ersetzen und ein Aktor/Datenpunkt unter "0_userdata.0.aktoren.heizung.wunschtemperatur" zu erstellen.
            Gr

            A 1 Reply Last reply Reply Quote 0
            • A
              amandus99 @smarteule last edited by

              @smarteule

              ich habe mal versucht deinen Flow nachzuvollziehen und für mich anzupassen. Bei mir erkennt der die Gegenstände alle als Lampen. Ich kann dann zwar sagen "Alexa, schalte Zimmername an" und sie antwortet dann mit im Zimmername sind es X Grad. Das ist aber ja nicht Sinn und Zweck. Wie bekommt man das besser hin?

              1 Reply Last reply Reply Quote 0
              • First post
                Last post

              Support us

              ioBroker
              Community Adapters
              Donate

              1.1k
              Online

              31.7k
              Users

              79.7k
              Topics

              1.3m
              Posts

              communication heating node-red
              3
              5
              1394
              Loading More Posts
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes
              Reply
              • Reply as topic
              Log in to reply
              Community
              Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
              The ioBroker Community 2014-2023
              logo