Use Neato status to trigger piston?


#1

I just got a Neato D5 Connected and linked it to SmartThings using this SmartApp code:

It seems pretty complex, I already created a piston that enables extraCare navigation method and then turns on the vacuum cleaner in the mornings.

I’d like to create a variable (“cleaned”) that is set to true after cleaning, and set to false every time I go to sleep. I checked the code and noticed that it mentions “paused”, “cleaning” and “docked” states. Can anyone help me understand if this could be set as a trigger in a piston? (I’d like to use the “docked” status change).

Is there any way I can monitor all the status changes of a device? Like some kind of log that shows every change I could then use to create trigggers?

Thanks!
Rodrigo


#2

I see all types of actions displayed in the activity feed. Can I use any of these as triggers for pistons?


#3

I am not sure if custom attributes will trigger events without trying it but one thing you can do is check the status of the attribute. Knowing that, you can poll the device at certain intervals to see if the value has changed, in your case you’re interested in the docked status.

Try to build a sample piston, select your Neato as the device, and take screen shot of the available attributes.


#4

I was doing some testing and noticed that the Neato in webCoRE has the switch function too, so I set the CLEANED variable to change to true when Neato’s switch was turned ON for more than 10 minutes. I think this is going to work, but I’m still curious if there could be a more complex communication. Checking the source code for the IDE it mentions “off”, “docking”, “docked”, “cleaning” and “error” “status” but I don’t know if this is usable from webCoRE

R.


#5

While viewing a piston, any piston, scroll down to the bottom and go to the Evaluation Console. In Expression mode, you can type [NeatoDeviceName:status] or in Value mode {[NeatoDeviceName:status]} – it should output the Neato’s current device status. Try running the vac and do the same command and see if the value changes.

image


#6

Am I writing it right?
This is how its name shows on the piston and it works fine:
image

And this is how I wrote it on the Evaluation Console:

I’m not seeing any changes.

Meanwhile this is what the SmartThings app shows:

(I started the cleaning AFTER setting these things in the console)

Thanks!
R.


#7

Hmm, what result did you get while the vac was running?


#8

Are the results supposed to appear right there in the evaluation console? Nothing changed there.


#9

What other attributes do you have… this is from an ecobee thermostat…


#10

This is what webCoRE shows:

What’s the difference between the things that appear with that little tag on the left ($status, bin, checkInterval) and the others (battery, status, switch)?

And this is what I’m looking in the IDE source code (I have no idea if this is actually related to what I want to do, it just sounded like it)


#11

The ones with the icons are custom attributes provided by the device handler. The $status I believe was added to show how ST sees your device if offline/inactive or something similar to that.


#12

Found it! I changed the device name because I was worried about the spaces and dash (and also because it didn’t look nice, lol), but then I noticed that in the console I failed to select “expression” in the first test.

Now, which is the right way to use these “expressions” to run pistons?


#13

I personally use Expression just so I don’t have to worry about the curly brackets.

Edit: now you can try a test piston to watch the status attribute, like If status changes to cleaning then blah blah.

On phone at the moment so can’t really format stuff properly… sorry, more like too much effort. :grin:


#14

It worked now, I don’t know what I was doing wrong but in the first try it didn’t work as expected. Anyway thanks! I didn’t know about the evaluation console and it helped me understand some things :slight_smile:


#15

It’s useful in debugging… you can perform your calculations etc within the console instead of editing and running the piston, in most cases where you’re not relying on too much operations.