Bonjour,
Voici un flow node-red pour injecter la position du soleil dans Gladys via Node-red (azimuth et altitude)
[
{
"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": ""
}
]
Cela donnera un flow qui ressemble à cela
ensuite dans Gladys créez un device comme suit
et une scène comme suit
Voila il est maintenant possible de créer un événement en fonction de la position du soleil dans Gladys comme par exemple ouvrir ou fermer les volets selon leur orientation pour chauffer ou rafraichir la pièce
Il faudra personnaliser votre localisation GPS ici
Il faut également avoir installé via « Manage palette »
le module « node-red-contrib-sun-position » via l’onglet « install »
La fréquence d’injection mqtt est défini dans le node « inject enhanced » ici 10mn (et qui définit l’intervalle entre le lever et le coucher de soleil !)
Voila, j’espère que cela dépannera certains, c’est vrai que le couple Gladys Node-red solutionne bien des manques en attendant que les dévs adéquats soient implémentés !
Bien sur en attendant que cette fonctionnalité soit de base dans Gladys !