Closed MDAR closed 2 years ago
FYI
I've managed to achieve this with Node-RED, just as a work around, making use of the Velbus node set
Group G_Restore "Restore on restart"
// Global Alarm times
Group g_Minute "Limit Alarm Minute"
Group g_Hour "Limit Alarm Hour"
Group G_Global_Alarm1 "Group for Global alarm 1"
Group G_Global_Alarm2 "Group for Global alarm 2"
Switch Global_ClockAlarm_ClockAlarm1Enabled "Global Alarm 1 Enabled" (G_Global_Alarm1,G_Restore)
Number Global_ClockAlarm_ClockAlarm1WakeupHour "Global Alarm 1 Wake Hour" (G_Global_Alarm1,G_Restore,g_Hour)
Number Global_ClockAlarm_ClockAlarm1WakeupMinute "Global Alarm 1 Wake Minute" (G_Global_Alarm1,G_Restore,g_Minute)
Number Global_ClockAlarm_ClockAlarm1BedtimeHour "Global Alarm 1 Bed Hour" (G_Global_Alarm1,G_Restore,g_Hour)
Number Global_ClockAlarm_ClockAlarm1BedtimeMinute "Global Alarm 1 Bed Minute" (G_Global_Alarm1,G_Restore,g_Minute)
Switch Global_ClockAlarm_ClockAlarm2Enabled "Global Alarm 2 Enabled" (G_Global_Alarm2,G_Restore)
Number Global_ClockAlarm_ClockAlarm2WakeupHour "Global Alarm 2 Wake Hour" (G_Global_Alarm2,G_Restore,g_Hour)
Number Global_ClockAlarm_ClockAlarm2WakeupMinute "Global Alarm 2 Wake Minute" (G_Global_Alarm2,G_Restore,g_Minute)
Number Global_ClockAlarm_ClockAlarm2BedtimeHour "Global Alarm 2 Bed Hour" (G_Global_Alarm2,G_Restore,g_Hour)
Number Global_ClockAlarm_ClockAlarm2BedtimeMinute "Global Alarm 2 Bed Minute" (G_Global_Alarm2,G_Restore,g_Minute)
This flow moves the Global values and parks them in Flow variables, then collates them into a command 30 seconds later. (Allowing for all the elements to be changed by the user, without flooding the Velbus bus with commands)
[
{
"id": "ae2a24fee70b7f64",
"type": "delay",
"z": "28cf0949.18db66",
"name": "Limit to 1 per minite",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "minute",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"allowrate": false,
"x": 850,
"y": 1420,
"wires": [
[
"fc433ab28aa15da7"
]
]
},
{
"id": "7f02a359866de0b9",
"type": "openhab2-in2",
"z": "28cf0949.18db66",
"name": "Global Alarm 1 Enable",
"controller": "c97568ad384df026",
"itemname": "Global_ClockAlarm_ClockAlarm1Enabled",
"topic": "",
"initialstate": true,
"whenupdated": true,
"whencommand": true,
"whenchanged": false,
"changedfrom": "",
"changedto": "",
"x": 260,
"y": 1280,
"wires": [
[
"be9c5cd66e19129f",
"d29d02afd6693552",
"ae2a24fee70b7f64"
]
]
},
{
"id": "dd9817c5c16dfba1",
"type": "openhab2-in2",
"z": "28cf0949.18db66",
"name": "Global Alarm 1 Wake Minute",
"controller": "c97568ad384df026",
"itemname": "Global_ClockAlarm_ClockAlarm1WakeupMinute",
"topic": "",
"initialstate": true,
"whenupdated": true,
"whencommand": true,
"whenchanged": false,
"changedfrom": "",
"changedto": "",
"x": 280,
"y": 1360,
"wires": [
[
"12e14f6e2170c4f8",
"d29d02afd6693552",
"ae2a24fee70b7f64"
]
]
},
{
"id": "ac37c18949fee70b",
"type": "openhab2-in2",
"z": "28cf0949.18db66",
"name": "Global Alarm 1 Wake Hour",
"controller": "c97568ad384df026",
"itemname": "Global_ClockAlarm_ClockAlarm1WakeupHour",
"topic": "",
"initialstate": true,
"whenupdated": true,
"whencommand": true,
"whenchanged": false,
"changedfrom": "",
"changedto": "",
"x": 270,
"y": 1420,
"wires": [
[
"f0951da20ef76392",
"d29d02afd6693552",
"ae2a24fee70b7f64"
]
]
},
{
"id": "2057231b3e8f8b44",
"type": "openhab2-in2",
"z": "28cf0949.18db66",
"name": "Global Alarm 1 Bed Minute",
"controller": "c97568ad384df026",
"itemname": "Global_ClockAlarm_ClockAlarm1BedtimeMinute",
"topic": "",
"initialstate": true,
"whenupdated": true,
"whencommand": true,
"whenchanged": false,
"changedfrom": "",
"changedto": "",
"x": 270,
"y": 1480,
"wires": [
[
"9413dc7f01088ecf",
"d29d02afd6693552",
"ae2a24fee70b7f64"
]
]
},
{
"id": "e5e877ae62465674",
"type": "openhab2-in2",
"z": "28cf0949.18db66",
"name": "Global Alarm 1 Bed Hour",
"controller": "c97568ad384df026",
"itemname": "Global_ClockAlarm_ClockAlarm1BedtimeHour",
"topic": "",
"initialstate": true,
"whenupdated": true,
"whencommand": true,
"whenchanged": false,
"changedfrom": "",
"changedto": "",
"x": 270,
"y": 1540,
"wires": [
[
"8519f150f8f94bee",
"d29d02afd6693552",
"ae2a24fee70b7f64"
]
]
},
{
"id": "fc433ab28aa15da7",
"type": "delay",
"z": "28cf0949.18db66",
"name": "",
"pauseType": "delay",
"timeout": "30",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"x": 1040,
"y": 1420,
"wires": [
[
"2847d0181437c4f2"
]
]
},
{
"id": "be9c5cd66e19129f",
"type": "debug",
"z": "28cf0949.18db66",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "payload",
"statusType": "msg",
"x": 510,
"y": 1280,
"wires": []
},
{
"id": "d29d02afd6693552",
"type": "function",
"z": "28cf0949.18db66",
"name": "Values to Flow variables",
"func": "var item = msg.item;\nvar value = msg.payload.trim('.');\nflow.set(item,value);\nreturn [null];",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 550,
"y": 1600,
"wires": [
[]
]
},
{
"id": "12e14f6e2170c4f8",
"type": "debug",
"z": "28cf0949.18db66",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "payload",
"statusType": "msg",
"x": 510,
"y": 1360,
"wires": []
},
{
"id": "f0951da20ef76392",
"type": "debug",
"z": "28cf0949.18db66",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "payload",
"statusType": "msg",
"x": 510,
"y": 1420,
"wires": []
},
{
"id": "9413dc7f01088ecf",
"type": "debug",
"z": "28cf0949.18db66",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "payload",
"statusType": "msg",
"x": 510,
"y": 1480,
"wires": []
},
{
"id": "8519f150f8f94bee",
"type": "debug",
"z": "28cf0949.18db66",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "payload",
"statusType": "msg",
"x": 510,
"y": 1540,
"wires": []
},
{
"id": "2847d0181437c4f2",
"type": "function",
"z": "28cf0949.18db66",
"name": "Compile Alarm 1",
"func": "var AlarmEnabled = flow.get(\"Global_ClockAlarm_ClockAlarm1Enabled\");\nvar AlarmWakeMinute = flow.get(\"Global_ClockAlarm_ClockAlarm1WakeupMinute\");\nvar AlarmWakeHour = flow.get(\"Global_ClockAlarm_ClockAlarm1WakeupHour\");\nvar AlarmBedMinute = flow.get(\"Global_ClockAlarm_ClockAlarm1BedtimeMinute\");\nvar AlarmBedHour = flow.get(\"Global_ClockAlarm_ClockAlarm1BedtimeHour\");\n\nvar AlarmEnabledB = 0;\n\nif (AlarmEnabled == \"ON\"){ AlarmEnabledB = 1}\nif (AlarmEnabled !== \"ON\"){ AlarmEnabledB = 0}\n\n\n// ‘Set global clock alarm’ command received:\n// SID10-SID9 = 11 (lowest priority)\n// SID8...SID1 = H’00’\n// RTR = 0\n// DLC3...DLC0 = 7 databytes to send\n// DATABYTE1 = COMMAND_SET_ALARM_CLOCK (H’C3’)\n// DATABYTE2 = Alarm number (1 or 2)\n// DATABYTE3 = Wake up hour (0…23)\n// DATABYTE4 = Wake up minute (0…59)\n// DATABYTE5 = Go to bed hour (0…23)\n// DATABYTE6 = Go to bed minute (0…59)\n// DATABYTE7 = Clock alarm enable flag (0 = disabled / 1 = enabled)\n//\n// Example 0xc3 0x01 wh wm bh bm alarmEnabled?\n\nmsg.payload = \"0xc3 0x01 \"+ AlarmWakeHour +\" \"+AlarmWakeMinute+\" \"+AlarmBedHour+\" \"+AlarmBedMinute+\" \"+AlarmEnabledB;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1280,
"y": 1420,
"wires": [
[
"a82edbc58ddefd22",
"c6d046c6e6788e66"
]
]
},
{
"id": "c1f590083ff6f84b",
"type": "openhab2-in2",
"z": "28cf0949.18db66",
"name": "Global Alarm 2 Enable",
"controller": "c97568ad384df026",
"itemname": "Global_ClockAlarm_ClockAlarm2Enabled",
"topic": "",
"initialstate": true,
"whenupdated": true,
"whencommand": true,
"whenchanged": false,
"changedfrom": "",
"changedto": "",
"x": 260,
"y": 1660,
"wires": [
[
"f34d22c8f337bd7b",
"d29d02afd6693552",
"5d468d18011ce196"
]
]
},
{
"id": "0263977a9d95d7fd",
"type": "openhab2-in2",
"z": "28cf0949.18db66",
"name": "Global Alarm 2 Wake Minute",
"controller": "c97568ad384df026",
"itemname": "Global_ClockAlarm_ClockAlarm2WakeupMinute",
"topic": "",
"initialstate": true,
"whenupdated": true,
"whencommand": true,
"whenchanged": false,
"changedfrom": "",
"changedto": "",
"x": 280,
"y": 1740,
"wires": [
[
"cee55a9abb912bf3",
"d29d02afd6693552",
"5d468d18011ce196"
]
]
},
{
"id": "b90db46ad1cc4360",
"type": "openhab2-in2",
"z": "28cf0949.18db66",
"name": "Global Alarm 2 Wake Hour",
"controller": "c97568ad384df026",
"itemname": "Global_ClockAlarm_ClockAlarm2WakeupHour",
"topic": "",
"initialstate": true,
"whenupdated": true,
"whencommand": true,
"whenchanged": false,
"changedfrom": "",
"changedto": "",
"x": 270,
"y": 1800,
"wires": [
[
"ecc6a00e6e718fa0",
"d29d02afd6693552",
"5d468d18011ce196"
]
]
},
{
"id": "0847abc38cd65db2",
"type": "openhab2-in2",
"z": "28cf0949.18db66",
"name": "Global Alarm 2 Bed Minute",
"controller": "c97568ad384df026",
"itemname": "Global_ClockAlarm_ClockAlarm2BedtimeMinute",
"topic": "",
"initialstate": true,
"whenupdated": true,
"whencommand": true,
"whenchanged": false,
"changedfrom": "",
"changedto": "",
"x": 270,
"y": 1860,
"wires": [
[
"af241db980da5ea9",
"d29d02afd6693552",
"5d468d18011ce196"
]
]
},
{
"id": "d44400ce146d57b6",
"type": "openhab2-in2",
"z": "28cf0949.18db66",
"name": "Global Alarm 2 Bed Hour",
"controller": "c97568ad384df026",
"itemname": "Global_ClockAlarm_ClockAlarm2BedtimeHour",
"topic": "",
"initialstate": true,
"whenupdated": true,
"whencommand": true,
"whenchanged": false,
"changedfrom": "",
"changedto": "",
"x": 270,
"y": 1920,
"wires": [
[
"db98153a99a8bd34",
"d29d02afd6693552",
"5d468d18011ce196"
]
]
},
{
"id": "4cc76e96ac404c74",
"type": "inject",
"z": "28cf0949.18db66",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "trigger",
"payloadType": "str",
"x": 1050,
"y": 1340,
"wires": [
[
"2847d0181437c4f2"
]
]
},
{
"id": "a82edbc58ddefd22",
"type": "debug",
"z": "28cf0949.18db66",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "payload",
"statusType": "msg",
"x": 1590,
"y": 1420,
"wires": []
},
{
"id": "c6d046c6e6788e66",
"type": "velbus-send-raw-bytes",
"z": "28cf0949.18db66",
"name": "",
"connector": "7814f66e.e42578",
"commandName": "Data bytes from msg.payload",
"dataBytes": "",
"dataBytesType": "PAYLOAD",
"address": 0,
"addressType": 0,
"priority": "251",
"rtr": 0,
"x": 1710,
"y": 1600,
"wires": []
},
{
"id": "f34d22c8f337bd7b",
"type": "debug",
"z": "28cf0949.18db66",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "payload",
"statusType": "msg",
"x": 510,
"y": 1660,
"wires": []
},
{
"id": "5d468d18011ce196",
"type": "delay",
"z": "28cf0949.18db66",
"name": "Limit to 1 per minite",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "minute",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"allowrate": false,
"x": 870,
"y": 1780,
"wires": [
[
"32a7368b8d0150af"
]
]
},
{
"id": "cee55a9abb912bf3",
"type": "debug",
"z": "28cf0949.18db66",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "payload",
"statusType": "msg",
"x": 510,
"y": 1740,
"wires": []
},
{
"id": "ecc6a00e6e718fa0",
"type": "debug",
"z": "28cf0949.18db66",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "payload",
"statusType": "msg",
"x": 510,
"y": 1800,
"wires": []
},
{
"id": "af241db980da5ea9",
"type": "debug",
"z": "28cf0949.18db66",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "payload",
"statusType": "msg",
"x": 510,
"y": 1860,
"wires": []
},
{
"id": "db98153a99a8bd34",
"type": "debug",
"z": "28cf0949.18db66",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "payload",
"statusType": "msg",
"x": 510,
"y": 1920,
"wires": []
},
{
"id": "4860ffd49c1d91a6",
"type": "function",
"z": "28cf0949.18db66",
"name": "Compile Alarm 2",
"func": "var AlarmEnabled = flow.get(\"Global_ClockAlarm_ClockAlarm2Enabled\");\nvar AlarmWakeMinute = flow.get(\"Global_ClockAlarm_ClockAlarm2WakeupMinute\");\nvar AlarmWakeHour = flow.get(\"Global_ClockAlarm_ClockAlarm2WakeupHour\");\nvar AlarmBedMinute = flow.get(\"Global_ClockAlarm_ClockAlarm2BedtimeMinute\");\nvar AlarmBedHour = flow.get(\"Global_ClockAlarm_ClockAlarm2BedtimeHour\");\n\nvar AlarmEnabledB = 0;\n\nif (AlarmEnabled == \"ON\"){ AlarmEnabledB = 1}\nif (AlarmEnabled !== \"ON\"){ AlarmEnabledB = 0}\n\n\n// ‘Set global clock alarm’ command received:\n// SID10-SID9 = 11 (lowest priority)\n// SID8...SID1 = H’00’\n// RTR = 0\n// DLC3...DLC0 = 7 databytes to send\n// DATABYTE1 = COMMAND_SET_ALARM_CLOCK (H’C3’)\n// DATABYTE2 = Alarm number (1 or 2)\n// DATABYTE3 = Wake up hour (0…23)\n// DATABYTE4 = Wake up minute (0…59)\n// DATABYTE5 = Go to bed hour (0…23)\n// DATABYTE6 = Go to bed minute (0…59)\n// DATABYTE7 = Clock alarm enable flag (0 = disabled / 1 = enabled)\n//\n// Example 0xc3 0x01 wh wm bh bm alarmEnabled?\n\nmsg.payload = \"0xc3 0x02 \"+ AlarmWakeHour +\" \"+AlarmWakeMinute+\" \"+AlarmBedHour+\" \"+AlarmBedMinute+\" \"+AlarmEnabledB;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1320,
"y": 1780,
"wires": [
[
"c6d046c6e6788e66",
"22d48cc49d86b810"
]
]
},
{
"id": "32a7368b8d0150af",
"type": "delay",
"z": "28cf0949.18db66",
"name": "",
"pauseType": "delay",
"timeout": "30",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"x": 1060,
"y": 1780,
"wires": [
[
"4860ffd49c1d91a6"
]
]
},
{
"id": "509a345156b51762",
"type": "inject",
"z": "28cf0949.18db66",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "trigger",
"payloadType": "str",
"x": 1070,
"y": 1840,
"wires": [
[
"4860ffd49c1d91a6"
]
]
},
{
"id": "22d48cc49d86b810",
"type": "debug",
"z": "28cf0949.18db66",
"name": "",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "payload",
"statusType": "msg",
"x": 1590,
"y": 1780,
"wires": []
},
{
"id": "aea982a947f56167",
"type": "comment",
"z": "28cf0949.18db66",
"name": "Set Global clock alarm",
"info": "‘Set global clock alarm’ command received:\nSID10-SID9 = 11 (lowest priority)\nSID8...SID1 = H’00’\nRTR = 0\nDLC3...DLC0 = 7 databytes to send\nDATABYTE1 = COMMAND_SET_ALARM_CLOCK (H’C3’)\nDATABYTE2 = Alarm number (1 or 2)\nDATABYTE3 = Wake up hour (0…23)\nDATABYTE4 = Wake up minute (0…59)\nDATABYTE5 = Go to bed hour (0…23)\nDATABYTE6 = Go to bed minute (0…59)\nDATABYTE7 = Clock alarm enable flag (0 = disabled / 1 = enabled)",
"x": 1060,
"y": 1240,
"wires": []
},
{
"id": "7814f66e.e42578",
"type": "velbus-connector",
"ip": "127.0.0.1",
"port": "6000"
}
]
Hi @MDAR, I've taken a look at the request. We cannot add channels to a bridge object. (OpenHAB design restriction)
The only way we could do the trick is to create a virtual clock module with the different alarms channels. And to avoid flooding the bus after each value change, add a button to push the config on the bus.
If I remove the ability to select between local and global clock, it will probably break the existing configured modules, and it will be needed to recreate all the modules with alarm channels.
@Rosen01
Hey Daniel
Thanks for looking at this.
Not to doubt you in any way, but are you sure it's not possible to add Channels to a bridge?
For example, the DMX binding has a Mute
channel for each of the Bridges.
https://www.openhab.org/addons/bindings/dmx/
Unless it's just not possible to add anything more than a Switch channel?
(What do I know???)
As you say, creating a dummy Thing is probably the best and easiest way forward.
I've created a NodeRed flow to resolve this issue currently and to prevent flooding the bus, I've built in a 30 second delay before changes are transmitted.
I'm happy to share this flow and items files if it helps
My fault, I put the info at the wrong place in the XML thing-types file.
I will take a look when I've more time ;-)
🙂
Thanks a million.
There's no rush at all.
Hi @MDAR
I've done the modification. On my installation it works. Can you test it on yours ?
Amazing.
I'll give it a test drive and let you know how I get on.
Hi @MDAR
I've done the modification. On my installation it works. Can you test it on yours ?
That's great.
Other than a minor issue the first first time I used it, where I only changed the minute value of one part, which set the minute correctly but appears to use 3 other generic values for remaining.
So once I had set all four values for each alarm group, it works perfectly. (I had a similar issue with my Node-RED solution)
One tiny observation, does it need the AlarmType items?
Yes, but this problem is present in the current official binding too ;-) The 5 values (enable, wakeup hour, wakeup minute, bedtime hour, bedtime minute) that represents an alarm are stored in an object class, the values are only updated when there's a change in the UI. I havent found a way to solve this.
For the AlarmType items, nop it's not needed, now this channel is readonly. I let it to be still compatible with old implementation. Now It reflect only the way the alarms was set, local or global.
@Rosen01 : can we close this issue now ?
@lolodomo : Yes, the solution implemented in #12390 answer this issue.
Hi
I'm seeing strange behaviour when using the alarm setting via each Thing, especially as there is the strange behaviour between Local and Global modes.
Is it possible to add a set of Set Global Clock Alarm channels to the Velbus Bridge/s?
This might resolve the issue I'm seeing where modules are dropping out of Global mode.
We could even look at removing the ability to set Global alarm times via module Things (limit alarm time setting to Local only and switching between Global and Local mode)
@Rosen01 @cedricboon Many thanks for all your efforts.