Skip to content

Commit b89afbf

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 288c886 + 6ccba66 commit b89afbf

14 files changed

+677
-466
lines changed

bindings.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2472,12 +2472,12 @@ bool DeRestPluginPrivate::checkSensorBindingsForClientClusters(Sensor *sensor)
24722472
srcEndpoints.push_back(sensor->fingerPrint().endpoint);
24732473
}
24742474
// IKEA SYMFONISK sound controller
2475-
else if (sensor->modelId().startsWith(QLatin1String("SYMFONISK")))
2476-
{
2477-
clusters.push_back(ONOFF_CLUSTER_ID);
2478-
clusters.push_back(LEVEL_CLUSTER_ID);
2479-
srcEndpoints.push_back(sensor->fingerPrint().endpoint);
2480-
}
2475+
// else if (sensor->modelId().startsWith(QLatin1String("SYMFONISK")))
2476+
// {
2477+
// clusters.push_back(ONOFF_CLUSTER_ID);
2478+
// clusters.push_back(LEVEL_CLUSTER_ID);
2479+
// srcEndpoints.push_back(sensor->fingerPrint().endpoint);
2480+
// }
24812481
// LEGRAND Remote switch
24822482
else if (sensor->modelId() == QLatin1String("Remote switch"))
24832483
{
@@ -2686,7 +2686,7 @@ void DeRestPluginPrivate::checkSensorGroup(Sensor *sensor)
26862686
sensor->modelId().startsWith(QLatin1String("TRADFRI motion sensor")) ||
26872687
sensor->modelId().startsWith(QLatin1String("TRADFRI remote control")) ||
26882688
sensor->modelId().startsWith(QLatin1String("TRADFRI wireless dimmer")) ||
2689-
sensor->modelId().startsWith(QLatin1String("SYMFONISK")) ||
2689+
// sensor->modelId().startsWith(QLatin1String("SYMFONISK")) ||
26902690
sensor->modelId().startsWith(QLatin1String("902010/23"))) // bitron remote
26912691
{
26922692

database.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2905,7 +2905,10 @@ static int sqliteLoadAllSensorsCallback(void *user, int ncols, char **colval , c
29052905
if (sensor.fingerPrint().hasOutCluster(ONOFF_CLUSTER_ID))
29062906
{
29072907
clusterId = clusterId ? clusterId : ONOFF_CLUSTER_ID;
2908-
sensor.addItem(DataTypeString, RConfigGroup);
2908+
if (!sensor.modelId().startsWith(QLatin1String("SYMFONISK")))
2909+
{
2910+
sensor.addItem(DataTypeString, RConfigGroup);
2911+
}
29092912
}
29102913
else if (sensor.fingerPrint().hasInCluster(ONOFF_CLUSTER_ID))
29112914
{
@@ -3389,7 +3392,9 @@ static int sqliteLoadAllSensorsCallback(void *user, int ncols, char **colval , c
33893392

33903393
if (sensor.fingerPrint().hasInCluster(IAS_ZONE_CLUSTER_ID))
33913394
{
3392-
if (sensor.modelId() == QLatin1String("multi") && sensor.manufacturer() == QLatin1String("Samjin"))
3395+
if ((sensor.manufacturer() == QLatin1String("Samjin") &&
3396+
(sensor.modelId() == QLatin1String("button") || sensor.modelId() == QLatin1String("multi") || sensor.modelId() == QLatin1String("water"))) ||
3397+
(sensor.manufacturer() == QLatin1String("CentraLite") && sensor.modelId() == QLatin1String("Motion Sensor-A")))
33933398
{
33943399
// no support for some IAS Zone flags
33953400
}

de_web_plugin.cpp

Lines changed: 128 additions & 67 deletions
Large diffs are not rendered by default.

de_web_plugin_private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ class DeRestPluginPrivate : public QObject
10311031
int updateRule(const ApiRequest &req, ApiResponse &rsp);
10321032
int deleteRule(const ApiRequest &req, ApiResponse &rsp);
10331033
void queueCheckRuleBindings(const Rule &rule);
1034-
bool evaluateRule(Rule &rule, const Event &e, Resource *eResource, ResourceItem *eItem, QDateTime now);
1034+
bool evaluateRule(Rule &rule, const Event &e, Resource *eResource, ResourceItem *eItem, QDateTime now, QDateTime previousNow);
10351035
void indexRuleTriggers(Rule &rule);
10361036
void triggerRule(Rule &rule);
10371037
bool ruleToMap(const Rule *rule, QVariantMap &map);

ikea-ota-download.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
f = urlopen("http://fw.ota.homesmart.ikea.net/feed/version_info.json")
1717
data = f.read()
1818

19-
arr = json.loads(data)
19+
arr = json.loads(data.decode('utf-8'))
2020

2121
otapath = '%s/otau' % os.path.expanduser('~')
2222

light_node.cpp

Lines changed: 47 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ const deCONZ::SimpleDescriptor &LightNode::haEndpoint() const
314314
*/
315315
void LightNode::setHaEndpoint(const deCONZ::SimpleDescriptor &endpoint)
316316
{
317-
bool isWindowCovering = false;
317+
bool isWindowCovering = false;
318318
bool isInitialized = m_haEndpoint.isValid();
319319
m_haEndpoint = endpoint;
320320

@@ -434,42 +434,52 @@ void LightNode::setHaEndpoint(const deCONZ::SimpleDescriptor &endpoint)
434434
}
435435
else if (i->id() == WINDOW_COVERING_CLUSTER_ID /*FIXME ubisys J1*/)
436436
{
437-
QList<deCONZ::ZclCluster>::const_iterator ic = haEndpoint().inClusters().constBegin();
438-
std::vector<deCONZ::ZclAttribute>::const_iterator ia = ic->attributes().begin();
439-
std::vector<deCONZ::ZclAttribute>::const_iterator enda = ic->attributes().end();
440-
isWindowCovering = true;
441-
bool hasLift = true; // set default to lift
442-
bool hasTilt = false;
443-
for (;ia != enda; ++ia)
444-
{
445-
if (ia->id() == 0x0000) // WindowCoveringType
446-
{
447-
/*
448-
* Value Type Capabilities
449-
* 0 Roller Shade = Lift only
450-
* 1 Roller Shade two motors = Lift only
451-
* 2 Roller Shade exterior = Lift only
452-
* 3 Roller Shade two motors ext = Lift only
453-
* 4 Drapery = Lift only
454-
* 5 Awning = Lift only
455-
* 6 Shutter = Tilt only
456-
* 7 Tilt Blind Lift only = Tilt only
457-
* 8 Tilt Blind lift & tilt = Lift & Tilt
458-
* 9 Projector Screen = Lift only
459-
*/
460-
uint8_t coveringType = ia->numericValue().u8;
461-
if (coveringType == 8 ) {
462-
hasTilt = true;
463-
}
464-
else if (coveringType == 6 || coveringType == 7)
465-
{
466-
hasTilt = true;
467-
hasLift = false;
468-
}
469-
}
470-
}
471-
if (hasLift) { addItem(DataTypeUInt8, RStateBri);}
472-
if (hasTilt) { addItem(DataTypeUInt8, RStateSat);}
437+
QList<deCONZ::ZclCluster>::const_iterator ic = haEndpoint().inClusters().constBegin();
438+
std::vector<deCONZ::ZclAttribute>::const_iterator ia = ic->attributes().begin();
439+
std::vector<deCONZ::ZclAttribute>::const_iterator enda = ic->attributes().end();
440+
isWindowCovering = true;
441+
bool hasLift = true; // set default to lift
442+
bool hasTilt = false;
443+
for (;ia != enda; ++ia)
444+
{
445+
if (ia->id() == 0x0000) // WindowCoveringType
446+
{
447+
/*
448+
* Value Type Capabilities
449+
* 0 Roller Shade = Lift only
450+
* 1 Roller Shade two motors = Lift only
451+
* 2 Roller Shade exterior = Lift only
452+
* 3 Roller Shade two motors ext = Lift only
453+
* 4 Drapery = Lift only
454+
* 5 Awning = Lift only
455+
* 6 Shutter = Tilt only
456+
* 7 Tilt Blind Lift only = Tilt only
457+
* 8 Tilt Blind lift & tilt = Lift & Tilt
458+
* 9 Projector Screen = Lift only
459+
*/
460+
uint8_t coveringType = ia->numericValue().u8;
461+
if (coveringType == 8 ) {
462+
hasTilt = true;
463+
}
464+
else if (coveringType == 6 || coveringType == 7)
465+
{
466+
hasTilt = true;
467+
hasLift = false;
468+
}
469+
}
470+
}
471+
addItem(DataTypeBool, RStateOpen);
472+
// FIXME: removeItem(RStateOn);
473+
if (hasLift)
474+
{
475+
addItem(DataTypeUInt8, RStateLift);
476+
addItem(DataTypeUInt8, RStateBri); // FIXME: deprecate
477+
}
478+
if (hasTilt)
479+
{
480+
addItem(DataTypeUInt8, RStateTilt);
481+
addItem(DataTypeUInt8, RStateSat); // FIXME: deprecate
482+
}
473483
}
474484
else if (i->id() == FAN_CONTROL_CLUSTER_ID) {
475485
addItem(DataTypeUInt8, RStateSpeed);

resource.cpp

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const char *RStateGesture = "state/gesture";
5959
const char *RStateHue = "state/hue";
6060
const char *RStateHumidity = "state/humidity";
6161
const char *RStateLastUpdated = "state/lastupdated";
62+
const char *RStateLift = "state/lift";
6263
const char *RStateLightLevel = "state/lightlevel";
6364
const char *RStateLowBattery = "state/lowbattery";
6465
const char *RStateLocaltime = "state/localtime";
@@ -82,6 +83,7 @@ const char *RStateSunrise = "state/sunrise";
8283
const char *RStateSunset = "state/sunset";
8384
const char *RStateTampered = "state/tampered";
8485
const char *RStateTemperature = "state/temperature";
86+
const char *RStateTilt = "state/tilt";
8587
const char *RStateTiltAngle = "state/tiltangle";
8688
const char *RStateValve = "state/valve";
8789
const char *RStateVibration = "state/vibration";
@@ -191,6 +193,7 @@ void initResourceDescriptors()
191193
rItemDescriptors.emplace_back(ResourceItemDescriptor(DataTypeUInt16, RStateHue));
192194
rItemDescriptors.emplace_back(ResourceItemDescriptor(DataTypeUInt16, RStateHumidity, 0, 10000));
193195
rItemDescriptors.emplace_back(ResourceItemDescriptor(DataTypeTime, RStateLastUpdated));
196+
rItemDescriptors.emplace_back(ResourceItemDescriptor(DataTypeUInt8, RStateLift, 0, 100));
194197
rItemDescriptors.emplace_back(ResourceItemDescriptor(DataTypeUInt16, RStateLightLevel, 0, 0xfffe));
195198
rItemDescriptors.emplace_back(ResourceItemDescriptor(DataTypeBool, RStateLowBattery));
196199
rItemDescriptors.emplace_back(ResourceItemDescriptor(DataTypeTime, RStateLocaltime));
@@ -215,6 +218,7 @@ void initResourceDescriptors()
215218
rItemDescriptors.emplace_back(ResourceItemDescriptor(DataTypeTime, RStateSunset));
216219
rItemDescriptors.emplace_back(ResourceItemDescriptor(DataTypeBool, RStateTampered));
217220
rItemDescriptors.emplace_back(ResourceItemDescriptor(DataTypeInt16, RStateTemperature, -27315, 32767));
221+
rItemDescriptors.emplace_back(ResourceItemDescriptor(DataTypeUInt8, RStateTilt, 0, 100));
218222
rItemDescriptors.emplace_back(ResourceItemDescriptor(DataTypeUInt16, RStateTiltAngle));
219223
rItemDescriptors.emplace_back(ResourceItemDescriptor(DataTypeUInt8, RStateValve));
220224
rItemDescriptors.emplace_back(ResourceItemDescriptor(DataTypeBool, RStateVibration));
@@ -372,17 +376,30 @@ const QString &ResourceItem::toString() const
372376
{
373377
if (m_str)
374378
{
375-
if (m_rid.suffix == RStateLastUpdated || m_rid.suffix == RStateSunrise || m_rid.suffix == RStateSunset)
379+
QDateTime dt;
380+
381+
// default: local time in sec resolution
382+
QString format = QLatin1String("yyyy-MM-ddTHH:mm:ss");
383+
384+
if (m_rid.suffix == RStateLastUpdated)
385+
{
386+
// UTC in msec resolution
387+
format = QLatin1String("yyyy-MM-ddTHH:mm:ss.zzz");
388+
dt.setOffsetFromUtc(0);
389+
}
390+
else if (m_rid.suffix == RStateSunrise || m_rid.suffix == RStateSunset)
376391
{
377-
QDateTime dt;
392+
// UTC in sec resulution
378393
dt.setOffsetFromUtc(0);
379-
dt.setMSecsSinceEpoch(m_num);
380-
*m_str = dt.toString(m_rid.suffix == RStateLastUpdated ? "yyyy-MM-ddTHH:mm:ss.zzz" : "yyyy-MM-ddTHH:mm:ss");
381394
}
382-
else
395+
else if (m_rid.suffix == RConfigLocalTime)
383396
{
384-
*m_str = QDateTime::fromMSecsSinceEpoch(m_num).toString("yyyy-MM-ddTHH:mm:ss");
397+
// local time in msec resolution
398+
format = QLatin1String("yyyy-MM-ddTHH:mm:ss.zzz");
385399
}
400+
401+
dt.setMSecsSinceEpoch(m_num);
402+
*m_str = dt.toString(format);
386403
return *m_str;
387404
}
388405
}

resource.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ extern const char *RStateGesture;
7474
extern const char *RStateHue;
7575
extern const char *RStateHumidity;
7676
extern const char *RStateLastUpdated;
77+
extern const char *RStateLift;
7778
extern const char *RStateLightLevel;
7879
extern const char *RStateLowBattery;
7980
extern const char *RStateLocaltime;
@@ -97,6 +98,7 @@ extern const char *RStateSunrise;
9798
extern const char *RStateSunset;
9899
extern const char *RStateTampered;
99100
extern const char *RStateTemperature;
101+
extern const char *RStateTilt;
100102
extern const char *RStateTiltAngle;
101103
extern const char *RStateValve;
102104
extern const char *RStateVibration;

0 commit comments

Comments
 (0)