Skip to content

Commit

Permalink
implement new direct click mode
Browse files Browse the repository at this point in the history
  • Loading branch information
splattner committed Jun 19, 2024
1 parent 79361c4 commit 26ecf3d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
6 changes: 3 additions & 3 deletions pkg/discovery/deconz_sensor.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,15 @@ func (e *DeconzDevice) sensorWebsocketCallback(state *DeconzState) {
case ShortRelease:
log.Debugf("Deconz, Event ShortRelease for Device '%s' on Button %d\n", e.sensor.Name, button)
//e.vdcdClient.SendButtonRawMessage(vdcdapi.CT_TIP_1X, e.originDevice.Tag, 0)
e.vdcdClient.SendButtonRawMessage(vdcdapi.CT_TIP_1X, e.originDevice.Tag, 0)
e.vdcdClient.SendButtonMessage(float32(-vdcdapi.CT_DC_TIP_1X), e.originDevice.Tag, 0)

case DoublePress:
log.Debugf("Deconz, Event DoublePress for Device '%s' on Button %d\n", e.sensor.Name, button)
e.vdcdClient.SendButtonRawMessage(vdcdapi.CT_TIP_2X, e.originDevice.Tag, 0)
e.vdcdClient.SendButtonMessage(float32(-vdcdapi.CT_DC_TIP_2X), e.originDevice.Tag, 0)

case TreeplePress:
log.Debugf("Deconz, Event TreeplePress for Device '%s' on Button %d\n", e.sensor.Name, button)
e.vdcdClient.SendButtonRawMessage(vdcdapi.CT_TIP_3X, e.originDevice.Tag, 0)
e.vdcdClient.SendButtonMessage(float32(-vdcdapi.CT_DC_TIP_3X), e.originDevice.Tag, 0)

case LongRelease:
log.Debugf("Deconz, Event LongRelease for Device '%s' on Button %d\n", e.sensor.Name, button)
Expand Down
8 changes: 4 additions & 4 deletions pkg/discovery/zigbee2mqtt.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,13 +489,13 @@ func (e *Zigbee2MQTTDevice) mqttActionCallback() mqtt.MessageHandler {
e.vdcdClient.SendButtonMessage(0, e.originDevice.Tag, 0)
case "single":
case "click":
e.vdcdClient.SendButtonRawMessage(vdcdapi.CT_TIP_1X, e.originDevice.Tag, 0)
e.vdcdClient.SendButtonMessage(float32(-vdcdapi.CT_DC_TIP_1X), e.originDevice.Tag, 0)
case "double":
e.vdcdClient.SendButtonRawMessage(vdcdapi.CT_TIP_2X, e.originDevice.Tag, 0)
e.vdcdClient.SendButtonMessage(float32(-vdcdapi.CT_DC_TIP_2X), e.originDevice.Tag, 0)
case "triple":
e.vdcdClient.SendButtonRawMessage(vdcdapi.CT_TIP_3X, e.originDevice.Tag, 0)
e.vdcdClient.SendButtonMessage(float32(-vdcdapi.CT_DC_TIP_3X), e.originDevice.Tag, 0)
default:
e.vdcdClient.SendButtonRawMessage(vdcdapi.CT_TIP_1X, e.originDevice.Tag, 0)
e.vdcdClient.SendButtonMessage(float32(-vdcdapi.CT_DC_TIP_1X), e.originDevice.Tag, 0)

}

Expand Down
9 changes: 9 additions & 0 deletions pkg/vdcdapi/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,16 @@ const (
CT_SHORT_SHORT_LONG ///< short/short/long = local programming mode
CT_LOCAL_STOP ///< local stop
CT_NONE = 255 ///< no click (for state)
)

// Clicktype values for direct click
const (
CT_DC_TIP_1X ClickType = 1
CT_DC_TIP_2X ClickType = 2
CT_DC_TIP_3X ClickType = 3
CT_DC_TIP_4X ClickType = 4
CT_DC_HOLD_START ClickType = 10
CT_DC_HOLD_END ClickType = 11
)

type InitvdcMessage struct {
Expand Down

0 comments on commit 26ecf3d

Please sign in to comment.