Skip to content

Commit

Permalink
Add driver for Gewiss 2-channel Contact Interface 230V (GWA1502)
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-danache committed Dec 22, 2024
1 parent f7846d4 commit 9d2dd00
Show file tree
Hide file tree
Showing 10 changed files with 735 additions and 26 deletions.
7 changes: 7 additions & 0 deletions ikea-zigbee-drivers/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [5.3.0] - 2024-??-??
- Add driver for Gewiss 2-channel Contact Interface 230V (GWA1502)

### Added
- Add driver for Tradfri Signal Repeater (E1746)
- E2013: Add command to manually set contact status - `@rgr`

## [5.2.0] - 2024-11-09

### Added
Expand Down
24 changes: 12 additions & 12 deletions ikea-zigbee-drivers/Gewiss_GWA1501.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import com.hubitat.zigbee.DataType
import com.hubitat.app.ChildDeviceWrapper
import com.hubitat.app.DeviceWrapper

@Field static final Map<Integer, String> GWA1501_SWITCH_STYLE = [
'00': 'Rocker / Toggle',
'01': 'Push Button',
@Field static final Map<String, String> GWA1501_BUTTON_TYPE = [
'toggle': 'Rocker / Toggle',
'push': 'Push Button',
]

// Fields for capability.HealthCheck
Expand Down Expand Up @@ -77,10 +77,10 @@ metadata {

// Inputs for devices.Gewiss_GWA1501
input(
name:'switchStyle', type:'enum', title:'Switch Style', required:true,
description:'<small>Select physical switch button configuration.</small>',
options: GWA1501_SWITCH_STYLE,
defaultValue:'00'
name:'buttonType', type:'enum', title:'Button type', required:true,
description:'<small>Select wired buttons type.</small>',
options:GWA1501_BUTTON_TYPE,
defaultValue:'toggle'
)

input(
Expand Down Expand Up @@ -117,11 +117,11 @@ List<String> updated(boolean auto = false) {
log_info "🛠️ logLevel = ${['1':'Debug', '2':'Info', '3':'Warning', '4':'Error'].get(logLevel)}"

// Preferences for devices.Gewiss_GWA1501
if (switchStyle == null) {
switchStyle = '00'
device.updateSetting 'switchStyle', [value:switchStyle, type:'enum']
if (buttonType == null) {
buttonType = 'toggle'
device.updateSetting 'buttonType', [value:buttonType, type:'enum']
}
log_info "🛠️ switchStyle = ${GWA1501_SWITCH_STYLE[switchStyle]}"
log_info "🛠️ buttonType = ${GWA1501_BUTTON_TYPE[buttonType]}"

if (enableContacts == null) {
enableContacts = false
Expand Down Expand Up @@ -366,7 +366,7 @@ void parse(String description) {

// Send button events only when the device reports any change, not on refresh
// Ignore open state for push buttons
if (msg.commandInt == 0x0A && (switchStyle != '01' || newState == 'closed')) {
if (msg.commandInt == 0x0A && (buttonType == 'toggle' || newState == 'closed')) {
List<String> button = msg.endpointInt == 0x01 ? BUTTONS.ONE : BUTTONS.TWO
utils_sendEvent name:'pushed', value:button[0], type:'physical', isStateChange:true, descriptionText:"Button ${button[0]} (${button[1]}) was pushed"
}
Expand Down
Loading

0 comments on commit 9d2dd00

Please sign in to comment.