Mini-Tutorial Sun-Position Node-Red Mqtt zur Steuerung der Rollläden in Abhängigkeit von der Sonnenposition und den Monaten

Hallo,

Hier ist ein Node-Red-Flow, um die Sonnenposition (Azimut und Höhe) in Gladys über Node-Red zu injizieren

[
    {
        "id": "dbd46647b51191ed",
        "type": "tab",
        "label": "Sun-Position",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "a0d0e562.7ad1d8",
        "type": "debug",
        "z": "dbd46647b51191ed",
        "name": "debug 1",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 720,
        "y": 180,
        "wires": []
    },
    {
        "id": "9cc2d51.4ac0828",
        "type": "change",
        "z": "dbd46647b51191ed",
        "name": "azimuth",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.azimuth",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "gladys/master/device/mqtt:soleil/feature/mqtt:azimuth/state",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 720,
        "y": 240,
        "wires": [
            [
                "0a17f9d94c9dae35",
                "ddf8b5e66052a4dc"
            ]
        ]
    },
    {
        "id": "28e91.9d63d16f6",
        "type": "change",
        "z": "dbd46647b51191ed",
        "name": "altitude",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.altitude",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "gladys/master/device/mqtt:soleil/feature/mqtt:altitude/state",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 720,
        "y": 320,
        "wires": [
            [
                "ae57174554627c71",
                "58367a9aedab25dc"
            ]
        ]
    },
    {
        "id": "e921e01a.a0fa3",
        "type": "debug",
        "z": "dbd46647b51191ed",
        "name": "debug 4",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 720,
        "y": 380,
        "wires": []
    },
    {
        "id": "e866e950.a7f798",
        "type": "debug",
        "z": "dbd46647b51191ed",
        "name": "debug 3",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 1140,
        "y": 180,
        "wires": []
    },
    {
        "id": "5b085e1b.4ec8a",
        "type": "debug",
        "z": "dbd46647b51191ed",
        "name": "debug 6",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 1140,
        "y": 380,
        "wires": []
    },
    {
        "id": "56265aeb.99f034",
        "type": "sun-position",
        "z": "dbd46647b51191ed",
        "name": "",
        "positionConfig": "2831ba70.55a636",
        "rules": [
            {
                "valueLow": "0",
                "valueLowType": "num",
                "valueHigh": "360",
                "valueHighType": "num"
            }
        ],
        "onlyOnChange": "true",
        "topic": "",
        "outputs": 2,
        "start": "sunsetStart",
        "startType": "pdsTime",
        "startOffset": 0,
        "startOffsetType": "num",
        "startOffsetMultiplier": 60000,
        "end": "sunriseEnd",
        "endType": "pdsTime",
        "endOffset": 0,
        "endOffsetType": "num",
        "endOffsetMultiplier": 60000,
        "x": 470,
        "y": 280,
        "wires": [
            [
                "a0d0e562.7ad1d8",
                "9cc2d51.4ac0828",
                "28e91.9d63d16f6"
            ],
            [
                "e921e01a.a0fa3"
            ]
        ]
    },
    {
        "id": "8eee70dd77c1369c",
        "type": "mqtt out",
        "z": "dbd46647b51191ed",
        "name": "",
        "topic": "",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "3c3eb52d.9fb296",
        "x": 1130,
        "y": 280,
        "wires": []
    },
    {
        "id": "0a17f9d94c9dae35",
        "type": "function",
        "z": "dbd46647b51191ed",
        "name": "arrondi entier",
        "func": "msg.payload = Math.round(msg.payload)\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 940,
        "y": 240,
        "wires": [
            [
                "8eee70dd77c1369c",
                "e866e950.a7f798"
            ]
        ]
    },
    {
        "id": "ddf8b5e66052a4dc",
        "type": "debug",
        "z": "dbd46647b51191ed",
        "name": "debug 2",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 920,
        "y": 180,
        "wires": []
    },
    {
        "id": "ae57174554627c71",
        "type": "function",
        "z": "dbd46647b51191ed",
        "name": "arrondi entier",
        "func": "msg.payload = Math.round(msg.payload)\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 940,
        "y": 320,
        "wires": [
            [
                "5b085e1b.4ec8a",
                "8eee70dd77c1369c"
            ]
        ]
    },
    {
        "id": "58367a9aedab25dc",
        "type": "debug",
        "z": "dbd46647b51191ed",
        "name": "debug 5",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 920,
        "y": 380,
        "wires": []
    },
    {
        "id": "664b1852987e09be",
        "type": "time-inject",
        "z": "dbd46647b51191ed",
        "name": "Période et Intervalle d'injection .",
        "nameInt": "¹sunrise start - sunset end = timestamp ↻10min",
        "positionConfig": "2831ba70.55a636",
        "props": [
            {
                "p": "",
                "pt": "msgPayload",
                "v": "",
                "vt": "date",
                "o": "",
                "oT": "none",
                "oM": "60000",
                "f": 0,
                "fS": 0,
                "fT": "UNIX timestamp (ms)",
                "fI": "0",
                "next": true,
                "days": "*",
                "months": "*",
                "onlyOddDays": false,
                "onlyEvenDays": false,
                "onlyOddWeeks": false,
                "onlyEvenWeeks": false
            },
            {
                "p": "",
                "pt": "msgTopic",
                "v": "",
                "vt": "str",
                "o": "",
                "oT": "none",
                "oM": "60000",
                "f": 0,
                "fS": 0,
                "fT": "UNIX timestamp (ms)",
                "fI": "0",
                "next": false,
                "days": "*",
                "months": "*",
                "onlyOddDays": false,,
                "onlyEvenDays": false,
                "onlyOddWeeks": false,
                "onlyEvenWeeks": false
            }
        ],
        "injectTypeSelect": "interval-time",
        "intervalCount": "10",
        "intervalCountType": "num",
        "intervalCountMultiplier": 60000,
        "cron": "",
        "cronType": "cronexpr",
        "time": "sunriseStart",
        "timeType": "pdsTime",
        "offset": 0,
        "offsetType": "none",
        "offsetMultiplier": 60000,
        "timeEnd": "sunsetEnd",
        "timeEndType": "pdsTime",
        "timeEndOffset": 0,
        "timeEndOffsetType": "none",
        "timeEndOffsetMultiplier": 60000,
        "timeDays": "*",
        "timeOnlyOddDays": false,
        "timeOnlyEvenDays": false,
        "timeOnlyOddWeeks": false,
        "timeOnlyEvenWeeks": false,
        "timeMonths": "*",
        "timedatestart": "",
        "timedateend": "",
        "property": "",
        "propertyType": "none",
        "propertyCompare": "true",
        "propertyThreshold": "",
        "propertyThresholdType": "num",
        "timeAlt": "",
        "timeAltType": "entered",
        "timeAltDays": "*",
        "timeAltOnlyOddDays": false,
        "timeAltOnlyEvenDays": false,
        "timeAltOnlyOddWeeks": false,
        "timeAltOnlyEvenWeeks": false,
        "timeAltMonths": "*",
        "timeAltOffset": 0,
        "timeAltOffsetType": "none",
        "timeAltOffsetMultiplier": 60000,
        "once": true,
        "onceDelay": 0.1,
        "recalcTime": 2,
        "x": 220,
        "y": 280,
        "wires": [
            [
                "56265aeb.99f034"
            ]
        ]
    },
    {
        "id": "2831ba70.55a636",
        "type": "position-config",
        "name": "Maison",
        "isValide": "true",
        "angleType": "deg",
        "timeZoneOffset": "99",
        "timeZoneDST": "0",
        "stateTimeFormat": "3",
        "stateDateFormat": "12",
        "contextStore": ""
    },
    {
        "id": "3c3eb52d.9fb296",
        "type": "mqtt-broker",
        "name": "MQTT Broker",
        "broker": "localhost",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "compatmode": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    }
]

Das ergibt einen Flow, der so aussieht

Dann in Gladys ein Gerät wie folgt erstellen

et eine Szene wie folgt

Fertig, jetzt ist es möglich, in Gladys ein Ereignis basierend auf der Sonnenposition zu erstellen, z. B. Jalousien zu öffnen oder zu schließen, je nach Ausrichtung, um den Raum zu heizen oder zu kühlen

Sie müssen Ihre GPS-Lokalisierung hier personalisieren

image

Sie müssen auch über « Manage palette » installiert haben

Das Modul « node-red-contrib-sun-position » über die Registerkarte « install »

Die MQTT-Injektionsfrequenz ist im « inject enhanced »-Node definiert, hier 10 Minuten (und definiert das Intervall zwischen Sonnenaufgang und Sonnenuntergang!)

image

Fertig, ich hoffe, das hilft einigen, es ist wahr, dass die Gladys Node-red-Lösung viele Lücken füllt, bis die entsprechenden Entwickler implementiert sind! :wink:
Natürlich, bis diese Funktion standardmäßig in Gladys verfügbar ist! :crazy_face:

Super toll !!! Vielen Dank @cce66 :wink:
Perfekt für meine Rollläden !!!

Hallo @guim31,

Ich habe den Ablauf geändert und « inject enhanced » verwendet, das funktioniert (« trigger » nicht) und hat den Vorteil, dass es zwischen Sonnenauf- und -untergang parametriert werden kann!
Ich werde sehen, ob ich in Node-RED zusätzliche Knoten erstellen kann, um die MQTT-Ausgabe basierend auf den Parametern der Jalousien (Ausrichtung) zu parametrieren und warum nicht auch die Auf- und Abwärtsbefehle der Jalousien-Elemente in Gladys!
Das sollte folgendes ergeben

