Skip to content

Commit

Permalink
Add Lutron LZL-4B-WH-L01 (wip)
Browse files Browse the repository at this point in the history
Issue #232
  • Loading branch information
manup committed Feb 16, 2018
1 parent 9fa75ae commit ca38100
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
11 changes: 11 additions & 0 deletions de_web_plugin.cpp
Expand Up @@ -74,6 +74,7 @@ const quint64 osramMacPrefix = 0x8418260000000000ULL;
const quint64 ubisysMacPrefix = 0x001fee0000000000ULL;
const quint64 netvoxMacPrefix = 0x00137a0000000000ULL;
const quint64 heimanMacPrefix = 0x0050430000000000ULL;
const quint64 lutronMacPrefix = 0xffff000000000000ULL;

struct SupportedDevice {
quint16 vendorId;
Expand Down Expand Up @@ -131,6 +132,7 @@ static const SupportedDevice supportedDevices[] = {
{ VENDOR_OSRAM_STACK, "SMOK_V16", heimanMacPrefix }, // Heiman fire sensor
{ VENDOR_OSRAM_STACK, "WATER_TPV11", heimanMacPrefix }, // Heiman water sensor
{ VENDOR_120B, "WarningDevice", emberMacPrefix }, // Heiman siren
{ VENDOR_LUTRON, "LZL4BWHL01", lutronMacPrefix }, // Lutron LZL-4B-WH-L01 Connected Bulb Remote
{ 0, 0, 0 }
};

Expand Down Expand Up @@ -3263,6 +3265,15 @@ void DeRestPluginPrivate::addSensorNode(const deCONZ::Node *node, const SensorFi
{
sensorNode.setManufacturer("Heiman");
}
else if (node->nodeDescriptor().manufacturerCode() == VENDOR_LUTRON)
{
sensorNode.setManufacturer("Lutron");

if (modelId.startsWith(QLatin1String("LZL4BWHL")))
{
sensorNode.setMode(Sensor::ModeDimmer);
}
}

if (sensorNode.manufacturer().isEmpty() && !manufacturer.isEmpty())
{
Expand Down
11 changes: 8 additions & 3 deletions de_web_plugin_private.h
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017 dresden elektronik ingenieurtechnik gmbh.
* Copyright (c) 2017-2018 dresden elektronik ingenieurtechnik gmbh.
* All rights reserved.
*
* The software in this package is published under the terms of the BSD
Expand Down Expand Up @@ -203,10 +203,12 @@
#define WRITE_USERTEST (1 << 16)

// manufacturer codes
// http://cgit.osmocom.org/wireshark/plain/epan/dissectors/packet-zbee.h
#define VENDOR_NONE 0x0000
#define VENDOR_ATMEL 0x1014
#define VENDOR_JENNIC 0x1037
#define VENDOR_DDEL 0x1135
#define VENDOR_LUTRON 0x1144
#define VENDOR_INNR 0x1166
#define VENDOR_INNR2 0x1168
#define VENDOR_INSTA 0x117A
Expand Down Expand Up @@ -290,15 +292,18 @@

extern const quint64 macPrefixMask;
extern const quint64 bjeMacPrefix;
extern const quint64 centraLiteMacPrefix;
extern const quint64 emberMacPrefix;
extern const quint64 tiMacPrefix;
extern const quint64 deMacPrefix;
extern const quint64 ikeaMacPrefix;
extern const quint64 instaMacPrefix;
extern const quint64 jennicMacPrefix;
extern const quint64 philipsMacPrefix;
extern const quint64 osramMacPrefix;
extern const quint64 nyceMacPrefix;
extern const quint64 ubisysMacPrefix;
extern const quint64 netvoxMacPrefix;
extern const quint64 heimanMacPrefix;
extern const quint64 lutronMacPrefix;

// HTTP status codes
extern const char *HttpStatusOk;
Expand Down
21 changes: 21 additions & 0 deletions sensor.cpp
Expand Up @@ -305,6 +305,23 @@ static const Sensor::ButtonMap ubisysC4Map[] = {
{ Sensor::ModeNone, 0x00, 0x0000, 0x00, 0, 0, 0 }
};

static const Sensor::ButtonMap lutronLZL4BWHLSwitchMap[] = {
// mode ep cluster cmd param button name
// vendor specific
// top button
{ Sensor::ModeDimmer, 0x01, 0x0008, 0x04, 0xfe, S_BUTTON_1 + S_BUTTON_ACTION_SHORT_RELEASED, "on" },
// second button
{ Sensor::ModeDimmer, 0x01, 0x0008, 0x06, 0x00, S_BUTTON_2 + S_BUTTON_ACTION_HOLD, "dimm up" },
{ Sensor::ModeDimmer, 0x01, 0x0008, 0x03, 0x00, S_BUTTON_2 + S_BUTTON_ACTION_LONG_RELEASED, "dimm up release" },
// third button
{ Sensor::ModeDimmer, 0x01, 0x0008, 0x02, 0x01, S_BUTTON_3 + S_BUTTON_ACTION_HOLD, "dimm down" },
{ Sensor::ModeDimmer, 0x01, 0x0008, 0x03, 0x01, S_BUTTON_3 + S_BUTTON_ACTION_LONG_RELEASED, "dimm down release" },
// bottom button
{ Sensor::ModeDimmer, 0x01, 0x0008, 0x04, 0x00, S_BUTTON_4 + S_BUTTON_ACTION_SHORT_RELEASED, "off" },

// end
{ Sensor::ModeNone, 0x00, 0x0000, 0x00, 0, 0, 0 }
};

/*! Returns a fingerprint as JSON string. */
QString SensorFingerprint::toString() const
Expand Down Expand Up @@ -809,6 +826,10 @@ const Sensor::ButtonMap *Sensor::buttonMap()
if (modelid == QLatin1String("lumi.sensor_switch")) { m_buttonMap = xiaomiSwitchMap; }
else if (modelid == QLatin1String("lumi.sensor_switch.aq2")) { m_buttonMap = xiaomiSwitchAq2Map; }
}
else if (m_manufacturer == QLatin1String("Lutron"))
{
if (modelid.startsWith(QLatin1String("LZL4BWHL"))) { m_buttonMap = lutronLZL4BWHLSwitchMap; }
}
}

return m_buttonMap;
Expand Down

0 comments on commit ca38100

Please sign in to comment.