Philio Door/Temp/Luinance Device Type

This section also needs modified to send the event, but due to how it’s coded, it may be more difficult or a rewrite may need to be done to spoof a motion sensor capability:

def zwaveEvent(physicalgraph.zwave.commands.sensorbinaryv2.SensorBinaryReport cmd) {
log.debug "PSM01: SensorBinaryReport ${cmd.toString()}}"
def map = [:]
switch (cmd.sensorType) {
    case 10: // contact sensor
        map.name = "contact"
        if (cmd.sensorValue) {
            map.value = "open"
            map.descriptionText = "$device.displayName is open"
        } else {
            map.value = "closed"
            map.descriptionText = "$device.displayName is closed"
        }
        break;
}
map

}

The variable “map.value” will need to send inactive for closed and active for open.

@danielccm, before changing too much, what is it you are ultimately trying to accomplish? Please refresh my memory because there may be a better way.

I’ve got a PSM01 attached to a door that leads to a terrace at home where the laundry equipment is.

That terrace is pointed to the East, therefore the sun hits it real soon.

But in the afternoon, it tends to get dark.

I found the app “Bright when dark…” and it’s perfect! If there’s a cloudy day, or it’s night or whatever it lights up a light… BUT it only works with MOTION sensors… and the PSM is a CONTACT sensor…

I have no other sensors at the moment available for that task…

also, I’d love to know if I left that terrace door open or closed… just in case it rains…

does that make sense at all?

@danielccm Cool, OK. Here’s an alternative:

Try “Brighten Dark Places”. You can find it in the SmartSetup section (the big + sign at the bottom of the app) and then More and then Convenience, 3rd app down. It doesn’t have all the options Brighten When Dark does, but this may work out better - PLUS it’s triggered by a contact sensor, not motion. :smile:

Now, let’s tackle your open/close scenario. Do you have a Dashboard item called “Doors & Locks”?

If not (or if you do), go to SmartSetup again, and then Alerts. Tap on Access & Entryways. Select either “Notify me when a door is…” or “Receive an alert if…”. Either one of those will do the job. I have 31 doors/windows in my list :wink:

1 Like

Nice little app! But hey! It keeps the light on after I close the door!!! Help!?

Hi @danielccm, that’s what I meant about some options aren’t there. I think I can help you though. I should be able to modify that SmartApp to do what you want. Be right back…

1 Like

Ok @danielccm, here you go. This will work the way you want. It will turn off the light when you close the door. I tested it several times, so I’m quite confident it will work for you.

https://raw.githubusercontent.com/constjs/SmartThings-Apps/master/my_custom_brighten_dark_places.app.groovy

Have you created your own SmartApp before in the IDE?

If you haven’t, here’s a quick tutorial. If you have, sorry for the info overload:

Uninstall the SmartApp “Brighten Dark Places”, or what ever name you gave it in the phone app.

Copy the code for the SmartApp from the link above in it’s entirety. You can’t miss a single character. Do a Ctrl-A and Ctrl-C to save to your clipboard.

Once in the IDE, click on “My SmartApps” along the top.

Click on the green “+ New SmartApp” button on the right side of the IDE.

Next, click on “From Code” and paste (Ctrl-P) all that code above into the dialog box.

Click on the blue “Create” at the bottom.

Next, click on “Save” and then “Publish - -> For Me”

Now in the ST app on your phone, go back into the SmartSetup section again, but this time scroll all the way to the right and tap on My Apps.

Find the app you just created and set it up the same as before.

Done!

2 Likes

This is one of those times when I’d like to hit like several times in a row! Genius!

Thanks!!!

Edit: I’ll come back in 8 hours more or less and tell you that the lights didn’t turn on in the morning… Lol!

And don’t worry about the info overload! It comes in useful as a reminder!

1 Like

I had no doubt it would work but for QC reasons I had to try it this morning…

Theory said the light shouldn’t turn on and a simple opening/closing of the door verified that!

Thanks again @johnconstantelo!

Unfortunately I did not find your device type for the PSM02 before I put my own together based on your PSM01 device type. As it stands, it is pretty much the same as the PSM02 device type you wrote save for a few extra config parameters and I am handling the motion detection differently.

