My first DTH - Particle Core valve controller - need some help

(Jeff) #1

ok so… I am not a programer at all… and am probably in over my head a bit but I’m making a bit of progress…
but if anyone could offer me a kick in the right direction that would be great!

I am trying to setup my Particle Core as a water valve controller. the goal is to have it run two relays (one to open the valve & one to close the valve) and monitor two pins for teh current valve state. the code on the Particle side I’m good with but not so much on the smart things side…

right now I have the core responding to taping my tile and activating the open or close relay and I have smart thing polling my core to get the current valve status and reporting it to the debug log.

what i cant seem to figure out is how to tell smart thing the valve status… when I click open i get the opening then back to closed I have gone through the documentation but can not figure out how to update a device status on the ST end…

looking at other device handlers I’m guessing its sendEvent() but even after reading the documentation I can not seem to get that working…

my goal would be to use GetValveState() to update the valves current state:
0 = open
1 = closed
2 = error (valve is between open and closed)

here is my testing code. i have removed a bunch of the logic to try and simplify things in order to figure it out but no real luck so far

edit: never mind i got it! I was using createevent i should have been using sendevent