Temperaturdifferenz (aus HmIP-eTRV-2) soll HmIP-PCBS schalten

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

Moderator: Co-Administratoren

Antworten
holger22
Beiträge: 16
Registriert: 26.09.2022, 19:09
System: CCU

Temperaturdifferenz (aus HmIP-eTRV-2) soll HmIP-PCBS schalten

Beitrag von holger22 » 26.09.2022, 19:39

Hallo,
ich befasse mich seit einigen Tagen mit meiner CCU3 und RedMatic.
Dabei komme ich seit zwei Tagen an einer Stelle nicht mehr weiter.
Ich möchte gerne die Soll- und Ist-Temperatur (aus HmIP-eTRV-2) vergleichen. Sobald die Ist-Temperatur < als Soll ist, sollte der HmIP-PCBS schalten.
Nach ewiger uneleganter Bastelei bin ich nun soweit, dass die Nachricht an den Schalter gesendet werden soll. Der Schalter reagiert jedoch nicht. Habe schon mit msg.topic, msg.payload jweils als Text und boolean probiert. Fehlanzeige.
Zum Vergleich habe ich einen Switch genommen um Schalter1 zu testen. Das geht ohne Problem.
Irgendwie habe ich da einen Knoten im Kopf.
Wer kann mir helfen?
001.JPG
Hier der Code zum Bild - war mir nicht sicher wie das elegant angezeigt werden kann:

Code: Alles auswählen

