Moisture sensor in new app

In the past I have used a smart things moisture sensor with wires soldered on to the contacts, and connected to a pressure pad, to operate as a chair sensor, to alert when someone gets up from a chair.
This was done in the IDE and would change the alert sent from the moisture sensor from wet or dry to vacant or occupied.
This was set up from the classic app, under the “Smart home monitor” then custom tab.
Is there a way to do this in the new smart things app? I have explored it as far as my experience allows but whatever I change the text to in the IDE the alert sent is always wet or dry.
Im not a programmer or anything (I work in adult care) in case anyone wonders why I would need a chair pad.
so hopefully if there is a way to achieve what I need it won’t be too challenging.
Thanks for looking

Have you tried using that device in an automation in the new app to see what capabilities it exposes? from the home screen, tap + in the upper right and choose Automation.

1 Like

Hi thanks for the reply
yes I have been through all the smart apps and automation without success
The wording still says wet or dry

not sure what you mean by wording? In the automation creator you type your own notification.

1 Like

I’m not entirely sure I have got the right end of the stick here, but …

A moisture sensor device handler will be built around the Water Sensor capability. That is defined with a single attribute water, which is allowed to have the value wet or dry. However much you dress it up, all that remains true.

The device handlers have a tiles() section that allow you to create a custom user interface for use by the Classic app. Why the UI is defined in the device handler is a mystery to me, but that is where it is. This lets you mess around with how things are presented, and in particular mess around with text. So you can make the UI say ‘vacant’ instead of ‘wet’ and ‘occupied’ instead of ‘dry’. However, if you access the device from another app, you are still going to see a Water Sensor with values wet and dry unless you really abuse things.

The ‘new’ app behaves differently. It doesn’t use the tiles() stuff, it works with the capabilities the device handler defines. It is a Water Sensor so it expects a water attribute with wet and dry and has a predefined way of presenting it.

That is not to say that things are always presented literally. The Acceleration Sensor capability, for example, appears as a ‘Vibration Sensor’. The Occupancy Sensor capability displays ‘unoccupied’ as ‘Away’ and ‘occupied’ as ‘Inside’. However you are stuck with whatever has been predefined.

Things aren’t going to stay that way for ever, it is just that the tools to play around with the UI a bit more haven’t been released yet, if indeed anyone has started writing them. We just have to be patient with things.

So what to do? Well I think what I would consider is turning the Water Sensor into something a bit more sympathetic to your needs such as a ‘Presence Sensor’ or an ‘Occupancy Sensor’. The exact process depends on the device handler but the two main things to do would be:

  1. Change capability "Water Sensor" to capability "Presence Sensor".
  2. Hunt down areas of the code that mention the ‘name’ "water" and ‘value’ "wet" and "dry" (there may be more than one reference), and change them to "presence", "present" and "not present" (or vice versa depending on how the pressure pad works).

The tiles() section would also now be nonsense, but if you aren’t using the Classic app it doesn’t do anything anyway.

1 Like

That makes sense thank you
I will try that on Monday

Thanks all for the suggestions so far
Well I got around to taking another look today and
I’ve tried to modify the code for the device handler I was using with the advice you suggested, changing all instances of “water” to “presence”, “Water Sensor” with “Presence Sensor”, “wet” with “present” and “dry” with “not present” but I’ve had no luck getting it to work. It seems to stop the tile from functioning showing the icon of a presence sensor with the status of “dry” permanently? When I drill down into the details it shows both “present” and “not present” within the same second, regardless of if I’ve triggered the event longer than a second…

I’ve checked it in the old version of the app and it seems to work with no issues? I’m not sure what’s causing the problem as when I’m checking the events in both older app and the IDE it seems to be working as intended