Skip to content

Commit

Permalink
Fix button handlers for dresden elektronik Scene Switch (#7503)
Browse files Browse the repository at this point in the history
Regression from v2.25.0-beta.
  • Loading branch information
manup committed Dec 29, 2023
1 parent 50ccce7 commit c15905f
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
42 changes: 42 additions & 0 deletions devices/dresden_elektronik/scene_switch.json
Expand Up @@ -135,6 +135,48 @@
},
{
"name": "state/lastupdated"
},
{
"name": "state/on",
"public": false,
"parse": {
"fn": "zcl:cmd",
"ep": 1,
"cl": "0x0006",
"cmd": "any",
"script": "scene_switch_on.js"
},
"read": {
"fn": "none"
}
},
{
"name": "state/bri",
"public": false,
"parse": {
"fn": "zcl:cmd",
"ep": 1,
"cl": "0x0008",
"cmd": "any",
"script": "scene_switch_bri.js"
},
"read": {
"fn": "none"
}
},
{
"name": "state/sat",
"public": false,
"parse": {
"fn": "zcl:cmd",
"ep": 1,
"cl": "0x0005",
"cmd": "any",
"script": "scene_switch_scenes.js"
},
"read": {
"fn": "none"
}
}
]
}
Expand Down
10 changes: 10 additions & 0 deletions devices/dresden_elektronik/scene_switch_bri.js
@@ -0,0 +1,10 @@
var i = R.item("state/buttonevent");
if (ZclFrame.cmd == 1) {
if (ZclFrame.at(0) == 0)
i.val = 1001;
else
i.val = 2001;
} else if (ZclFrame.cmd == 3) {
var v = i.val >> 2;
i.val = ((v << 2) / 1000) * 1000 + 3;
}
6 changes: 6 additions & 0 deletions devices/dresden_elektronik/scene_switch_on.js
@@ -0,0 +1,6 @@
var i = R.item("state/buttonevent");
if (ZclFrame.cmd == 1) {
i.val = 1002;
} else if (ZclFrame.cmd == 0) {
i.val = 2002;
}
7 changes: 7 additions & 0 deletions devices/dresden_elektronik/scene_switch_scenes.js
@@ -0,0 +1,7 @@
var i = R.item("state/buttonevent");
var scene = ZclFrame.at(2);
if (ZclFrame.cmd == 5) {
i.val = ((scene + 2) * 1000) + 2;
} else if (ZclFrame.cmd == 4) {
i.val = ((scene + 2) * 1000) + 3;
}

0 comments on commit c15905f

Please sign in to comment.