Variable in Function Node einfügen?

Node-RED als CCU3/RaspberryMatic Addon, WebApp, HomeKit, ...

Moderator: Co-Administratoren

Brainpurge
Beiträge: 106
Registriert: 08.11.2017, 17:56
System: CCU und Access Point
Hat sich bedankt: 16 Mal

Re: Variable in Function Node einfügen?

Beitrag von Brainpurge » 20.01.2023, 21:45

Achso :mrgreen:

Er bringt mir den ersten Satz, jedoch nicht die Ansage der Temperatur aus der URL bzw. von Variable "URLVariable_Temp"

Code: Alles auswählen

[{"id":"e4b227a54f7541b8","type":"change","z":"4cf6c9cf.9ef5a8","name":"get URLVariable","rules":[{"t":"set","p":"ulr","pt":"msg","to":"URLVariable_Temp","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":320,"wires":[["f905e71a644970cf"]]}]
CCU 3 mit Firmware 3.67.10 + AccessPoint mit Firmware 2.4.28

Benutzeravatar
Henke
Beiträge: 1538
Registriert: 27.06.2022, 20:51
System: CCU
Hat sich bedankt: 144 Mal
Danksagung erhalten: 312 Mal

Re: Variable in Function Node einfügen?

Beitrag von Henke » 20.01.2023, 22:47

Code: Alles auswählen

[
    {
        "id": "7ec8047544d17895",
        "type": "delay",
        "z": "7256a7ee15431de7",
        "name": "",
        "pauseType": "delay",
        "timeout": "10",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "outputs": 1,
        "x": 530,
        "y": 380,
        "wires": [
            [
                "dc69ce72c614349f"
            ]
        ]
    },
    {
        "id": "ad2917b4ef18a440",
        "type": "delay",
        "z": "7256a7ee15431de7",
        "name": "",
        "pauseType": "delay",
        "timeout": "2",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "outputs": 1,
        "x": 520,
        "y": 440,
        "wires": [
            [
                "2e0782da53fb1e7f"
            ]
        ]
    },
    {
        "id": "608c39eebc01f7ac",
        "type": "delay",
        "z": "7256a7ee15431de7",
        "name": "",
        "pauseType": "delay",
        "timeout": "1",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "outputs": 1,
        "x": 520,
        "y": 320,
        "wires": [
            [
                "e4b227a54f7541b8"
            ]
        ]
    },
    {
        "id": "caa2b9f7fb7a12d1",
        "type": "inject",
        "z": "7256a7ee15431de7",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "topic",
        "payload": "payload",
        "payloadType": "str",
        "x": 160,
        "y": 220,
        "wires": [
            [
                "5656c7e9cec7ca4d"
            ]
        ]
    },
    {
        "id": "972d19d5014edbfb",
        "type": "debug",
        "z": "7256a7ee15431de7",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 950,
        "y": 120,
        "wires": []
    },
    {
        "id": "aea93b1ea7d81cbf",
        "type": "ui_toast",
        "z": "7256a7ee15431de7",
        "position": "top right",
        "displayTime": "3",
        "highlight": "",
        "sendall": true,
        "outputs": 0,
        "ok": "OK",
        "cancel": "",
        "raw": false,
        "topic": "",
        "name": "",
        "x": 990,
        "y": 80,
        "wires": []
    },
    {
        "id": "3c27dd76d4fe5b9e",
        "type": "ui_button",
        "z": "7256a7ee15431de7",
        "name": "",
        "group": "13b35473.20565c",
        "order": 3,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "button",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "URLVariable",
        "payloadType": "global",
        "topic": "Geht?",
        "topicType": "str",
        "x": 770,
        "y": 100,
        "wires": [
            [
                "aea93b1ea7d81cbf",
                "972d19d5014edbfb"
            ]
        ]
    },
    {
        "id": "739f05e93e6c651c",
        "type": "change",
        "z": "7256a7ee15431de7",
        "name": "set URLVariable",
        "rules": [
            {
                "t": "set",
                "p": "URLVariable",
                "pt": "global",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 540,
        "y": 100,
        "wires": [
            [
                "3c27dd76d4fe5b9e"
            ]
        ]
    },
    {
        "id": "f905e71a644970cf",
        "type": "template",
        "z": "7256a7ee15431de7",
        "name": "Willkommen zu Hause",
        "field": "payload",
        "fieldType": "msg",
        "format": "json",
        "syntax": "mustache",
        "template": "{\n\"type\": \"MEDIA\",\n\"contentType\": \"audio/vnd.wav\",\n\"streamType\": \"BUFFERED\",\n    \"media\": [\n      { \"url\": \"http://192.168.178.169/addons/sounds/im-wohnzimmer.wav\" },\n      { \"url\": \"{{ulr}}\" } \n    ]\n}",
        "output": "json",
        "x": 940,
        "y": 320,
        "wires": [
            [
                "7ec8047544d17895",
                "6aa8995b1b052cfd"
            ]
        ]
    },
    {
        "id": "5656c7e9cec7ca4d",
        "type": "change",
        "z": "7256a7ee15431de7",
        "name": "Volume auf 40",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "{\"app\":\"DefaultMediaReceiver\",\"type\":\"VOLUME\",\"volume\":40}",
                "tot": "json"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 720,
        "y": 260,
        "wires": [
            [
                "608c39eebc01f7ac",
                "6aa8995b1b052cfd"
            ]
        ]
    },
    {
        "id": "dc69ce72c614349f",
        "type": "change",
        "z": "7256a7ee15431de7",
        "name": "Volume auf 10",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "{\"app\":\"DefaultMediaReceiver\",\"type\":\"VOLUME\",\"volume\":10}",
                "tot": "json"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 720,
        "y": 380,
        "wires": [
            [
                "ad2917b4ef18a440",
                "6aa8995b1b052cfd"
            ]
        ]
    },
    {
        "id": "2e0782da53fb1e7f",
        "type": "change",
        "z": "7256a7ee15431de7",
        "name": "Close",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "{\"app\":\"DefaultMediaReceiver\",\"type\":\"CLOSE\"}",
                "tot": "json"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 690,
        "y": 440,
        "wires": [
            [
                "6aa8995b1b052cfd"
            ]
        ]
    },
    {
        "id": "e4b227a54f7541b8",
        "type": "change",
        "z": "7256a7ee15431de7",
        "name": "get URLVariable",
        "rules": [
            {
                "t": "set",
                "p": "ulr",
                "pt": "msg",
                "to": "URLVariable",
                "tot": "global"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 720,
        "y": 320,
        "wires": [
            [
                "f905e71a644970cf"
            ]
        ]
    },
    {
        "id": "0a8262b4ab2f7eaf",
        "type": "inject",
        "z": "7256a7ee15431de7",
        "name": "hab ich nicht",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "topic",
        "payload": "ulr...",
        "payloadType": "str",
        "x": 170,
        "y": 100,
        "wires": [
            [
                "739f05e93e6c651c"
            ]
        ]
    },
    {
        "id": "6aa8995b1b052cfd",
        "type": "debug",
        "z": "7256a7ee15431de7",
        "name": "hab ich nicht",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 1350,
        "y": 380,
        "wires": []
    },
    {
        "id": "13b35473.20565c",
        "type": "ui_group",
        "name": "Default",
        "tab": "7aaf3908714e9146",
        "order": 1,
        "disp": false,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "7aaf3908714e9146",
        "type": "ui_tab",
        "name": "Tab 9",
        "icon": "dashboard",
        "order": 9
    }
]
testen

Brainpurge
Beiträge: 106
Registriert: 08.11.2017, 17:56
System: CCU und Access Point
Hat sich bedankt: 16 Mal

Re: Variable in Function Node einfügen?

Beitrag von Brainpurge » 21.01.2023, 15:18

Hallo, vielen Dank. Ich nehme an, ich ersetze hab ich nicht mit der Variable und dem Cast?
Screenshot 2023-01-21 151644.png
Bringt mir nur den ersten Satz :shock:

Die URL von den Soundfiles für Temp ist z.B. "http://192.168.178.169/addons/sounds/temp/19,5.wav"
CCU 3 mit Firmware 3.67.10 + AccessPoint mit Firmware 2.4.28

Benutzeravatar
Henke
Beiträge: 1538
Registriert: 27.06.2022, 20:51
System: CCU
Hat sich bedankt: 144 Mal
Danksagung erhalten: 312 Mal

Re: Variable in Function Node einfügen?

Beitrag von Henke » 21.01.2023, 16:08

19,5 könnte ein Problem sein.
Teste mal die erste Datei auch als 2. Einfach ein Injektion mit dem gleichen Dateinamen. Wird dann 2 mal der gleiche Text abgespielt?
Damit stellen wir sicher, das der Rest passt.

Brainpurge
Beiträge: 106
Registriert: 08.11.2017, 17:56
System: CCU und Access Point
Hat sich bedankt: 16 Mal

Re: Variable in Function Node einfügen?

Beitrag von Brainpurge » 21.01.2023, 16:16

Alles klar, die Ansage kommt, wie du geahnt hast, nun 2mal. Hab mal als 2. Zeile jetzt noch "http://192.168.178.169/addons/sounds/temp/19,5.wav", anstatt "{{ulr}}" eingefügt, die spielt er anstandslos ab.
CCU 3 mit Firmware 3.67.10 + AccessPoint mit Firmware 2.4.28

Benutzeravatar
Henke
Beiträge: 1538
Registriert: 27.06.2022, 20:51
System: CCU
Hat sich bedankt: 144 Mal
Danksagung erhalten: 312 Mal

Re: Variable in Function Node einfügen?

Beitrag von Henke » 21.01.2023, 16:25

Jetzt sicherstellen, das die Datei wirklich so heißt. 19,5? 19.5
Wenn es das nicht ist. Datei umzubenennen in 19_5. Sowohl im Flow als auch auf dem Ziel!

Brainpurge
Beiträge: 106
Registriert: 08.11.2017, 17:56
System: CCU und Access Point
Hat sich bedankt: 16 Mal

Re: Variable in Function Node einfügen?

Beitrag von Brainpurge » 21.01.2023, 16:40

Henke hat geschrieben:
21.01.2023, 16:25
Jetzt sicherstellen, das die Datei wirklich so heißt. 19,5? 19.5
Wenn es das nicht ist. Datei umzubenennen in 19_5. Sowohl im Flow als auch auf dem Ziel!
19,5.wav, also Komma defintiv. Die Temperatur nehme ich ja vom HmIP Thermostat, dort ist z.b. 19,5 gespeichert.
CCU 3 mit Firmware 3.67.10 + AccessPoint mit Firmware 2.4.28

Benutzeravatar
Henke
Beiträge: 1538
Registriert: 27.06.2022, 20:51
System: CCU
Hat sich bedankt: 144 Mal
Danksagung erhalten: 312 Mal

Re: Variable in Function Node einfügen?

Beitrag von Henke » 21.01.2023, 17:00

Henke hat geschrieben:
21.01.2023, 16:25
"http://192.168.178.169/addons/sounds/temp/19,5.wav", anstatt "{{ulr}}"
Ok, {{ulr}} ändern in {{{ulr}}}
Testen

Brainpurge
Beiträge: 106
Registriert: 08.11.2017, 17:56
System: CCU und Access Point
Hat sich bedankt: 16 Mal

Re: Variable in Function Node einfügen?

Beitrag von Brainpurge » 21.01.2023, 17:11

Henke hat geschrieben:
21.01.2023, 17:00
Henke hat geschrieben:
21.01.2023, 16:25
"http://192.168.178.169/addons/sounds/temp/19,5.wav", anstatt "{{ulr}}"
Ok, {{ulr}} ändern in {{{ulr}}}
Testen
Die Lösung!!! :mrgreen: :mrgreen: :mrgreen: :mrgreen: :mrgreen:

Es geht, mega. Danke danke

Mit dem {{{ulr}}} musst du mir aber nochmal erklären. Woher nimmt er den Wert?

Würde das gern bei meinem täglichen Zitat ebenfalls umsetzen.

Code: Alles auswählen

[{"id":"b1cafdc6.34004","type":"tab","label":"Zitat Test","disabled":false,"info":""},{"id":"7820974c.70dd18","type":"delay","z":"b1cafdc6.34004","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":480,"y":160,"wires":[["6e1366fd.3aebb8"]]},{"id":"939c5eb5.59054","type":"delay","z":"b1cafdc6.34004","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":480,"y":220,"wires":[["61563899.4172e8"]]},{"id":"200f7207.693b9e","type":"delay","z":"b1cafdc6.34004","name":"","pauseType":"delay","timeout":"15","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":490,"y":280,"wires":[["2c242a19.ae5146"]]},{"id":"c40338a9.f331b8","type":"inject","z":"b1cafdc6.34004","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"topic","payload":"payload","payloadType":"msg","x":185,"y":269,"wires":[["7820974c.70dd18"]]},{"id":"deb20675.9dcbc8","type":"http in","z":"b1cafdc6.34004","name":"","url":"/zitat","method":"get","upload":false,"swaggerDoc":"","x":240,"y":160,"wires":[["7820974c.70dd18"]]},{"id":"31c60316.7a1b6c","type":"castv2-sender","z":"b1cafdc6.34004","name":"Küche","connection":"f71d550e.d9b078","x":1050,"y":300,"wires":[[]],"outputLabels":["msg.payload"]},{"id":"d97c1595.3b11b8","type":"ccu-sysvar","z":"b1cafdc6.34004","name":"URLVariable_Zitat_AN","ccuConfig":"38263145.35ea0e","topic":"ReGaHSS/${Name}","change":false,"cache":true,"x":240,"y":480,"wires":[["1c2a3bd4.40b4f4"]]},{"id":"9519acfb.b2827","type":"debug","z":"b1cafdc6.34004","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1050,"y":400,"wires":[]},{"id":"7bb17c70.2e14a4","type":"ui_toast","z":"b1cafdc6.34004","position":"top right","displayTime":"3","highlight":"","sendall":true,"outputs":0,"ok":"OK","cancel":"","raw":false,"topic":"","name":"","x":1090,"y":460,"wires":[]},{"id":"8e3552c1.adb4e","type":"ui_button","z":"b1cafdc6.34004","name":"","group":"46fbe67a.90cd18","order":3,"width":0,"height":0,"passthru":false,"label":"button","tooltip":"","color":"","bgcolor":"","icon":"","payload":"URLVariable","payloadType":"global","topic":"Geht?","topicType":"str","x":830,"y":460,"wires":[["7bb17c70.2e14a4","9519acfb.b2827"]]},{"id":"1c2a3bd4.40b4f4","type":"change","z":"b1cafdc6.34004","name":"","rules":[{"t":"set","p":"URLVariable_Zitat_AN","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":460,"wires":[["8e3552c1.adb4e"]]},{"id":"3c633b5d.bbd344","type":"change","z":"b1cafdc6.34004","name":"Close","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"app\":\"DefaultMediaReceiver\",\"type\":\"CLOSE\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":340,"wires":[["31c60316.7a1b6c"]]},{"id":"2c242a19.ae5146","type":"change","z":"b1cafdc6.34004","name":"Volume auf 10","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"app\":\"DefaultMediaReceiver\",\"type\":\"VOLUME\",\"volume\":10}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":280,"wires":[["31c60316.7a1b6c","3c633b5d.bbd344"]]},{"id":"6e1366fd.3aebb8","type":"change","z":"b1cafdc6.34004","name":"Volume auf 40","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"app\":\"DefaultMediaReceiver\",\"type\":\"VOLUME\",\"volume\":40}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":160,"wires":[["939c5eb5.59054"]]},{"id":"61563899.4172e8","type":"template","z":"b1cafdc6.34004","name":"Zitat","field":"payload","fieldType":"msg","format":"json","syntax":"mustache","template":"{\n\"type\": \"MEDIA\",\n\"contentType\": \"audio/vnd.wav\",\n\"streamType\": \"BUFFERED\",\n    \"media\": [\n     { \"url\": \"{{{ulr}}}\" } \n    ]\n}","output":"json","x":730,"y":220,"wires":[["200f7207.693b9e","31c60316.7a1b6c"]]},{"id":"f71d550e.d9b078","type":"castv2-connection","name":"Küche","target":"Küche","host":"192.168.178.70","port":"8009"},{"id":"38263145.35ea0e","type":"ccu-connection","name":"localhost","host":"localhost","regaEnabled":true,"bcrfEnabled":true,"iprfEnabled":true,"virtEnabled":true,"bcwiEnabled":false,"cuxdEnabled":false,"regaPoll":true,"regaInterval":"120","rpcPingTimeout":"60","rpcInitAddress":"127.0.0.1","rpcServerHost":"192.168.178.169","rpcBinPort":"2047","rpcXmlPort":"2048","tls":false,"inSecure":false,"authentication":false,"username":"","password":"","queueTimeout":"5000","queuePause":"350","contextStore":"default"},{"id":"46fbe67a.90cd18","type":"ui_group","name":"Variablen","tab":"36fb2145.947dee","order":1,"disp":true,"width":"6","collapse":false},{"id":"36fb2145.947dee","type":"ui_tab","name":"Variablen","icon":"dashboard","order":2}]
Zuletzt geändert von Brainpurge am 21.01.2023, 17:26, insgesamt 1-mal geändert.
CCU 3 mit Firmware 3.67.10 + AccessPoint mit Firmware 2.4.28

Benutzeravatar
Henke
Beiträge: 1538
Registriert: 27.06.2022, 20:51
System: CCU
Hat sich bedankt: 144 Mal
Danksagung erhalten: 312 Mal

Re: Variable in Function Node einfügen?

Beitrag von Henke » 21.01.2023, 17:17

:D Gerne

Antworten

Zurück zu „RedMatic“