Help needed with dth please

hi i have taken the reed switch out of a sonoff snzb-04 and conecter a rain sensor thing im using the Simulated Water Sensor driver but when its dry it shows as wet and when its wet it shows as dry ad i dont know how to make it right . i want to use it as a rain sensor ,any help would be great thanks.

Hi, @montyfert!

Is this still a Zigbee device?
Groovy-based integrations (like DTH) are part of our Legacy platform (take a look at this announcement) so, I suggest you start with Edge drivers instead so your efforts aren’t in vain.
However, in the case of a DTH, you should check the parse() method, where all the messages are received and “translated” to the corresponding capability values.

hi yes it is still a zigbee driver ,unfortunately i wouldnt know how to make an edge driver, im completely baffled by the dth things.
i compare my technical knowedge to a crow trying to knit lol .

Can you share the DTH that you’re currently using, please? Just to take a look at it.

for some reason its not wotking at all today with the simulated water sensor dth i changed it to the Z-Wave Water Sensor dth and is working again but wet when its dry etc lol

this is the dth


If the DTH that works for your device is Z-Wave Water Sensor, then, you can create a copy in your IDE and make the changes necessary.
Based on your description, you need to check the value of these parameters:

To print those values you can use this line before createEvent: "description: ${description}"

There is where the events for the capability are generated and you will be able to check why are the events reversed or translate them accordingly.

This process can be a little tedious because there’s no documentation about Groovy DTH anymore.

1 Like

hi sorry not sure what you mean

thanks for the help
but its sorted now thanks someone sugested creating a virtual water edge driver and using automations to controll that and it working great . thanks