[{"id":"c5e70a1a.26d77","type":"ccu-value","z":"b47e4440.f97278","name":"Büro Soll Temp","iface":"HmIP-RF","channel":"000A1F298C2E1F:1 HmIP-eTRV-2 000A1F298C2E1F:1","datapoint":"SET_POINT_TEMPERATURE","mode":"","start":true,"change":true,"cache":true,"queue":false,"on":0,"onType":"undefined","ramp":0,"rampType":"undefined","working":false,"ccuConfig":"38263145.35ea0e","topic":"Büro Soll Temp","x":180,"y":420,"wires":[["a397fe1f.3cd718"]]},{"id":"58b7641.c25b19c","type":"ccu-value","z":"b47e4440.f97278","name":"Büro Ist Temp","iface":"HmIP-RF","channel":"000A1F298C2E1F:1 HmIP-eTRV-2 000A1F298C2E1F:1","datapoint":"ACTUAL_TEMPERATURE","mode":"","start":true,"change":true,"cache":true,"queue":false,"on":0,"onType":"undefined","ramp":0,"rampType":"undefined","working":false,"ccuConfig":"38263145.35ea0e","topic":"Büro Ist Temp","x":180,"y":500,"wires":[["19f4c4e6.280a3b"]]},{"id":"4e752007.c4846","type":"ccu-set-value","z":"b47e4440.f97278","name":"Schalter","iface":"HmIP-RF","ccuConfig":"38263145.35ea0e","rooms":"","roomsRx":"str","functions":"","functionsRx":"str","device":"00045D89B6BA9C","deviceRx":"str","deviceName":"HmIP-PCBS 00045D89B6BA9C","deviceNameRx":"str","deviceType":"HmIP-PCBS","deviceTypeRx":"str","channel":"00045D89B6BA9C:3","channelRx":"str","channelName":"HmIP-PCBS 00045D89B6BA9C:3","channelNameRx":"str","channelType":"SWITCH_VIRTUAL_RECEIVER","channelTypeRx":"str","channelIndex":"3","channelIndexRx":"str","datapoint":"STATE","datapointRx":"str","force":false,"x":780,"y":620,"wires":[]},{"id":"ab0b0bfa.ba2f3","type":"ui_switch","z":"b47e4440.f97278","name":"","label":"switch","tooltip":"","group":"65a72644.483318","order":3,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","animate":false,"x":150,"y":320,"wires":[["377bf1ef.6332ce"]]},{"id":"a397fe1f.3cd718","type":"change","z":"b47e4440.f97278","name":"","rules":[{"t":"set","p":"var1","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":420,"wires":[["f070d763.118468"]]},{"id":"19f4c4e6.280a3b","type":"change","z":"b47e4440.f97278","name":"","rules":[{"t":"set","p":"var2","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":500,"wires":[["f070d763.118468"]]},{"id":"f070d763.118468","type":"change","z":"b47e4440.f97278","name":"Diff Ist-Soll","rules":[{"t":"set","p":"payload","pt":"msg","to":"$flowContext('var2')-$flowContext('var1')","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":460,"wires":[["439f2c17.3676a4","861fa57f.08b3d"]]},{"id":"439f2c17.3676a4","type":"debug","z":"b47e4440.f97278","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":790,"y":360,"wires":[]},{"id":"16b2e80f.40c668","type":"debug","z":"b47e4440.f97278","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":790,"y":540,"wires":[]},{"id":"861fa57f.08b3d","type":"function","z":"b47e4440.f97278","name":"change output depending on input","func":"if (msg.payload<0)\n{\n    msg.topic=true;\n    return msg;\n} \n\nelse {\n    msg.topic=false;\n    return msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":450,"y":580,"wires":[["16b2e80f.40c668","4e752007.c4846"]]},{"id":"377bf1ef.6332ce","type":"ccu-set-value","z":"b47e4440.f97278","name":"Schalter1","iface":"HmIP-RF","ccuConfig":"38263145.35ea0e","rooms":"","roomsRx":"str","functions":"","functionsRx":"str","device":"00045D89B6BA9C","deviceRx":"str","deviceName":"HmIP-PCBS 00045D89B6BA9C","deviceNameRx":"str","deviceType":"HmIP-PCBS","deviceTypeRx":"str","channel":"00045D89B6BA9C:3","channelRx":"str","channelName":"HmIP-PCBS 00045D89B6BA9C:3","channelNameRx":"str","channelType":"SWITCH_VIRTUAL_RECEIVER","channelTypeRx":"str","channelIndex":"3","channelIndexRx":"str","datapoint":"STATE","datapointRx":"str","force":false,"x":340,"y":320,"wires":[]},{"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":"30","rpcPingTimeout":"60","rpcInitAddress":"127.0.0.1","rpcServerHost":"127.0.0.1","rpcBinPort":"2047","rpcXmlPort":"2048"},{"id":"65a72644.483318","type":"ui_group","name":"Virtuelle Taste BidCoS-RF:1","tab":"fe205248.f04ed","order":1,"disp":true,"width":"6","collapse":false},{"id":"fe205248.f04ed","type":"ui_tab","name":"Geräte","icon":"dashboard","order":1}]
Zuletzt geändert von Roland M. am 26.09.2022, 19:40, insgesamt 1-mal geändert.
Grund: Code-Tags eingefügt

Zwenjo
Beiträge: 52
Registriert: 13.11.2020, 12:12
System: CCU
Hat sich bedankt: 11 Mal
Danksagung erhalten: 3 Mal

Re: Temperaturdifferenz (aus HmIP-eTRV-2) soll HmIP-PCBS schalten

Beitrag von Zwenjo » 26.09.2022, 21:02

Hey, ich hätte es so gelöst. Probier es mal aus.

Gruß Sven

Code: Alles auswählen

[{"id":"fffa53f9ea76901d","type":"ccu-value","z":"54d413be0b82da97","name":"Büro Soll Temp","iface":"HmIP-RF","channel":"","datapoint":"","mode":"","start":true,"change":true,"cache":true,"queue":false,"on":0,"onType":"undefined","ramp":0,"rampType":"undefined","working":false,"ccuConfig":"38263145.35ea0e","topic":"Büro Soll Temp","x":240,"y":280,"wires":[["de25445c4c311dc1"]]},{"id":"1e8cd486a9e08850","type":"ccu-value","z":"54d413be0b82da97","name":"Büro Ist Temp","iface":"HmIP-RF","channel":"000A1F298C2E1F:1 HmIP-eTRV-2 000A1F298C2E1F:1","datapoint":"ACTUAL_TEMPERATURE","mode":"","start":true,"change":true,"cache":true,"queue":false,"on":0,"onType":"undefined","ramp":0,"rampType":"undefined","working":false,"ccuConfig":"38263145.35ea0e","topic":"Büro Ist Temp","x":240,"y":360,"wires":[["43881159461c58cc"]]},{"id":"699472711d7d49ef","type":"ccu-set-value","z":"54d413be0b82da97","name":"Schalter","iface":"HmIP-RF","ccuConfig":"38263145.35ea0e","rooms":"","roomsRx":"str","functions":"","functionsRx":"str","device":"00045D89B6BA9C","deviceRx":"str","deviceName":"HmIP-PCBS 00045D89B6BA9C","deviceNameRx":"str","deviceType":"HmIP-PCBS","deviceTypeRx":"str","channel":"00045D89B6BA9C:3","channelRx":"str","channelName":"HmIP-PCBS 00045D89B6BA9C:3","channelNameRx":"str","channelType":"SWITCH_VIRTUAL_RECEIVER","channelTypeRx":"str","channelIndex":"3","channelIndexRx":"str","datapoint":"STATE","datapointRx":"str","force":false,"x":800,"y":320,"wires":[]},{"id":"de25445c4c311dc1","type":"change","z":"54d413be0b82da97","name":"","rules":[{"t":"set","p":"var1","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":280,"wires":[["6841d29a6ebb5a9e"]]},{"id":"43881159461c58cc","type":"change","z":"54d413be0b82da97","name":"","rules":[{"t":"set","p":"var2","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":360,"wires":[["6841d29a6ebb5a9e"]]},{"id":"a44b13d70620a28e","type":"debug","z":"54d413be0b82da97","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":810,"y":380,"wires":[]},{"id":"6841d29a6ebb5a9e","type":"function","z":"54d413be0b82da97","name":"Vergleich","func":"var v1 = flow.get(\"var1\")\nvar v2 = flow.get(\"var2\")\nvar b1 = false\n\nif (v2 <= v1)\n{b1 = true}\n\nmsg.payload = b1\n\nreturn[msg]","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":620,"y":320,"wires":[["a44b13d70620a28e","699472711d7d49ef"]]},{"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":"30","rpcPingTimeout":"60","rpcInitAddress":"127.0.0.1","rpcServerHost":"127.0.0.1","rpcBinPort":"2047","rpcXmlPort":"2048","tls":false,"inSecure":false,"authentication":false,"username":"","password":"","queueTimeout":"5000","queuePause":"250","contextStore":""}]
--------------------------------------------
356 Kanäle in 50 Geräten und 16 CUxD-Kanäle in 1 CUxD-Geräten:
1x HmIP-CCU3, 1x HmIP-HAP, 1x CUX28, 1x HmIP-STHO-A, 2x HmIP-FSM, 1x HmIP-SPI, 1x HmIP-SAM, 1x HM-LC-Sw1-Pl-CT-R1, 1x HmIP-FSI16, 1x HmIP-SRH, 1x HmIP-eTRV-E, 6x HmIP-HEATING, 1x HmIP-BSL, 1x HmIP-FROLL, 7x HMIP-SWDO, 9x HmIP-BROLL, 6x HmIP-eTRV-2, 1x HmIP-BSM, 1x HmIP-BDT, 1x HmIP-SWSD, 2x HmIP-WTH-2, 1x HMIP-PS, 1x HmIP-PCBS, 1x HmIP-RCV-50, 1x HMIP-PSM
--------------------------------------------

Benutzeravatar
Henke
Beiträge: 1500
Registriert: 27.06.2022, 20:51
System: CCU
Hat sich bedankt: 133 Mal
Danksagung erhalten: 304 Mal

Re: Temperaturdifferenz (aus HmIP-eTRV-2) soll HmIP-PCBS schalten

Beitrag von Henke » 26.09.2022, 22:13

Code: Alles auswählen

if (msg.payload<0)
{
    msg.topic=true;
    return msg;
} 

else {
    msg.topic=false;
    return msg;
}
topic ist falsch. payload wäre hier richtig.

Ich würde es aber in NodeRed so machen:

Code: Alles auswählen

[
    {
        "id": "f05d43012ac3dfa2",
        "type": "ccu-value",
        "z": "571b1adfd6a79106",
        "name": "Büro Soll Temp",
        "iface": "HmIP-RF",
        "channel": "",
        "datapoint": "",
        "mode": "",
        "start": true,
        "change": true,
        "cache": true,
        "queue": false,
        "on": 0,
        "onType": "undefined",
        "ramp": 0,
        "rampType": "undefined",
        "working": false,
        "ccuConfig": "38263145.35ea0e",
        "topic": "Büro Soll Temp",
        "x": 540,
        "y": 860,
        "wires": [
            [
                "5636346e4949a837"
            ]
        ]
    },
    {
        "id": "d103460b64d77faa",
        "type": "ccu-value",
        "z": "571b1adfd6a79106",
        "name": "Büro Ist Temp",
        "iface": "HmIP-RF",
        "channel": "000A1F298C2E1F:1 HmIP-eTRV-2 000A1F298C2E1F:1",
        "datapoint": "ACTUAL_TEMPERATURE",
        "mode": "",
        "start": true,
        "change": true,
        "cache": true,
        "queue": false,
        "on": 0,
        "onType": "undefined",
        "ramp": 0,
        "rampType": "undefined",
        "working": false,
        "ccuConfig": "38263145.35ea0e",
        "topic": "Büro Ist Temp",
        "x": 540,
        "y": 940,
        "wires": [
            [
                "5636346e4949a837"
            ]
        ]
    },
    {
        "id": "4b9e7f165f2aad63",
        "type": "ccu-set-value",
        "z": "571b1adfd6a79106",
        "name": "Schalter",
        "iface": "HmIP-RF",
        "ccuConfig": "38263145.35ea0e",
        "rooms": "",
        "roomsRx": "str",
        "functions": "",
        "functionsRx": "str",
        "device": "00045D89B6BA9C",
        "deviceRx": "str",
        "deviceName": "HmIP-PCBS 00045D89B6BA9C",
        "deviceNameRx": "str",
        "deviceType": "HmIP-PCBS",
        "deviceTypeRx": "str",
        "channel": "00045D89B6BA9C:3",
        "channelRx": "str",
        "channelName": "HmIP-PCBS 00045D89B6BA9C:3",
        "channelNameRx": "str",
        "channelType": "SWITCH_VIRTUAL_RECEIVER",
        "channelTypeRx": "str",
        "channelIndex": "3",
        "channelIndexRx": "str",
        "datapoint": "STATE",
        "datapointRx": "str",
        "force": false,
        "x": 1260,
        "y": 900,
        "wires": []
    },
    {
        "id": "9ad0132fc71705fe",
        "type": "ui_switch",
        "z": "571b1adfd6a79106",
        "name": "",
        "label": "switch",
        "tooltip": "",
        "group": "65a72644.483318",
        "order": 3,
        "width": 0,
        "height": 0,
        "passthru": true,
        "decouple": "false",
        "topic": "topic",
        "topicType": "msg",
        "style": "",
        "onvalue": "true",
        "onvalueType": "bool",
        "onicon": "",
        "oncolor": "",
        "offvalue": "false",
        "offvalueType": "bool",
        "officon": "",
        "offcolor": "",
        "animate": false,
        "x": 1070,
        "y": 820,
        "wires": [
            [
                "4b9e7f165f2aad63"
            ]
        ]
    },
    {
        "id": "5636346e4949a837",
        "type": "combine-delta",
        "z": "571b1adfd6a79106",
        "topic": "Diff",
        "topicA": "Büro Soll Temp",
        "topicB": "Büro Ist Temp",
        "name": "",
        "x": 730,
        "y": 900,
        "wires": [
            [
                "5675b89d9391401f"
            ]
        ]
    },
    {
        "id": "5675b89d9391401f",
        "type": "switch",
        "z": "571b1adfd6a79106",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "lt",
                "v": "0",
                "vt": "num"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 890,
        "y": 900,
        "wires": [
            [
                "b03c6c98ec1e1977"
            ],
            [
                "9d7aa6bb84578509"
            ]
        ]
    },
    {
        "id": "b03c6c98ec1e1977",
        "type": "change",
        "z": "571b1adfd6a79106",
        "name": "An",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "1",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1070,
        "y": 880,
        "wires": [
            [
                "4b9e7f165f2aad63"
            ]
        ]
    },
    {
        "id": "9d7aa6bb84578509",
        "type": "change",
        "z": "571b1adfd6a79106",
        "name": "Aus",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "0",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1070,
        "y": 920,
        "wires": [
            [
                "4b9e7f165f2aad63"
            ]
        ]
    },
    {
        "id": "38263145.35ea0e",
        "type": "ccu-connection",
        "name": "localhost",
        "host": "localhost",
        "regaEnabled": true,
        "bcrfEnabled": true,
        "iprfEnabled": true,
        "virtEnabled": true,
        "bcwiEnabled": false,
        "jackEnabled": true,
        "cuxdEnabled": true,
        "regaPoll": true,
        "regaInterval": "30",
        "rpcPingTimeout": "60",
        "rpcInitAddress": "127.0.0.1",
        "rpcServerHost": "127.0.0.1",
        "rpcBinPort": "2047",
        "rpcXmlPort": "2048",
        "tls": false,
        "inSecure": false,
        "authentication": false,
        "queueTimeout": "5000",
        "queuePause": "250",
        "contextStore": ""
    },
    {
        "id": "65a72644.483318",
        "type": "ui_group",
        "name": "Bewegung",
        "tab": "db8b9453.95a468",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "db8b9453.95a468",
        "type": "ui_tab",
        "name": "Home",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]
Bzw. direkt in der CCU mit siehe: viewtopic.php?f=26&t=75546&hilit=script

LG
Michael

holger22
Beiträge: 16
Registriert: 26.09.2022, 19:09
System: CCU

Re: Temperaturdifferenz (aus HmIP-eTRV-2) soll HmIP-PCBS schalten

Beitrag von holger22 » 26.09.2022, 22:49

@Zwenjo,
Danke Sven für den schnellen Lösungsvorschlag.
Dein Code-Vorschlag sieht sehr elegant aus. Nur sagt der Schalter dann, dass keine datapoints da sind -> so ist es bei meiner Lösung auch;-(
002.JPG
@Henke,
Michael, Das mit "payload" hatte ich ergebnislos probiert.
Dein Vorschlag hat den Schalter ausgelöst! Du hättest meine Freudensprünge sehen müssen:-)
Habe nur die Logik invertiert und gut is.

Ich werde mir Morgen beide Code-Schnipsel nochmal genauer anschauen und ein bisschen rumspielen.

Wo finde ich eigentlich den entscheidenden Hinweis, wie man den Code hier im Forum so schön einbinden kann.

mbG
Holger

Antworten

Zurück zu „RedMatic“