robertvandervoort / SmartThings

156 stars 240 forks source link

how hard would it be to have motion as main tile? #13

Closed Slepperpon closed 8 years ago

robertvandervoort commented 8 years ago

Easy, just change the order in lines 157-158 of the tiles which is currently like so:

main(["main"]) details(["main","humidity","illuminance","ultravioletIndex","motion","acceleration","battery","configure"])

to represent what you want in the main tile which is motion:

main(["motion"]) details(["main","humidity","illuminance","ultravioletIndex","acceleration","battery","configure"])

"Main" is two things technically. "main" is temp and humidity. main() is actually the tile in the list view as well as the upper portion when you're in the device's details. Moving another tile name into main() changes the tile represented in that list view with whatever you want.

Make sense?

Slepperpon commented 8 years ago

Yes that works but how hard would it be to have motion at top of device details page

robertvandervoort commented 8 years ago

You would need to take temperature out of the main block and add it as a value tile and then to the list in whatever position you wanted and then replace it with motion. A little switcheroo action... If you don't feel confident doing it I can do it but I'm out and on my phone and that kind of sucks for working on code.

Slepperpon commented 8 years ago

I was playing with it last night and did just that and it is working thank you for all the help.

Adam Hoffman Aamco Transmission Lee's Summit

On Mar 12, 2016, at 9:19 AM, Robert Vandervoort notifications@github.com wrote:

You would need to take temperature out of the main block and add it as a value tile and then to the list in whatever position you wanted and then replace it with motion. A little switcheroo action... If you don't feel confident doing it I can do it but I'm out and on my phone and that kind of sucks for working on code.

— Reply to this email directly or view it on GitHub.

robertvandervoort commented 8 years ago

For you or anyone else who sees this... Replace the tiles section of the code with this...

tiles (scale: 2) { multiAttributeTile(name:"main", type:"generic", width:6, height:4, canChangeIcon: true, canChangeBackground: true) { tileAttribute("device.motion", key: "PRIMARY_CONTROL") { attributeState "active",label:'motion',icon:"st.motion.motion.active",backgroundColor:"#53a7c0" attributeState "inactive",label:'no motion',icon:"st.motion.motion.inactive",backgroundColor:"#ffffff" } } standardTile("motion","device.motion", width: 2, height: 2) { state "active",label:'motion',icon:"st.motion.motion.active",backgroundColor:"#53a7c0" state "inactive",label:'no motion',icon:"st.motion.motion.inactive",backgroundColor:"#ffffff" } valueTile("temperature","device.temperature", width: 2, height:2) { state "temperature",label:'${currentValue} ° ${scale}' } valueTile("humidity","device.humidity", width: 2, height: 2) { state "humidity",label:'RH ${currentValue} %',unit:"" } valueTile("illuminance","device.illuminance", width: 2, height: 2) { state "luminosity",label:'${currentValue}', unit:"${unit}", backgroundColors:[ [value: 0, color: "#000000"], [value: 1, color: "#060053"], [value: 3, color: "#3E3900"], [value: 12, color: "#8E8400"], [value: 24, color: "#C5C08B"], [value: 36, color: "#DAD7B6"], [value: 128, color: "#F3F2E9"], [value: 1000, color: "#FFFFFF"] ] } valueTile("ultravioletIndex","device.ultravioletIndex", width: 2, height: 2) { state "ultravioletIndex",label:'${currentValue} UV INDEX',unit:"" } standardTile("acceleration", "device.acceleration", width: 2, height: 2) { state("active", label:'tamper', icon:"st.motion.acceleration.active", backgroundColor:"#ff0000") state("inactive", label:'clear', icon:"st.motion.acceleration.inactive", backgroundColor:"#00ff00") } valueTile("battery", "device.battery", decoration: "flat", width: 2, height: 2) { state "battery", label:'${currentValue}% battery', unit:"" } standardTile("configure","device.configure", decoration: "flat", width: 2, height: 2) { state "configure", label:'config', action:"configure", icon:"st.secondary.tools" } main(["main"]) details(["main","temperature","humidity","illuminance","ultravioletIndex","acceleration","battery","configure"]) }