I have a device that i cannot get to report luminance on. It is the Philio PSM01 multi sensor. It does Report values but only when an open close event is triggered. I’d love to use the luminance sensor on this. SO any help would be awesome!
Here is the device type incase anyone wants to look over it and see if i have any glaring mistake that would make the sensor not work properly.
I basically modified the Aeon Sensor type.
// for the UI
metadata {
// Automatically generated. Make future change here.
definition (name: "Door Sensor", author: "jsconst@gmail.com") {
capability "Contact Sensor"
capability "Temperature Measurement"
capability "Sensor"
capability "Illuminance Measurement"
capability "Battery"
capability "Refresh"
capability "Polling"
}
simulator {
status "open" : "command: 3003, payload: FF"
status "closed" : "command: 3003, payload: 00"
for (int i = 0; i <= 100; i += 20) {
status "temperature ${i}F": new physicalgraph.zwave.Zwave().sensorMultilevelV2.sensorMultilevelReport(
scaledSensorValue: i, precision: 1, sensorType: 1, scale: 1).incomingMessage()
}
for (int i = 0; i <= 100; i += 20) {
status "luminance ${i} lux": new physicalgraph.zwave.Zwave().sensorMultilevelV2.sensorMultilevelReport(
scaledSensorValue: i, precision: 0, sensorType: 3).incomingMessage()
}
for (int i = 200; i <= 1000; i += 200) {
status "luminance ${i} lux": new physicalgraph.zwave.Zwave().sensorMultilevelV2.sensorMultilevelReport(
scaledSensorValue: i, precision: 0, sensorType: 3).incomingMessage()
}
for (int i = 0; i <= 100; i += 20) {
status "battery ${i}%": new physicalgraph.zwave.Zwave().batteryV1.batteryReport(
batteryLevel: i).incomingMessage()
}
}
tiles {
standardTile("contact", "device.contact", width: 2, height: 2) {
state "open", label: 'Front Door\nDoor\n${name}', icon: "st.contact.contact.open", backgroundColor: "#ffa81e"
state "closed", label: 'Front Door\nDoor\n${name}', icon: "st.contact.contact.closed", backgroundColor: "#79b821"
}
valueTile("temperature", "device.temperature", inactiveLabel: false) {
state "temperature", label:'${currentValue}°',
backgroundColors:[
[value: 31, color: "#153591"],
[value: 44, color: "#1e9cbb"],
[value: 59, color: "#90d2a7"],
[value: 74, color: "#44b621"],
[value: 84, color: "#f1d801"],
[value: 95, color: "#d04e00"],
[value: 96, color: "#bc2323"]
]
}
valueTile("illuminance", "device.illuminance", inactiveLabel: false) {
state "luminosity", label:'${currentValue} ${unit}', unit:"lux"
}
valueTile("battery", "device.battery", inactiveLabel: false, decoration: "flat") {
state "battery", label:'${currentValue}% battery', unit:""
}
standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat") {
state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh"
}
main(["contact", "temperature", "illuminance"])
details(["contact", "temperature", "illuminance", "battery", "refresh"])
}
}
// Parse incoming device messages to generate events
def parse(String description)
{
def result = []
def cmd = zwave.parse(description, [0x31: 2, 0x30: 1, 0x84: 1, 0x20: 1, 0x70: 1, 0x80: 1, 0x01: 1])
if (cmd) {
if( cmd.CMD == "8407" ) { result << new physicalgraph.device.HubAction(zwave.wakeUpV1.wakeUpNoMoreInformation().format()) }
result << createEvent(zwaveEvent(cmd))
}
log.debug "Parse returned ${result}"
return result
}
// Event Generation
def zwaveEvent(physicalgraph.zwave.commands.wakeupv1.WakeUpNotification cmd)
{
[descriptionText: "${device.displayName} woke up", isStateChange: false]
}
def zwaveEvent(physicalgraph.zwave.commands.sensormultilevelv2.SensorMultilevelReport cmd)
{
def map = [:]
switch (cmd.sensorType) {
case 1:
// temperature
def cmdScale = cmd.scale == 1 ? "F" : "C"
map.value = convertTemperatureIfNeeded(cmd.scaledSensorValue, cmdScale, cmd.precision)
map.unit = getTemperatureScale()
map.name = "temperature"
break;
case 3:
// luminance
map.value = cmd.scaledSensorValue.toInteger().toString()
map.unit = "lux"
map.name = "illuminance"
break;
case 5:
// humidity
map.value = cmd.scaledSensorValue.toInteger().toString()
map.unit = "%"
map.name = "humidity"
break;
}
map
}
def zwaveEvent(physicalgraph.zwave.commands.batteryv1.BatteryReport cmd) {
def map = [:]
map.name = "battery"
map.value = cmd.batteryLevel > 0 ? cmd.batteryLevel.toString() : 1
map.unit = "%"
map.displayed = false
map
}
def sensorValueEvent(Short value) {
if (value) {
createEvent(name: "contact", value: "open", descriptionText: "$device.displayName is open")
} else {
createEvent(name: "contact", value: "closed", descriptionText: "$device.displayName is closed")
}
}
def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicReport cmd)
{
sensorValueEvent(cmd.value)
}
def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicSet cmd)
{
sensorValueEvent(cmd.value)
}
def zwaveEvent(physicalgraph.zwave.commands.switchbinaryv1.SwitchBinaryReport cmd)
{
sensorValueEvent(cmd.value)
}
def zwaveEvent(physicalgraph.zwave.commands.sensorbinaryv1.SensorBinaryReport cmd)
{
sensorValueEvent(cmd.sensorValue)
}
def zwaveEvent(physicalgraph.zwave.Command cmd) {
log.debug "Catchall reached for cmd: ${cmd.toString()}}"
[:]
}
Also, the temp does update on change. When that happens the lux value will also update. I feel like it should work im just missing some tiny thing.
For more information here are the individual properties for the device. I see that the multilevel sensor version is incorrect here as well as there is not “manufacturer specifc” code in this type. Anyone have any ideas?
Command Class Byte Version Support Control In NIF Secure Non Secure
Battery 0x80 1 Yes No Yes No Yes
Basic 0x20 1 Yes No Yes No Yes
Wake Up 0x84 2 Yes No Yes No Yes
Association 0x85 2 Yes No Yes No Yes
Version 0x86 1 Yes No Yes No Yes
Configuration 0x70 1 Yes No Yes No Yes
Binary Sensor 0x30 2 Yes No Yes No Yes
Multilevel Sensor 0x31 5 Yes No Yes No Yes
Manufacturer Specific 0x72 2 Yes No Yes No Yes
Here is the site i found with all the device properties: