Skip to content

DDF for Siglis zigfred uno and zigfred plus smart in-wall switches#6282

Merged
manup merged 4 commits into
dresden-elektronik:masterfrom
Atokulus:pr/6280
Sep 7, 2022
Merged

DDF for Siglis zigfred uno and zigfred plus smart in-wall switches#6282
manup merged 4 commits into
dresden-elektronik:masterfrom
Atokulus:pr/6280

Conversation

@Atokulus

Copy link
Copy Markdown
Contributor

Initial support for zigfred uno and zigfred plus smart in-wall switches by Siglis.

This pull request builds upon and supersedes pull request GH-6280 and #6258

Many thanks go to @WhistleMaster and @Smanar for the initial code.

Best regards
Markus, Team zigfred

WM and others added 4 commits August 21, 2022 10:03
Initial support for Siglis zigfred_uno device made with @Smanar.
… for realtime state change tracking while reducing network traffic.
@manup

manup commented Sep 6, 2022

Copy link
Copy Markdown
Member

I did a little test with my zigfred uno, it joined right away and the DDF was picked up. Cool that the color LED can be controlled with its own endpoint :) The button event cluster 0xFC42 was available after updating the switch from version 26 to version 29 via the app.

The events x000, x001 and x003 are emitted for buttons 100x – 400x once they are all configured in the app.
Instead of x000 (initial press) you may consider using x002 for short press?

@f0b04707

f0b04707 commented Sep 6, 2022

Copy link
Copy Markdown
Contributor

The x002 is already used for the double press event if I'm not wrong :)

@manup

manup commented Sep 7, 2022

Copy link
Copy Markdown
Member

Not quite, the x002 is short released and x0004 is double press, the values were originally derived from the first Hue dimmer switch and have been extended over time. For a quick ref the sensor.h header has the defines for the last digit / action:

// Sensor State
#define INVALID_ENDPOINT 0xff
#define SENSOR_CHECK_COUNTER_INIT 10
#define S_BUTTON_ACTION_INITIAL_PRESS 0
#define S_BUTTON_ACTION_HOLD 1
#define S_BUTTON_ACTION_SHORT_RELEASED 2
#define S_BUTTON_ACTION_LONG_RELEASED 3
#define S_BUTTON_ACTION_DOUBLE_PRESS 4
#define S_BUTTON_ACTION_TREBLE_PRESS 5
#define S_BUTTON_ACTION_QUADRUPLE_PRESS 6
#define S_BUTTON_ACTION_SHAKE 7
#define S_BUTTON_ACTION_DROP 8
#define S_BUTTON_ACTION_TILT 9
#define S_BUTTON_ACTION_MANY_PRESS 10

@f0b04707

f0b04707 commented Sep 7, 2022

Copy link
Copy Markdown
Contributor

In Deconz indeed but I meant for the device itself. According to @Atokulus, the button state is encoded in the following way:

typedef enum {
  BUTTON_RELEASE = 0x00,
  BUTTON_CLICK = 0x01,
  BUTTON_DOUBLE = 0x02,
  BUTTON_HOLD = 0x03,
} zf_button_state_t;

See here.

@Smanar

Smanar commented Sep 7, 2022

Copy link
Copy Markdown
Collaborator

Ha yes, lol, haven't see that, but the "deconz rule" are here too https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Supported-Devices#events-legend

Perhaps

const eventLookup = [
  0x03, // 0x00 -> Long Release (equivalent to button hold release in zigfred terminology)
  0x02, // 0x01 -> Short Release (equivalent to button click in zigfred terminology)
  0x04, // 0x02 -> Double Press (equivalent to button double click in zigfred terminology)
  0x01, // 0x03 -> Hold (0x01)
];

@f0b04707

f0b04707 commented Sep 7, 2022

Copy link
Copy Markdown
Contributor

That means that a mapping should be done in the DDF.

Is that something that could be done easily in the eval: part of the DDF ?

@Smanar

Smanar commented Sep 7, 2022

Copy link
Copy Markdown
Collaborator

Yes ofc, it the place to do that, for this device all the "magic" is done in the DDF for the mapping.

"eval": "const eventLookup = [0x03, 0x02, 0x04, 0x01]; Item.val = (ZclFrame.at(0)+1) * 1000 + eventLookup[ZclFrame.at(1)]"

@manup

manup commented Sep 7, 2022

Copy link
Copy Markdown
Member

Yes ofc, it the place to do that, for this device all the "magic" is done in the DDF for the mapping.

"eval": "const eventLookup = [0x03, 0x02, 0x04, 0x01]; Item.val = (ZclFrame.at(0)+1) * 1000 + eventLookup[ZclFrame.at(1)]"

I can confirm with this the expected x002 events are emitted.

@manup
manup merged commit 0cb0223 into dresden-elektronik:master Sep 7, 2022
@manup manup added this to the v2.18.1-beta milestone Sep 7, 2022
@manup

manup commented Sep 7, 2022

Copy link
Copy Markdown
Member

I've merged the PR and adapted the x002 events in 4464fe8

@manup manup changed the title Initial support for zigfred uno and zigfred plus smart in-wall switches by Siglis DDF for Siglis zigfred uno and zigfred plus smart in-wall switches Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants