Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDF improvement for button chords on Illumra Dual Rocker Switch (PTM215ZE Friends of Hue) #8038

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions de_web_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1711,6 +1711,12 @@ void DeRestPluginPrivate::gpProcessButtonEvent(const deCONZ::GpDataIndication &i
{
// Map the command to the mapped button and action.
// PTM215ZE Friends of Hue switch.
// Button 1 == A0 Button 3 == B0
// Button 2 == A1 Button 4 == B1
// Button 5 == A0 + B0 (chord of 1 & 3)
// Button 6 == A1 + B0 (chord of 2 & 3)
// Button 7 == A0 + B1 (chord of 1 & 4)
// Button 8 == A1 + B1 (chord of 2 & 4)
const quint32 buttonMapPTM215ZE[] = {
0x12, S_BUTTON_1, S_BUTTON_ACTION_INITIAL_PRESS,
0x13, S_BUTTON_1, S_BUTTON_ACTION_SHORT_RELEASED,
Expand All @@ -1720,6 +1726,14 @@ void DeRestPluginPrivate::gpProcessButtonEvent(const deCONZ::GpDataIndication &i
0x19, S_BUTTON_3, S_BUTTON_ACTION_SHORT_RELEASED,
0x22, S_BUTTON_4, S_BUTTON_ACTION_INITIAL_PRESS,
0x23, S_BUTTON_4, S_BUTTON_ACTION_SHORT_RELEASED,
0x1A, S_BUTTON_5, S_BUTTON_ACTION_INITIAL_PRESS,
0x1B, S_BUTTON_5, S_BUTTON_ACTION_SHORT_RELEASED,
0x1C, S_BUTTON_6, S_BUTTON_ACTION_INITIAL_PRESS,
0x1D, S_BUTTON_6, S_BUTTON_ACTION_SHORT_RELEASED,
0x1E, S_BUTTON_7, S_BUTTON_ACTION_INITIAL_PRESS,
0x1F, S_BUTTON_7, S_BUTTON_ACTION_SHORT_RELEASED,
0x62, S_BUTTON_8, S_BUTTON_ACTION_INITIAL_PRESS,
0x63, S_BUTTON_8, S_BUTTON_ACTION_SHORT_RELEASED,
0
};

Expand Down
2 changes: 1 addition & 1 deletion rest_sensors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3544,7 +3544,7 @@ void DeRestPluginPrivate::checkSensorStateTimerFired()
item = sensor->item(RStateButtonEvent);
quint32 btn = item ? static_cast<quint32>(item->toNumber()) : 0;
const quint32 action = btn & 0x03;
if (btn >= S_BUTTON_1 && btn <= S_BUTTON_6 && action == S_BUTTON_ACTION_INITIAL_PRESS)
if (btn >= S_BUTTON_1 && btn <= S_BUTTON_8 && action == S_BUTTON_ACTION_INITIAL_PRESS)
{
btn &= ~0x03;
item->setValue(btn + S_BUTTON_ACTION_HOLD);
Expand Down