Wenn der Azimut zwischen dem minimalen Jalousie-X-Azimutwert und dem maximalen Jalousie-X-Azimutwert liegt, dann
Wenn die Höhe zwischen dem minimalen Jalousie-X-Höhenwert und dem maximalen Jalousie-X-Höhenwert liegt, dann
Wenn Wintermonat = wahr ist, dann
MQTT-Senden: Jalousie X zu 100% öffnen
Wenn Sommermonat = wahr ist, dann
MQTT-Senden: Jalousie X zu 100% schließen
Sonst
MQTT-Senden: Jalousie X zu 50% öffnen

Das sollte den Mangel vollständig abdecken und erhebliche Energieeinsparungen ermöglichen

Anschließend werde ich ein weiteres Mini-Tutorial erstellen, aber um Gladys, Node-Red, MQTT und meine Jalousie-X-4VR-Module, die an meinen IPX800 V5 GCE gekoppelt sind, zu koppeln
https://www.gce-electronics.com/fr/carte-relais-ethernet-module-rail-din/1097-ipx800-v4-extension-4-volets-roulants-x-4vr-3760309690094.html

Aber ich habe etwas mehr Arbeit, da die MQTT-Aufrufe geändert werden mussten, da das Mini-Tutorial, das ich erstellt habe, nicht mehr funktioniert (zumindest bei mir :! :slight_smile: )

Hier ist der angepasste Flow zur Steuerung der MQTT-Jalousien in Gladys gemäß der Sonnenposition und den Monaten über Node-Red :blush:
Der Flow muss in Node-Red importiert und angepasst werden (MQTT-Kennung und geografische Position wie weiter oben in den Nachrichten gesehen).

