Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Node-Red mit Alexa - Dimmer

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    Node-Red mit Alexa - Dimmer

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

      Ich hoffe, ich habe richtig kapiert.

      Das sollte auch ohne Blockly problemlos gehen:

      hier der flow:

      ! ````
      [
      {
      "id": "26dc88fe.708c5",
      "type": "inject",
      "z": "ca47e1d4.9f532",
      "name": "Alexa Schalte Test auf ROT",
      "topic": "",
      "payload": "{"hue":0,"saturation":1,"brightness":1}",
      "payloadType": "json",
      "repeat": "",
      "crontab": "",
      "once": false,
      "onceDelay": 0.1,
      "x": 230,
      "y": 140,
      "wires": [
      [
      "ad83b521.77c65",
      "7eb1492e.f3b3d8"
      ]
      ]
      },
      {
      "id": "86870acf.2656c",
      "type": "color-convert",
      "z": "ca47e1d4.9f532",
      "input": "hsv",
      "output": "rgb",
      "outputType": "array",
      "x": 190,
      "y": 300,
      "wires": [
      [
      "a57a950f.248af8"
      ]
      ]
      },
      {
      "id": "ad83b521.77c65",
      "type": "change",
      "z": "ca47e1d4.9f532",
      "name": "{"hue":0,"saturation":1,"brightness":1} to [h,s,v]",
      "rules": [
      {
      "t": "set",
      "p": "payload",
      "pt": "msg",
      "to": "[\t payload.hue,\t payload.saturation * 100,\t payload.brightness * 100\t]",
      "tot": "jsonata"
      }
      ],
      "action": "",
      "property": "",
      "from": "",
      "to": "",
      "reg": false,
      "x": 300,
      "y": 220,
      "wires": [
      [
      "86870acf.2656c",
      "a4ad7796.ecdb8"
      ]
      ]
      },
      {
      "id": "ccb4443d.a17ce8",
      "type": "comment",
      "z": "ca47e1d4.9f532",
      "name": "msg.payload ={"hue":0,"saturation":1,"brightness":1}",
      "info": "",
      "x": 940,
      "y": 140,
      "wires": []
      },
      {
      "id": "3e66cbf2.9da13c",
      "type": "comment",
      "z": "ca47e1d4.9f532",
      "name": "direct convert to rgb[r,g,b]",
      "info": "",
      "x": 830,
      "y": 300,
      "wires": []
      },
      {
      "id": "bd23336d.d791e8",
      "type": "comment",
      "z": "ca47e1d4.9f532",
      "name": "object hsv[h,s,v]",
      "info": "",
      "x": 800,
      "y": 220,
      "wires": []
      },
      {
      "id": "a57a950f.248af8",
      "type": "debug",
      "z": "ca47e1d4.9f532",
      "name": "rgb[r,g,b]",
      "active": true,
      "tosidebar": true,
      "console": false,
      "tostatus": false,
      "complete": "payload",
      "x": 600,
      "y": 300,
      "wires": []
      },
      {
      "id": "7eb1492e.f3b3d8",
      "type": "debug",
      "z": "ca47e1d4.9f532",
      "name": "{"hue":0,"saturation":1,"brightness":1}",
      "active": true,
      "tosidebar": true,
      "console": false,
      "tostatus": false,
      "complete": "payload",
      "x": 550,
      "y": 140,
      "wires": []
      },
      {
      "id": "a4ad7796.ecdb8",
      "type": "debug",
      "z": "ca47e1d4.9f532",
      "name": "hsv[h,s,v]",
      "active": true,
      "tosidebar": true,
      "console": false,
      "tostatus": false,
      "complete": "payload",
      "x": 600,
      "y": 220,
      "wires": []
      }
      ]

      
       ![3999_bild_1.png](/assets/uploads/files/3999_bild_1.png) 
      
      Am Eingang bekommt das Teil ein Oblect````
      {"hue":0,"saturation":1,"brightness":1}
      

      Am Ausgang hast du ein Array````
      [r,g,b]

      Wenn das lieber ein Object sein soll, der Form:````
      {"rgb": [r,g,b]}
      ````ist eine minimale Änderung nötig.
      1 Reply Last reply Reply Quote 0
      • D
        dondon4002 last edited by

        Perfekt 😄 dann hab ich nur den Converter falsch benutzt 😄 😄 danach noch nen Change to msg.payload.rgb und Alexa schaltet das ganze 🙂 Danke dir

        1 Reply Last reply Reply Quote 0
        • R
          rewenode last edited by

          @dondon4002:

          … Change to msg.payload.rgb `

          Exakt so 😄 falls nötig

          1 Reply Last reply Reply Quote 0
          • D
            dondon4002 last edited by

            Für alle die dann noch Bedarf daran haben 🙂

            Ich mache es am Ende doch per Blockly denn es kommen ja noch Abfragen wie TurnOnRequest, TunOffRequest und was Alexa noch alles so bietet.

            ! ````
            [
            {
            "id": "6a18e5be.c9abdc",
            "type": "Blockly",
            "z": "9433ac39.c5756",
            "language": "en",
            "func": "if ((msg['command']) == 'SetColorRequest') {\n msg['payload'] = [(msg['payload']['hue']), (msg['payload']['saturation']) * 100, (msg['payload']['brightness']) * 100];\n return [msg, null];\n} else if ((msg['command']) == 'TurnOffRequest') {\n msg['payload'] = false;\n return [null, msg];\n} else if ((msg['command']) == 'TurnOnRequest') {\n msg['payload'] = true;\n return [null, msg];\n}\n",
            "workspaceXml": "<xml xmlns="&quot;http://www.w3.org/1999/xhtml&quot;"><block id="&quot;OegDmw1SSX]D=Pa(8G75&quot;" type="&quot;controls_if&quot;" x="&quot;-2037&quot;" y="&quot;-387&quot;"><mutation elseif="&quot;2&quot;"></mutation><value name="&quot;IF0&quot;"><block id="&quot;GconiS<value name="&quot;IF0&quot;"ihVrBvHEiKZu&quot;" type="&quot;logic_compare&quot;"><field name="&quot;OP&quot;">EQ</field><value name="&quot;A&quot;"><block id="&quot;qfEv5p}Q.6(4bAAhVY)t&quot;" type="&quot;node_object_get&quot;"><mutation action="&quot;GET&quot;"></mutation><field name="&quot;action&quot;">GET</field><value name="&quot;object&quot;"><shadow id="&quot;8Rf40:s+-(Iix/~rpXuB&quot;" type="&quot;node_msg&quot;"></shadow></value><value name="&quot;field_name&quot;"><shadow id="&quot;3K$0p{%[oP^XO:,{IhsI&quot;" type="&quot;text&quot;"><field name="&quot;TEXT&quot;">command</field></shadow></value></block></value><value name="&quot;B&quot;"><block id="&quot;Gu~Z4BXhmh4D%LOE{4s-&quot;" type="&quot;text&quot;"><field name="&quot;TEXT&quot;">SetColorRequest</field></block></value></block></value><statement name="&quot;DO0&quot;"><block id="&quot;Wz6Dr1k2)tZbJ[+?V+j{&quot;" type="&quot;node_object_set&quot;"><value name="&quot;object_field&quot;"><shadow id="&quot;N7nV^CQPdk8cxV}?9mWX&quot;" type="&quot;node_msg&quot;"></shadow></value><value name="&quot;field_name&quot;"><shadow id="&quot;cZ6WgGkQ{3ya8z~VBE3\&quot;" type="\&quot;text\&quot;"><field name="\&quot;TEXT\&quot;">payload</field></shadow></value><value name="\&quot;value_field\&quot;"><shadow id="\&quot;sk?O05P5ma_5vqc{!#)&quot;" type="&quot;text&quot;"></shadow><block id="&quot;Md|@A(]N!kq$=b3)[SH!&quot;" type="&quot;lists_create_with&quot;"><mutation items="&quot;3&quot;"></mutation><value name="&quot;ADD0&quot;"><block id="&quot;tu7-Qe3u+zsXsItw[,yY&quot;" type="&quot;node_object_get&quot;"><mutation action="&quot;GET&quot;"></mutation><field name="&quot;action&quot;">GET</field><value name="&quot;object&quot;"><shadow id="&quot;4WDpncvt3q4gpN@S@MfM&quot;" type="&quot;node_msg&quot;"></shadow></value><value name="&quot;field_name&quot;"><shadow id="&quot;@d+[0zA[c(D{jmlYd^%O&quot;" type="&quot;text&quot;"><field name="&quot;TEXT&quot;">payload.hue</field></shadow></value></block></value><value name="&quot;ADD1&quot;"><block id="&quot;!Q#d8F/fCDqPNsm,6Z+&quot;" type="&quot;math_arithmetic&quot;"><field name="&quot;OP&quot;">MULTIPLY</field><value name="&quot;A&quot;"><shadow id="&quot;bNOGt$4!S%VQ?:vfS1V.&quot;" type="&quot;math_number&quot;"><field name="&quot;NUM&quot;">1</field></shadow><block id="&quot;cl:38kKKmak%V3E!m2}T&quot;" type="&quot;node_object_get&quot;"><mutation action="&quot;GET&quot;"></mutation><field name="&quot;action&quot;">GET</field><value name="&quot;object&quot;"><shadow id="&quot;8+vu8BKKc)fZo;rSk0[D&quot;" type="&quot;node_msg&quot;"></shadow></value><value name="&quot;field_name&quot;"><shadow id="&quot;FzE=$C.cumV)e3g*!;0\&quot;" type="\&quot;text\&quot;"><field name="\&quot;TEXT\&quot;">payload.saturation</field></shadow></value></block></value><value name="\&quot;B\&quot;"><shadow id="\&quot;p$RJ=}@6=xX[Ekbiqfn^\&quot;" type="\&quot;math_number\&quot;"><field name="\&quot;NUM\&quot;">100</field></shadow></value></block></value><value name="\&quot;ADD2\&quot;"><block id="\&quot;K[@!p?t]Y]0YY,I]]Y=3\&quot;" type="\&quot;math_arithmetic\&quot;"><field name="\&quot;OP\&quot;">MULTIPLY</field><value name="\&quot;A\&quot;"><shadow id="\&quot;12luhGJPp}BppnOnCd]t\&quot;" type="\&quot;math_number\&quot;"><field name="\&quot;NUM\&quot;">1</field></shadow><block id="\&quot;hu/B]c6@]lE@cn^qMa!I\&quot;" type="\&quot;node_object_get\&quot;"><mutation action="\&quot;GET\&quot;"></mutation><field name="\&quot;action\&quot;">GET</field><value name="\&quot;object\&quot;"><shadow id="\&quot;$2{@U|#45m9O#sYMG_HL\&quot;" type="\&quot;node_msg\&quot;"></shadow></value><value name="\&quot;field_name\&quot;"><shadow id="\&quot;9q^k;%a@6pz!wwSL[S\&quot;" type="\&quot;text\&quot;"><field name="\&quot;TEXT\&quot;">payload.brightness</field></shadow></value></block></value><value name="\&quot;B\&quot;"><shadow id="\&quot;H7P5:v+4jC%4eNSZg1b3\&quot;" type="\&quot;math_number\&quot;"><field name="\&quot;NUM\&quot;">100</field></shadow></value></block></value></block></value><next><block id="\&quot;dj6-iR8:4O-+v*!D~,M-\&quot;" type="\&quot;node_return_message\&quot;"><field name="\&quot;OUTPUT_NR\&quot;">1</field><value name="\&quot;MESSAGE_INPUT\&quot;"><shadow id="\&quot;!e8R2#N8Jdu(EAVQ{|&quot;" type="&quot;node_msg&quot;"></shadow></value></block></next></block></statement><value name="&quot;IF1&quot;"><block id="&quot;Gt#y.gqIL,qm)]{hhHC&quot;" type="&quot;logic_compare&quot;"><field name="&quot;OP&quot;">EQ</field><value name="&quot;A&quot;"><block id="&quot;N6$q19G#S0_xYH%PxSEI&quot;" type="&quot;node_object_get&quot;"><mutation action="&quot;GET&quot;"></mutation><field name="&quot;action&quot;">GET</field><value name="&quot;object&quot;"><shadow id="&quot;x(P(iAF[acHUJa%K1WW0&quot;" type="&quot;node_msg&quot;"></shadow></value><value name="&quot;field_name&quot;"><shadow id="&quot;401Ct:?6f$=h/.@%JFf=&quot;" type="&quot;text&quot;"><field name="&quot;TEXT&quot;">command</field></shadow></value></block></value><value name="&quot;B&quot;"><block id="&quot;E:%o.01_qWbolte})n[}&quot;" type="&quot;text&quot;"><field name="&quot;TEXT&quot;">TurnOffRequest</field></block></value></block></value><statement name="&quot;DO1&quot;"><block id="&quot;6=mvJ%:D4qf|CDFfAg[z&quot;" type="&quot;node_object_set&quot;"><value name="&quot;object_field&quot;"><shadow id="&quot;ABbAcS^Mj_]u:G0bmbxl&quot;" type="&quot;node_msg&quot;"></shadow></value><value name="&quot;field_name&quot;"><shadow id="&quot;to=(u!-hoz(ZB|X@F7;&quot;" type="&quot;text&quot;"><field name="&quot;TEXT&quot;">payload</field></shadow></value><value name="&quot;value_field&quot;"><shadow id="&quot;6?#earD4R8~?M5_1Y1va&quot;" type="&quot;text&quot;"></shadow><block id="&quot;gSN[vp0Vp@iiKOCKXZxO&quot;" type="&quot;logic_boolean&quot;"><field name="&quot;BOOL&quot;">FALSE</field></block></value><next><block id="&quot;8Lt@[lrf:,v#bz#My!,~&quot;" type="&quot;node_return_message&quot;"><field name="&quot;OUTPUT_NR&quot;">2</field><value name="&quot;MESSAGE_INPUT&quot;"><shadow id="&quot;ac^):!N/SuXK+m#l6G{e&quot;" type="&quot;node_msg&quot;"></shadow></value></block></next></block></statement><value name="&quot;IF2&quot;"><block id="&quot;:%iB^77hKA%5#Y]m3(KI&quot;" type="&quot;logic_compare&quot;"><field name="&quot;OP&quot;">EQ</field><value name="&quot;A&quot;"><block id="&quot;bZZ%2UXkY4qB_Fmae68&quot;" type="&quot;node_object_get&quot;"><mutation action="&quot;GET&quot;"></mutation><field name="&quot;action&quot;">GET</field><value name="&quot;object&quot;"><shadow id="&quot;O;dMHWtpMY{zN1](^WQa&quot;" type="&quot;node_msg&quot;"></shadow></value><value name="&quot;field_name&quot;"><shadow id="&quot;C0O}w0bo=c,,_#.[I9Gf&quot;" type="&quot;text&quot;"><field name="&quot;TEXT&quot;">command</field></shadow></value></block></value><value name="&quot;B&quot;"><block id="&quot;e5e|,AqRBMdDQ|~s?uv9&quot;" type="&quot;text&quot;"><field name="&quot;TEXT&quot;">TurnOnRequest</field></block></value></block></value><statement name="&quot;DO2&quot;"><block id="&quot;|DY5/yaj[#aVyjA:qNS&quot;" type="&quot;node_object_set&quot;"><value name="&quot;object_field&quot;"><shadow id="&quot;ee@E0k_unaE#!Ss=xdAB&quot;" type="&quot;node_msg&quot;"></shadow></value><value name="&quot;field_name&quot;"><shadow id="&quot;h]@6ikfpmr#ni-9FWDmN&quot;" type="&quot;text&quot;"><field name="&quot;TEXT&quot;">payload</field></shadow></value><value name="&quot;value_field&quot;"><shadow id="&quot;6?#earD4R8~?M5_1Y1va&quot;" type="&quot;text&quot;"></shadow><block id="&quot;c3@@`D0S$O}J_N]-B5lf&quot;" type="&quot;logic_boolean&quot;"><field name="&quot;BOOL&quot;">TRUE</field></block></value><next><block id="&quot;%R}_.z4(NfAy?#=Gv44&quot;" type="&quot;node_return_message&quot;"><field name="&quot;OUTPUT_NR&quot;">2</field><value name="&quot;MESSAGE_INPUT&quot;"><shadow id="&quot;}z$f11Tsy#/HuS(JG_Z&quot;" type="&quot;node_msg&quot;"></shadow></value></block></next></block></statement></block></xml>",
            "outputs": 2,
            "name": "",
            "x": 390,
            "y": 1320,
            "wires": [
            [
            "aeec5dac.065a9"
            ],
            [
            "7bd5f7d8.5e0f58"
            ]
            ]
            },
            {
            "id": "7bd5f7d8.5e0f58",
            "type": "hue-light",
            "z": "9433ac39.c5756",
            "name": "Lampe_Buero_LedStrip",
            "bridge": "d5d520c8.c3118",
            "lightid": "9",
            "colornamer": true,
            "x": 960,
            "y": 1330,
            "wires": [
            []
            ]
            },
            {
            "id": "8259bb25.207dc8",
            "type": "alexa-home",
            "z": "9433ac39.c5756",
            "conf": "b91f3657.228818",
            "device": "43026",
            "acknoledge": true,
            "name": "Test",
            "topic": "",
            "x": 240,
            "y": 1320,
            "wires": [
            [
            "6a18e5be.c9abdc"
            ]
            ]
            },
            {
            "id": "aeec5dac.065a9",
            "type": "color-convert",
            "z": "9433ac39.c5756",
            "input": "hsv",
            "output": "rgb",
            "outputType": "array",
            "x": 570,
            "y": 1290,
            "wires": [
            [
            "84d8358e.688908"
            ]
            ]
            },
            {
            "id": "84d8358e.688908",
            "type": "change",
            "z": "9433ac39.c5756",
            "name": "-> Converter ->",
            "rules": [
            {
            "t": "move",
            "p": "payload",
            "pt": "msg",
            "to": "payload.rgb",
            "tot": "msg"
            }
            ],
            "action": "",
            "property": "",
            "from": "",
            "to": "",
            "reg": false,
            "x": 740,
            "y": 1290,
            "wires": [
            [
            "7bd5f7d8.5e0f58"
            ]
            ]
            },
            {
            "id": "d5d520c8.c3118",
            "type": "hue-bridge",
            "z": "",
            "name": "Philips hue",
            "bridge": "1.2.3.103",
            "key": "*****",
            "interval": "1000"
            },
            {
            "id": "b91f3657.228818",
            "type": "alexa-home-conf",
            "z": "",
            "username": "
            "
            }
            ]

            
            

            if ((msg['command']) == 'SetColorRequest') {
            msg['payload'] = [(msg['payload']['hue']), (msg['payload']['saturation']) * 100, (msg['payload']['brightness']) * 100];
            return [msg, null];
            } else if ((msg['command']) == 'TurnOffRequest') {
            msg['payload'] = false;
            return [null, msg];
            } else if ((msg['command']) == 'TurnOnRequest') {
            msg['payload'] = true;
            return [null, msg];
            }

            1 Reply Last reply Reply Quote 0
            • R
              rewenode last edited by

              Nur zu, im Prinzip weist du ja jetzt wie es geht 😉

              1 Reply Last reply Reply Quote 0
              • B
                Blackeye last edited by

                Hi,

                ich habe ein Problem mit der Range des Dimmers. Der Dimmer möchte 0-100 und Alexa 0-1.

                Hier ist mein "Flow" der HomeKit Dimmer kommt da anschl. auch noch dran….

                [{"id":"40e9814d.216b7","type":"change","z":"e742a326.057cb","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"off","fromt":"str","to":"0","tot":"num"},{"t":"change","p":"payload","pt":"msg","from":"on","fromt":"str","to":"100","tot":"num"},{"t":"set","p":"payload","pt":"msg","to":"bri","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":507.4999694824219,"y":218.33334922790527,"wires":[["286a0677.93840a"]]}]
                
                1 Reply Last reply Reply Quote 0
                • R
                  rewenode last edited by

                  @Blackeye:

                  ich habe ein Problem mit der Range des Dimmers. Der Dimmer möchte 0-100 und Alexa 0-1. `

                  Was heisst Alexa 0-1 ? Alexa liefert dir einen Wert von 0-1 und der soll nach 0-100 umgesetzt werden?

                  1 Reply Last reply Reply Quote 0
                  • B
                    Blackeye last edited by

                    Hi,

                    genau so…..

                    1 Reply Last reply Reply Quote 0
                    • R
                      rewenode last edited by

                      @Blackeye:

                      Hi,

                      genau so….. `

                      Na wie wäre es, wenn du den von Alexa kommenden Wert 0-1 einfach mit 100 multiplizierst ?

                      1 Reply Last reply Reply Quote 0
                      • B
                        Blackeye last edited by

                        Hi,

                        ja auf die Idee bin ich auch gekommen, finde nur nirgendwo wie ich das mache.

                        Gruß

                        Lars

                        1 Reply Last reply Reply Quote 0
                        • R
                          rewenode last edited by

                          Sollte so gehen:

                          3999_bri.png

                          1 Reply Last reply Reply Quote 0
                          • F
                            Frank_y last edited by

                            Range-node (Standard)

                            1 Reply Last reply Reply Quote 0
                            • R
                              rewenode last edited by

                              @Frank_y:

                              Range-node (Standard) `

                              Klar geht das. Der Sinn will sich mir aber nicht erschließen, wo er den change doch schon drin hat;-)

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

                              Support us

                              ioBroker
                              Community Adapters
                              Donate

                              896
                              Online

                              31.8k
                              Users

                              79.9k
                              Topics

                              1.3m
                              Posts

                              5
                              39
                              7369
                              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