dkerr64 / homebridge-yolink

Apache License 2.0
12 stars 2 forks source link

WaterMeterController Support (YS5008-UC and YS5006-UC) #98

Closed ssnthedj closed 1 month ago

ssnthedj commented 2 months ago

Please add support for Water Meter controller YS5008-UC

https://shop.yosmart.com/pages/ys5008-support

This is a brand new product from Yolink so I understand why it is not supported yet but it would be awesome if it could be added. I think this product will be quite popular at it's price point. Way cheaper than Moen Flo or Phyn Plus.

dkerr64 commented 1 month ago

@miztahsparklez opened #100 for Yolink YS5006-UC which I closed as duplicate of this issue. Looking at the JSON status provided for it, there are two notable differences... unlike the YS5008-UC this device does not report waterFlowing or temperature values.

Current plugin beta should work for the YS5006-UC, but I will have to put in some special handling to not add a temperature accessory to HomeKit.

The JSON also shows "battery": 4, "powerSupply": "PowerLine", so we now know what is reported when the valve has permanent power connection... but I don't think there is anything to pass back to HomeKit for this.

dkerr64 commented 1 month ago

@ssnthedj and @miztahsparklez please try beta.10 that I just published. I simplified the code a bit and only add temperature sensor if it exists (to properly support the YS5006-UC).

Thanks

miztahsparklez commented 1 month ago

Cool, I was able to see a "Running" status with the YS5006.

I was able to dig up some old documentation: https://forum.iobroker.net/assets/uploads/files/1634848447889-apple-spezifikation-homekit.pdf

It seems that the required characteristics are : Active, In Use, and Valve Type.

I'd assume Active is the on/off of the valve. In Use is if water is flowing (does yolink return a boolean value? I guess you solved this by the "waterflowing" value above.) , and valve type would be genericValve (although, I wonder if irrigation or one of the other valve types would allow for different options).

I know for my LG washer/dryer via homebridge plugin can also show time left, which is likely using Set Duration or Remaining Duration. However, I wonder if any of these could show how long the water has been running. Could we use any of the overrun values or possibly show meter information? I am betting the "waiting..." we are seeing is this time value.

Also, note for OP, I don't suggest trying to automate leak sensor activities via homebridge. However, it is interesting to view status or trigger other activities based on valve status or flow (turn on a light, for example).

dkerr64 commented 1 month ago

@miztahsparklez Yes you will see "running" status because I set the InUse characteristic based on the valve being open or closed... we're assuming that water is running when it is open. The YS-5006 does NOT send a separate waterFlowing status (based on the data you provided in #100 ) whereas the TS-5008 does. But as you can see in the above discussion we have determined that we cannot rely on the waterFlowing status to be accurately reported. I'm documenting it in the readme here.

I am familiar with the documentation you linked, I used it extensively when creating this plugin. The duration information is for irrigation valve types, and we do not use that type in this plugin. Also, I do not know what the overrunXxx status values are meant to report.

dkerr64 commented 1 month ago

Just a note that YoLink have now published some API documentation for this device.. So when I get a chance I will review it to see if any changes need to be made to this plugin.

Otherwise, if folks monitoring this thread are happy... I'll switch from beta and release a mainline update.

miztahsparklez commented 1 month ago

Sounds good! I think if you communicate with the expectation of what people will see, I think it's a worthwhile improvement from what it was before and gets the basic point of on/off and in use.

The overrun values correspond to "maximum continuous water usage", "maximum continuous water usage duration", and likely the leak detection schedule. Usage is measured in volume. Duration is a time limit. Schedule is usage over time. Any of these can be set to trigger the valve to turn off within the Yolink app.

My thought was if you used the water usage duration, there would hopefully be some sort of countdown to 0, or maybe a count up for how long the water has been on (and maybe this is your indicator for determining in use if non zero value).

dkerr64 commented 1 month ago

Support released in version 1.6.0

ssnthedj commented 1 month ago

@dkerr64 thanks for all your heard work on this! I've been out of town and thus have not been able to test beta 10 yet with my device. I will be back Sunday afternoon and should be able to update and test that evening.