Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ metadata {
fingerprint mfr: "0258", prod: "0003", model: "008D", deviceJoinName: "NEO Coolcam Motion/Light Sensor"
//zw:S type:0701 mfr:0258 prod:0003 model:108D ver:3.80 zwv:4.38 lib:06 cc:5E,86,72,5A,73,80,31,71,30,70,85,59,84 role:06 ff:8C07 ui:8C07 EU version
fingerprint mfr: "0258", prod: "0003", model: "108D", deviceJoinName: "NEO Coolcam Motion/Light Sensor"
fingerprint mfr: "0060", prod: "0012", model: "0001", deviceJoinName: "Everspring Outdoor Floodlight", mmnm: "SmartThings", vid: "generic-motion-light-sensor"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this limit the illuminance reporting range?

Copy link
Contributor Author

@PKacprowiczS PKacprowiczS Sep 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean metadata? No, I didn't meddle with that.
If you ask about device, then yes, it supports illuminance reports only up to 250 lx.

}

simulator {
Expand Down Expand Up @@ -89,6 +90,10 @@ def updated() {
def configure() {
// Device wakes up every deviceCheckInterval hours, this interval allows us to miss one wakeup notification before marking offline
sendEvent(name: "checkInterval", value: 2 * deviceWakeUpInterval * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])

if (isEverspringFloodlight()) {
response(zwave.configurationV1.configurationSet(parameterNumber: 3, size: 2, scaledConfigurationValue: 600)) //enables illuminance report every 10 minutes
}
}

def getDeviceWakeUpInterval() {
Expand Down Expand Up @@ -121,7 +126,7 @@ private getCommandClassVersions() {
def parse(String description) {
def results = []
if (description.startsWith("Err")) {
results << createEvent(descriptionText: description, displayed: true)
results += createEvent(descriptionText: description, displayed: true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What’s the reasoning behind this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'<<' created double nested lists, which then it leaded to events not being returned correctly from parse() method (they weren't shown in IDE/both mobile apps)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kianooshST is this something that bothers you, and I should rework it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No that is fine, I was just curious about the change.

} else {
def cmd = zwave.parse(description, commandClassVersions)
if (cmd) {
Expand All @@ -144,9 +149,9 @@ def zwaveEvent(physicalgraph.zwave.commands.notificationv3.NotificationReport cm
def results = []
if (cmd.notificationType == 0x07) { // Burglar
if (cmd.event == 0x08) { // detected
results << sensorMotionEvent(1)
results += sensorMotionEvent(1)
} else if (cmd.event == 0x00) { // inactive
results << sensorMotionEvent(0)
results += sensorMotionEvent(0)
}
}
return results
Expand All @@ -162,7 +167,7 @@ def zwaveEvent(physicalgraph.zwave.commands.batteryv1.BatteryReport cmd) {
} else {
map.value = cmd.batteryLevel
}
results << createEvent(map)
results += createEvent(map)
return results
}

Expand All @@ -179,21 +184,21 @@ def zwaveEvent(physicalgraph.zwave.commands.sensormultilevelv5.SensorMultilevelR
default:
map.descriptionText = cmd.toString()
}
results << createEvent(map)
results += createEvent(map)
return results
}

def zwaveEvent(physicalgraph.zwave.commands.wakeupv2.WakeUpNotification cmd) {
def results = []
results << createEvent(descriptionText: "$device.displayName woke up", isStateChange: false)
results << response(zwave.sensorMultilevelV5.sensorMultilevelGet(sensorType: 3, scale: 1).format())
results += createEvent(descriptionText: "$device.displayName woke up", isStateChange: false)
results += response(zwave.sensorMultilevelV5.sensorMultilevelGet(sensorType: 3, scale: 1).format())
if (!state.lastbatt || (now() - state.lastbatt) >= 10 * 60 * 60 * 1000) {
results << response(["delay 1000",
results += response(["delay 1000",
zwave.batteryV1.batteryGet().format(),
"delay 2000"
])
}
results << response(zwave.wakeUpV2.wakeUpNoMoreInformation().format())
results += response(zwave.wakeUpV2.wakeUpNoMoreInformation().format())
return results
}

Expand All @@ -206,9 +211,13 @@ def zwaveEvent(physicalgraph.zwave.Command cmd) {
def sensorMotionEvent(value) {
def result = []
if (value) {
result << createEvent(name: "motion", value: "active", descriptionText: "$device.displayName detected motion")
result += createEvent(name: "motion", value: "active", descriptionText: "$device.displayName detected motion")
} else {
result << createEvent(name: "motion", value: "inactive", descriptionText: "$device.displayName motion has stopped")
result += createEvent(name: "motion", value: "inactive", descriptionText: "$device.displayName motion has stopped")
}
return result
}

private isEverspringFloodlight() {
zwaveInfo.mfr == "0060" && zwaveInfo.model == "0001"
}