OK I’ll bite. What DTH is your source? You say the ‘standard Water Sensor’ one, but which one is that? Is it smartsense-moisture-sensor.groovy
for example?
The bottom line with the DTH is that messages from the device will arrive as arguments to the parse()
method. The parse()
method processes them, typically with some help, and the end result is usually a map that it uses as the argument to createEvent()
. So if the water sensor is alerting you that water has been detected the parse method will end up returning createEvent( name: 'water', value: 'wet' )
(often with a descriptionText: 'message'
as well). SmartThings will take that return value and use it to set the appropriate attributes and propagate change events to anything that is interested in them.
Custom capabilities haven’t been released yet, so if you want your DTH to be useful it has to work with a standard capability. So if you don’t want it to be a Water Sensor, which uses the attribute ‘water’ with values ‘wet’ and ‘dry’, you need it to be something else binary.
Here are some possibilities:
Water Sensor water wet dry
Switch switch on off
Contact Sensor contact open close
Motion Sensor motion active inactive
Can you see where this is going? You replace the capability 'Water Sensor'
with whatever capability you want to use e.g. capability 'Switch'
. Then you track down where the moisture alarm is being processed and look for the map being generated. You change the name: 'water'
to e.g. name: 'switch'
and value: 'wet'
to e.g. value: 'on'
(likewise for 'dry',
of course).
You will have a tiles()
block that creates the custom UI for the Classic app. That will need adjusting too, but if you don’t use the Classic app just junk the entire tiles()
block as you don’t need it.