Flow Details
Display moon phase and lunar calendar
[
{
"id": "bfb7ba9b7dfc8a5c",
"type": "group",
"z": "8e4fe7b187a24ab8",
"name": "App: Lunar",
"style": {
"label": true
},
"nodes": [
"4f2840bae56d90ef",
"453a052c518eb082",
"cb5137874720e744"
],
"x": 34,
"y": 2119,
"w": 572,
"h": 82
},
{
"id": "4f2840bae56d90ef",
"type": "inject",
"z": "8e4fe7b187a24ab8",
"g": "bfb7ba9b7dfc8a5c",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "00 00 * * *",
"once": true,
"onceDelay": "1",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 140,
"y": 2160,
"wires": [
[
"453a052c518eb082"
]
]
},
{
"id": "453a052c518eb082",
"type": "function",
"z": "8e4fe7b187a24ab8",
"g": "bfb7ba9b7dfc8a5c",
"name": "function 1",
"func": "const d = new Date();\nconst fmt = new Intl.DateTimeFormat('zh-CN-u-ca-chinese', {\n timeZone: 'Asia/Shanghai',\n month: '2-digit',\n day: '2-digit'\n});\n\nconst parts = fmt.formatToParts(d);\nvar day = 0;\nparts.forEach(p => {\n if (p.type === 'day') day = parseInt(p.value, 10) ;\n});\n\nvar icon = 962;\nif (day === 1) icon = 70075;\nelse if (day >= 2 && day <= 6) icon = 70068;\nelse if (day >= 7 && day <= 8) icon = 70069;\nelse if (day >= 9 && day <= 14) icon = 70070;\nelse if (day === 15) icon = 70071;\nelse if (day >= 16 && day <= 21) icon = 70072;\nelse if (day >= 22 && day <= 23) icon = 70073;\nelse if (day >= 24 && day <= 30) icon = 70074;\n\nmsg.payload = {\n \"text\": fmt.format(d),\n \"icon\": icon,\n };\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 290,
"y": 2160,
"wires": [
[
"cb5137874720e744"
]
]
},
{
"id": "cb5137874720e744",
"type": "mqtt out",
"z": "8e4fe7b187a24ab8",
"g": "bfb7ba9b7dfc8a5c",
"name": "",
"topic": "awtrix/custom/lunar",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "mqtt_broker",
"x": 490,
"y": 2160,
"wires": []
},
{
"id": "mqtt_broker",
"type": "mqtt-broker",
"name": "MQTT Broker",
"broker": "nas.uniqueding.xyz",
"port": "1883",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": 15,
"cleansession": true,
"autoUnsubscribe": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
}
]
-- Flow first published on August 25, 2025, last updated on August 25, 2025 at 18:50.