The gocontrol motion sensor also detects temp!

Mine seems to report small changes when it’s being “chatty” example… 3am:67.0, nothing for 9 hours then 66.7,67,66.7,67. Sometimes it seems to transmit every 30 minutes. Other times I thought maybe it was sending temp at times it detected motion, but then I see a lot of temp readings 2am-4am without motion. :confused:

1 Like

First off, John Lord, THANK YOU! Your script is the first one of many that actually returns a battery level for me for the gocontrol motion detectors that I have.

Unfortunately for the life of me I can’t seem to get the code to run in Celsius instead of Fahrenheit. I’ve changed the unit:“C”, map.unit = cmd.scale == 1 ? “F” : “C” to map.unit = cmd.scale == 1 ? “C” : “F” but nothing seems to work, the motion detectors still report Fahrenheit on the tile (setting off my air conditioner prematurely :-p)

Incidentally, the hub is set up to be in Celsius and the script appears to ignore that.

Any idea what I am missing here?

Thanks in advance!

Have you tried just converting it mathematically? It’s What I had to do with my scale to display pounds instead of kilograms

I guess I need to understand where the base variable is controlled. If I change the tile label it will look good, but my IFTTT routines, and others will be calculating on Fahrenheit still, no? Where exactly in your code would I put the TempC = ((TempF - 32) × 5 / 9) so that it reports the same to anything that calls on it?

Cheers,

C

this part: def cmdScale = cmd.scale == 1 ? “F” : "C"
you can’t just swap the f and the c. that’s actually a java shortcut method of doing an if statement.
similar to this: if (cmd.scale==1 {
cmdScale=“F”}
else{cmdScale = “C”}
you could replace that whole line with cmdScale = “C”

however look here: def value = preValue as float

it creates a value as a float then assigns prevalue to it. You can change prevalue here. I’m not sure where the scaling is supposed to take place since the function is built-in somehow to groovy, but if it’s not working correctly then simply hardcode it to be value=((preValue-32) * 5 / 9). I’m pretty sure you’ll also have to do this separately for the tile though. This will force it to return celsius on the z-wave polling.
first though i would simply try hardcoding cmdScale to “C” though. It may be all you need to do.

Thanks, yes, that was the first thing I tried (swapping the “F” : “C” to “C” : “F” unfortunately it did nothing to the tile.

What is odd is if I look at the event logs for the detector, it is showing valid Celsius figures, infact the tile temperature is not changing on my android nor is the current state changing on graph-na02-useast1.api.smartthings.com, but the events on both are showing accurate Celsius updates.

Thoroughly confused now.

the underlying code supports c or f but the tile doesn’t. You will have to change the unit to “C” there. I’m not sure if that will change currentvalue automatically but at the least you will need to modify the color gradients to represent celsius. The app i based this on wasn’t region-aware.