I have a PIR that thinks it’s a door sensor and therefore reports Opened & Closed. (but that’s not the problem). In Smartthings using Notify Me When, all works fine, I can use ‘Contact Opens’ and get Smartthings to do something. I’m trying to write a CoRE Piston to do the same type of thing however cannot figure out what comparison to use and what value to check for. Opened & Closed don’t work and return False. I’m sure this is very simple, I’m sure someone knows what value I should be checking for.
The Smartthings Hub picks up the sensor and as I mentioned the off-the-shelf SmartApps like ‘Notify Me When’ pick up it changing state ok so it isn’t doing anything unusual it’s more of understanding how CoRE sees the messages coming from it via the Smart Hub.
It came in as a Sensor not a motion detector but I can live with that.
When I look at it in ‘Things’ and then in ‘Recently’ it is shown switching between ‘closed’ and ‘opened’ so Smarthings is happy with it.
The issue for me is how I get a CoRE Piston to see the status. In a ‘Condition’ I can set a ‘Capability’ of ‘Sensor’, the PIR appears in the list and I can select it. It’s when I get to ‘Comparison’. I can select ‘Is’ but if I give it a ‘Value’ of either ‘opened’ or ‘closed’ it always returns the Boolean value of ‘False’. The PIR is most likely sending out either 0 or 1 but I can’t figure out what CoRE is doing with that and therefore how to test it. As I mentioned before, the device works fine with ‘Alert Me When’ so it’s not the device or Smartthings.
fixing it in core is a bandaid. you need to get the correct device handler so it actually reports motion events. When you login to the ide and go to the device page, what does it say for Type?
Thanks for your support. I managed to ‘fix’ this in CoRE. I changed the ‘Capability’ from ‘Sensor’ to ‘Contact Sensor’. Using a ‘Comparison’ of '‘IS’ CoRE then gave me 2 pre-populated ‘Value’ options of ‘open’ and ‘closed’ and the Piston then started to work. Sometimes it’s the simple stuff that catches me out (and I’m, in the dim and distant past, a qualified programmer!)
lol, its still a bandaid. it still won’t work with any other app looking for motion copability. It takes 2 minutes to go into the IDE, find the device and look at the type. most likely it is assigned the wrong type