[
    {
        "id": "dbd46647b51191ed",
        "type": "tab",
        "label": "Sun-Position",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "a0d0e562.7ad1d8",
        "type": "debug",
        "z": "dbd46647b51191ed",
        "name": "debug 1",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 580,
        "y": 240,
        "wires": []
    },
    {
        "id": "9cc2d51.4ac0828",
        "type": "change",
        "z": "dbd46647b51191ed",
        "name": "azimuth",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.azimuth",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 580,
        "y": 300,
        "wires": [
            [
                "0a17f9d94c9dae35",
                "ddf8b5e66052a4dc"
            ]
        ]
    },
    {
        "id": "28e91.9d63d16f6",
        "type": "change",
        "z": "dbd46647b51191ed",
        "name": "altitude  .",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.altitude",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 580,
        "y": 520,
        "wires": [
            [
                "ae57174554627c71",
                "5b085e1b.4ec8a"
            ]
        ]
    },
    {
        "id": "e921e01a.a0fa3",
        "type": "debug",
        "z": "dbd46647b51191ed",
        "name": "payload",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 1520,
        "y": 440,
        "wires": []
    },
    {
        "id": "e866e950.a7f798",
        "type": "debug",
        "z": "dbd46647b51191ed",
        "name": "payload",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "msg",
        "x": 1080,
        "y": 220,
        "wires": []
    },
    {
        "id": "5b085e1b.4ec8a",
        "type": "debug",
        "z": "dbd46647b51191ed",
        "name": "payload",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 760,
        "y": 580,
        "wires": []
    },
    {
        "id": "56265aeb.99f034",
        "type": "sun-position",
        "z": "dbd46647b51191ed",
        "name": "",
        "positionConfig": "2831ba70.55a636",
        "rules": [
            {
                "valueLow": "0",
                "valueLowType": "num",
                "valueHigh": "360",
                "valueHighType": "num"
            }
        ],
        "onlyOnChange": "true",
        "topic": "",
        "outputs": 2,
        "start": "sunsetStart",
        "startType": "pdsTime",
        "startOffset": 0,
        "startOffsetType": "num",
        "startOffsetMultiplier": 60000,
        "end": "sunriseEnd",
        "endType": "pdsTime",
        "endOffset": 0,
        "endOffsetType": "num",
        "endOffsetMultiplier": 60000,
        "x": 370,
        "y": 400,
        "wires": [
            [
                "a0d0e562.7ad1d8",
                "9cc2d51.4ac0828",
                "28e91.9d63d16f6"
            ],
            [
                "58367a9aedab25dc"
            ]
        ]
    },
    {
        "id": "8eee70dd77c1369c",
        "type": "mqtt out",
        "z": "dbd46647b51191ed",
        "name": "",
        "topic": "",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "3c3eb52d.9fb296",
        "x": 1330,
        "y": 400,
        "wires": []
    },
    {
        "id": "0a17f9d94c9dae35",
        "type": "function",
        "z": "dbd46647b51191ed",
        "name": "azimuth arrondi entier",
        "func": "/*  Affecte à la variable varAzimuth la valeur arrondie de Azimuth de sun-position */\nlet varflowAzimuth = Math.round(msg.payload);\n\n/*  Affecte à la variable globale varContextAzimuth la valeur de varAzimuth */\nflow.set(\"varFlowAzimuth\", varflowAzimuth);\n\n/* affecte le topic et payload de msg*/\nmsg.topic = \"gladys/master/device/mqtt:soleil/feature/mqtt:azimuth/state\";\nmsg.payload = varflowAzimuth;\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 800,
        "y": 300,
        "wires": [
            [
                "e866e950.a7f798",
                "b81561e463751087",
                "d1588b32167b06a7",
                "c4f9d7b9c239cb40",
                "d2c0c56b22042616"
            ]
        ]
    },
    {
        "id": "ddf8b5e66052a4dc",
        "type": "debug",
        "z": "dbd46647b51191ed",
        "name": "payload",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 760,
        "y": 240,
        "wires": []
    },
    {
        "id": "ae57174554627c71",
        "type": "function",
        "z": "dbd46647b51191ed",
        "name": "altitude arrondi entier",
        "func": "/*  Affecte à la variable varAltitude la valeur arrondie de Altitude de sun-position */\nlet varFlowAltitude = Math.round(msg.payload);\n\n/*  Affecte à la variable globale varContextAltitude la valeur de varAltitude */\nflow.set(\"varFlowAltitude\", varFlowAltitude);\n\n/* affecte le topic et payload de msg*/\nmsg.topic = \"gladys/master/device/mqtt:soleil/feature/mqtt:altitude/state\";\nmsg.payload = varFlowAltitude;\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 800,
        "y": 520,
        "wires": [
            [
                "7999acaff2c5f870",
                "b81561e463751087",
                "d1588b32167b06a7",
                "c4f9d7b9c239cb40",
                "8ea45d375a4adde2"
            ]
        ]
    },
    {
        "id": "58367a9aedab25dc",
        "type": "debug",
        "z": "dbd46647b51191ed",
        "name": "debug 5",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 580,
        "y": 580,
        "wires": []
    },
    {
        "id": "664b1852987e09be",
        "type": "time-inject",
        "z": "dbd46647b51191ed",
        "name": "Période et Intervalle d'injection .",
        "nameInt": "¹sunrise start - sunset end = timestamp ↻10min",
        "positionConfig": "2831ba70.55a636",
        "props": [
            {
                "p": "",
                "pt": "msgPayload",
                "v": "",
                "vt": "date",
                "o": "",
                "oT": "none",
                "oM": "60000",
                "f": 0,
                "fS": 0,
                "fT": "UNIX timestamp (ms)",
                "fI": "0",
                "next": true,
                "days": "*",
                "months": "*",
                "onlyOddDays": false,
                "onlyEvenDays": false,
                "onlyOddWeeks": false,
                "onlyEvenWeeks": false
            },
            {
                "p": "",
                "pt": "msgTopic",
                "v": "",
                "vt": "str",
                "o": "",
                "oT": "none",
                "oM": "60000",
                "f": 0,
                "fS": 0,
                "fT": "UNIX-Zeitstempel (ms)",
                "fI": "0",
                "next": false,
                "days": "*",
                "months": "*",
                "onlyOddDays": false,
                "onlyEvenDays": false,
                "onlyOddWeeks": false,
                "onlyEvenWeeks": false
            }
        ],
        "injectTypeSelect": "interval-time",
        "intervalCount": "10",
        "intervalCountType": "num",
        "intervalCountMultiplier": 60000,
        "cron": "",
        "cronType": "cronexpr",
        "time": "sunriseStart",
        "timeType": "pdsTime",
        "offset": 0,
        "offsetType": "none",
        "offsetMultiplier": 60000,
        "timeEnd": "sunsetEnd",
        "timeEndType": "pdsTime",
        "timeEndOffset": 0,
        "timeEndOffsetType": "none",
        "timeEndOffsetMultiplier": 60000,
        "timeDays": "*",
        "timeOnlyOddDays": false,
        "timeOnlyEvenDays": false,
        "timeOnlyOddWeeks": false,
        "timeOnlyEvenWeeks": false,
        "timeMonths": "*",
        "timedatestart": "",
        "timedateend": "",
        "property": "",
        "propertyType": "none",
        "propertyCompare": "true",
        "propertyThreshold": "",
        "propertyThresholdType": "num",
        "timeAlt": "",
        "timeAltType": "entered",
        "timeAltDays": "*",
        "timeAltOnlyOddDays": false,
        "timeAltOnlyEvenDays": false,
        "timeAltOnlyOddWeeks": false,
        "timeAltOnlyEvenWeeks": false,
        "timeAltMonths": "*",
        "timeAltOffset": 0,
        "timeAltOffsetType": "none",
        "timeAltOffsetMultiplier": 60000,
        "once": true,
        "onceDelay": 0.1,
        "recalcTime": 2,
        "x": 160,
        "y": 400,
        "wires": [
            [
                "56265aeb.99f034"
            ]
        ]
    },
    {
        "id": "b81561e463751087",
        "type": "function",
        "z": "dbd46647b51191ed",
        "name": "Jalousie 1 - öffnet Az 55 bis 230 / Alt 20 bis 90",
        "func": "let varAltitude = flow.get(\"varFlowAltitude\");\nlet varAzimuth  = flow.get(\"varFlowAzimuth\");\n\n/* definiert die Position der Jalousie */\nlet varAzimuthMinVoletOuvre = 55;\nlet varAzimuthMaxVoletOuvre = 230;\nlet varAltitudeMinVoletOuvre = 20;\nlet varAltitudeMaxVoletOuvre = 90;\n\n/* weist das Topic dem MQTT der Jalousie zu, die in Gladys erstellt und definiert wurde */\nmsg.topic = \"gladys/master/device/mqtt:volet1/feature/mqtt:volet1/state\";\n\n\n/* Holt die Monatsnummer */\nvar dateGlobale = new Date();\nvar noMois = dateGlobale.getUTCMonth() + 1;\n\nmsg.payload = \"0\";\nif (varAzimuth > varAzimuthMinVoletOuvre && varAzimuth < varAzimuthMaxVoletOuvre) {\n  if (varAltitude > varAltitudeMinVoletOuvre && varAltitude < varAltitudeMaxVoletOuvre) {\n    /* öffnet oder schließt die Jalousie je nach Jahreszeit und Ausrichtung der Jalousie (Nord, Süd usw.) */\n    if (noMois > 4 && noMois < 10) {\n         /* hier von April bis Oktober ist die Jalousie zu 100% geöffnet */\n         msg.payload = \"100\";\n       } else {\n         /* hier von November bis März ist die Jalousie zu 0% geöffnet */\n         msg.payload = \"0\";\n    }\n  }\n}\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1190,
        "y": 300,
        "wires": [
            [
                "8eee70dd77c1369c",
                "e921e01a.a0fa3",
                "98dff73cf45fc459"
            ]
        ]
    },
    {
        "id": "d1588b32167b06a7",
        "type": "function",
        "z": "dbd46647b51191ed",
        "name": "Jalousie 2 - öffnet Az 75 bis 180 / Alt 20 bis 90",
        "func": "let varAltitude = flow.get(\"varFlowAltitude\");\nlet varAzimuth = flow.get(\"varFlowAzimuth\");\n\nlet varAzimuthMinVoletOuvre = 75;\nlet varAzimuthMaxVoletOuvre = 180;\nlet varAltitudeMinVoletOuvre = 20;\nlet varAltitudeMaxVoletOuvre = 90;\n\nmsg.topic = \"gladys/master/device/mqtt:volet2/feature/mqtt:volet2/state\";\n\n/* Holt die Monatsnummer */\nvar dateGlobale = new Date();\nvar noMois = dateGlobale.getUTCMonth() + 1;\n\nmsg.payload = \"0\";\nif (varAzimuth > varAzimuthMinVoletOuvre && varAzimuth < varAzimuthMaxVoletOuvre) {\n  if (varAltitude > varAltitudeMinVoletOuvre && varAltitude < varAltitudeMaxVoletOuvre) {\n    /* öffnet oder schließt die Jalousie je nach Jahreszeit und Ausrichtung der Jalousie (Nord, Süd usw.) */\n    if (noMois > 4 && noMois < 10) {\n      /* hier von April bis Oktober ist die Jalousie zu 100% geöffnet */\n      msg.payload = \"100\";\n    } else {\n      /* hier von November bis März ist die Jalousie zu 0% geöffnet */\n      msg.payload = \"0\";\n    }\n  }\n}\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1190,
        "y": 520,
        "wires": [
            [
                "8eee70dd77c1369c",
                "e921e01a.a0fa3",
                "98dff73cf45fc459"
            ]
        ]
    },
    {
        "id": "7999acaff2c5f870",
        "type": "debug",
        "z": "dbd46647b51191ed",
        "name": "payload",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "msg",
        "x": 1080,
        "y": 640,
        "wires": []
    },
    {
        "id": "c4f9d7b9c239cb40",
        "type": "mqtt out",
        "z": "dbd46647b51191ed",
        "name": "",
        "topic": "",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "3c3eb52d.9fb296",
        "x": 890,
        "y": 400,
        "wires": []
    },
    {
        "id": "d2c0c56b22042616",
        "type": "debug",
        "z": "dbd46647b51191ed",
        "name": "topic",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "topic",
        "targetType": "msg",
        "statusVal": "topic",
        "statusType": "msg",
        "x": 1070,
        "y": 160,
        "wires": []
    },
    {
        "id": "8ea45d375a4adde2",
        "type": "debug",
        "z": "dbd46647b51191ed",
        "name": "topic",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "topic",
        "targetType": "msg",
        "statusVal": "topic",
        "statusType": "msg",
        "x": 1070,
        "y": 580,
        "wires": []
    },
    {
        "id": "98dff73cf45fc459",
        "type": "debug",
        "z": "dbd46647b51191ed",
        "name": "topic",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "topic",
        "targetType": "msg",
        "statusVal": "topic",
        "statusType": "msg",
        "x": 1510,
        "y": 360,
        "wires": []
    },
    {
        "id": "2831ba70.55a636",
        "type": "position-config",
        "name": "Haus",
        "isValide": "true",
        "angleType": "deg",
        "timeZoneOffset": "99",
        "timeZoneDST": "0",
        "stateTimeFormat": "3",
        "stateDateFormat": "12",
        "contextStore": ""
    },
    {
        "id": "3c3eb52d.9fb296",
        "type": "mqtt-broker",
        "name": "MQTT-Broker Gladys",
        "broker": "192.168.0.125",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "compatmode": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    }
]

das grafische Ergebnis des Flows

erstellung der Rollladenobjekte in mqtt

die Anzeige der Rollladenposition in einem Rollladendashboard, das auch die Azimut- und Höhenwerte anzeigt (wiederverwendbar in den Gladys-Szenarien)

die Rollladenkonfiguration erfolgt im Code (oder in den Gladys-Szenarien!)

image

Das war’s! Jetzt muss es nur noch an eure Konfigurationen angepasst werden! :wink: