# Can someone help me write a code for a contact sensor

**URL:** <https://community.smartthings.com/t/can-someone-help-me-write-a-code-for-a-contact-sensor/13121>\
**Category:** Writing SmartApps\
**Created:** [March 20, 2015, 9:00pm UTC](https://community.smartthings.com/t/can-someone-help-me-write-a-code-for-a-contact-sensor/13121 "2015-03-20T21:00:51Z")\
**Posts on this page:** 1\
**Showing post:** 36

<div class="post-metadata">

**Author:** ![tslagle13](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/tslagle13/32/16380_2.png) [@tslagle13](https://community.smartthings.com/u/tslagle13)\
**Post date:** [March 20, 2015, 11:15pm UTC](https://community.smartthings.com/t/can-someone-help-me-write-a-code-for-a-contact-sensor/13121/36 "2015-03-20T23:15:13Z")

</div>

> [@jodyalbritton](#):
>
> The bathroom is probably the hardest room in the house.

Agreed 😄

Here’s my philosophy when i write an app. I try not to assume for any variable. If i don’t have emperical data about a situation i tend to not write it into an app. This is what I would do.

1. You could custom make a trip sensor for the bath that would override all the different inputs for the smart app. SO when someone enters the shower the light stays on permanently.

> [@Laser Trip Sensor?](http://community.smartthings.com/t/laser-trip-sensor/6742):
>
> Has anyone seen a laser or infrared trip sensor in z-wave or zigbee? Pretty much your typical mission impossible style sensors where breaking the beam would trigger an alarm? I have a few very specific areas where motion sensors are giving too many false alarms or the area they detect is too wide.

2.You could use a moisture sensor in the bathtub that would also do the same thing when water is detected. Same thing here. It would over ride the other sensor inputs until no water is detected.

> [@My Christmas Tree low water alert setup](http://community.smartthings.com/t/my-christmas-tree-low-water-alert-setup/7865):
>
> I wanted to get alerts when my tree water was low… I tried the Utilitech water sensor but it beeps when there is water. I picked up a PEQ water sensor from Bestbuy and I made a small bracket on my 3D printer. I connected a wire to the 2 terminals on the water sensor. I then zip tied the bracket to the tree at the height I wanted. Sensor hangs outside the tree. I then used the No water app and I get push and SMS notification when my tree water gets low…works great. I was also thinking about making the tree lights blink…but the Flasher app does not list moisture sensor as an option.

---

_[View the full topic](https://community.smartthings.com/t/can-someone-help-me-write-a-code-for-a-contact-sensor/13121)._