The PSM02 actually does sent a kind of no motion detected event while in test mode and security mode. Have not tested Home Automation yet. The motion event sensorValue is either 0 or 255. So I forked your repo with the psm02 devite type in there and used the smartthings github integration functionality ( which I am not terribly pleased with ) to add my device type.

I noticed you put the isstatechange=true in there so I added it as well, however, the psm02 was detecting open and closed, motion and no motion, and changing the tile colors, without it
In the end, it was a pretty good exercise.
Was wondering if you could take a look and see if I may have missed something?

Thanks

I am pretty sure the PSM02 does not send a no motion (value = 0x00) event. The manual states as much. The map.isStateChange = true is probably no longer necessary. I put that in initially because the only events the sensor was sending were the motion detected (value = 0xff) events, so I was not seeing any new events. With the helper app sending the no motion events, the statement should no longer be necessary.

You are correct. The PSM02 does not send a no motion event. However is sends a sensor binary event 12 with a value of zero when there is no motion detected after it has detected motion.

To see this, set both dip switches in the device to ON. This puts it in test mode with a PIR re detect interval of 6 seconds. Move in front and an event of type 12 will be received with the value of 255. 6 seconds later another event of type 12 is received with a value of zero. Then put the device into security mode. I believe that is dip switch one to off and switch 2 to on. The default value is 3 ticks with each tick being 8 seconds. Again move in front of the device and you will receive an event with a value of 255. Don’t move for 24 seconds and an event type 12 is received with sensor value of zero.

Now I have not tested it in home automation mode so I cannot say for sure if the behavior is the same.

However, in security mode with a minimum of 24 seconds, it is still useable.

I will need to do some testing, but this is what the manual states:

  • Motion Report:
    When the PIR motion detected, the device will unsolicited to send the
    “Sensor Binary Report” to the nodes in the group 1.
    Sensor Type: Motion (0x0C)
    Sensor Value: 0xFF
  • Door/Window Report:
    When the Door/Window state changed, the device will unsolicited to
    send the “Sensor Binary Report” to the nodes in the group 1.
    Sensor Type: Door/Window (0x0A)
    Sensor Value: 0x00 is closed, 0xFF is opened.

In case of motion, the sensor will not send a sensor binary report with type motion and sensor value 0.

Home automation mode should make things “worse” (it is a different application). The timeout parameter is specified by parameter 9 “Turn Off Light Time” instead of parameter 8 “PIR Re-Detect Interval Time” and it will only send the report if the luminance is “dark”.

Sorry if you get this twice. I keep finding out I am in the wrong account and want to keep all my posts in under my developer account…

Believe me, I am not going crazy. I saw the sensor binary report with a sensor value of zero when there was no motion. That is why I made the change to the code and keyed in if the value was greater than zero. I swear. Could it me a firmware thing? I got my PSM02s a few months ago.

Thanks for the update about home automation mode. I was actually moving to Vera from ST 1.0 but my fiancé saw a YouTube video on the ST 2.0 and liked the interface better. When I put the sensor in home automation mode, the Vera never actually reported that the motion had stopped. However, in security mode I was able to create PLEG rules that allowed us to know if someone left the house or came in based on whether a motion was detected shortly afterward.

Ill take a look at the Vera device xml for the PSM02 and see if it was looking for an 0x00 response or querying the re-detect interval and doing some kind of internal timer. In the meantime, when I get home, Ill copy the logs where the 0x00 event comes in.

I have a Zipato Quad sensor, that looks like the same with same functionality but can’t get the motion sensor to say “no motion”. I tried the different DIP switch settings but noting works… all the other sensor input (contact, illuminance and Temp ) work fine… Please help

I am new to Smart things (Day 1). Can someone tell me how can I look at the raw values that sent by the sensor to the hub so that I can do some troubleshooting myself.

As I stated above, the sensor does not send a “no motion”.

One thing I never tried is Home Automation mode. In this mode, the sensor is supposed to send a on/off to association group 2. Not sure whether anyone tried.

Just to confuse matters, there are also the PST models (http://www.philio-tech.com/products_sensors.htm) and PSM models (http://www.philio-tech.com/pdf/PSM02-1-2-3.pdf) - I wonder if the PSM ones have been replaced with PST as the PSM are not listed under their current products ?

Anyway the reason I was replying was because they recently released newer hardware models (the Z-Wave Plus / Gen5 / 500 series), so perhaps the no motion value is reported in the newer models, but not the older ones ?

I have a couple (1 old model, 1 new model), but they are the 3-in-1 devices without the motion sensor so aren’t really much help :smile:

I know what the documentation says but I also know what the logs show.
I know what the documentation says but the logs show differently.

d965a146-4775-4634-9c83-09dfd483af9b 12:59:56 PM: debug PSM02 cmd.sensorValue: 0
d965a146-4775-4634-9c83-09dfd483af9b 12:59:56 PM: debug PSM02: SensorBinaryReport SensorBinaryReport(sensorType: 12, sensorValue: 0)}
d965a146-4775-4634-9c83-09dfd483af9b 12:59:49 PM: debug PSM02 cmd.sensorValue: 255
d965a146-4775-4634-9c83-09dfd483af9b 12:59:49 PM: debug PSM02: SensorBinaryReport SensorBinaryReport(sensorType: 12, sensorValue: 255)}
d965a146-4775-4634-9c83-09dfd483af9b 12:59:49 PM: debug PSM02 cmd.sensorValue: 255
d965a146-4775-4634-9c83-09dfd483af9b 12:59:49 PM: debug PSM02: SensorBinaryReport SensorBinaryReport(sensorType: 12, sensorValue: 255)}

Clearly a 0x00 is returned when no motion has been detected. As I said, it may be different in home automation mode and I still have to check it in security mode. However, the device is in test mode and the manual states “The PIR motion re-detected interval, in the “Test Mode” fixed to 6 seconds. In the “Normal Mode”, it according to the setting of the configuration NO. 8”

As you can see in the logs, the 0x00 report came in 6 seconds later as indicated in the manual.

Perhaps I have a different version of the firmware, or a newer/older device. Bottom line, I am seeing a no motion report.

Paul,

Perhaps I didn’t present my observations in a positive way. I am not suggesting that the device type is flawed. In fact, while debugging, it turned out that, in my case, the problem was groovy. The evaluation of the sensory binary report was true/false and the 0x00 report was being evaluated as true along with the 0xFF report. So I made one modification to the z-wave parse function for the sensor binary report to evaluate the return value and things started working as they did before I had to give up my Vera.

All I am suggesting is for you to give it a try.

indent preformatted text by 4 spaces

def zwaveEvent(physicalgraph.zwave.commands.sensorbinaryv2.SensorBinaryReport cmd) {
log.debug "PSM02: SensorBinaryReport ${cmd.toString()}}"
def map = [:]
switch (cmd.sensorType) {
    case 10: // contact sensor
        map.name = "contact"
        log.debug "PSM02 cmd.sensorValue: ${cmd.sensorValue}"
        if (cmd.sensorValue.toInteger() > 0 ) {
        	//log.debug "PSM02 DOOR OPEN"
            map.value = "open"
            map.descriptionText = "$device.displayName is open"
        } else {
        	//log.debug "PSM02 DOOR CLOSED"
            map.value = "closed"
            map.descriptionText = "$device.displayName is closed"
        }
        break;
    case 12: // motion sensor
        map.name = "motion"
        log.debug "PSM02 cmd.sensorValue: ${cmd.sensorValue}"
        if (cmd.sensorValue.toInteger() > 0 ) {
        	//log.debug "PSM02 Motion Detected"
            map.value = "active"
            map.descriptionText = "$device.displayName is active"
        } else {
        	//log.debug "PSM02 No Motion"
            map.value = "inactive"
            map.descriptionText = "$device.displayName no motion"
        }
        map.isStateChange = true
        break;
}
//map
createEvent(map)

}

The PSM02 are 400 series devices I believe, while the PST02 are 500 series devices.