Phyn integration - Water leak detector

Thanks! I was also working on an integration, but only just started cracking into the API. I made a fork of your project and am playing around with it now. Let me know if there is anything specific you would like help with to push the integration along, looks to be nearly there.

2 Likes

Thanks for the offer. For the moment I think Iā€™m in good shape. By just adapting the Flo integration, Iā€™ve been able to move all of this along quickly. I started updating a custom integration on GitHub, and sensors seems to be working fine. Needs some documentation, a valve switch, and an easier way to use the aioflo library (as I donā€™t want to post on pypi yet). But its functional!

3 Likes

Test drive available.

8 Likes

Tested it out and things are working well so far. I created icons and logos for the integration in both light and dark mode and submitted a pull request in home-assistant/brands Adding brand phyn for new phyn custom integration by helicopterrun Ā· Pull Request #4033 Ā· home-assistant/brands Ā· GitHub These should be able to be added to your code once the pull is approved.

3 Likes

The pull request has been successfully merged with home-assistant/brands within the custom-components folder. I also noticed a few little bugs in the integration so far, so Iā€™ll create an issue once I get time. Overall itā€™s working fantastic.

2 Likes

Installed and works for the original Phyn Plus! Thank you for this integration!

The smart water sensors do populate as devices named Phyn pw1 with a daily water usage. In the app they usually show Temperature, Humidity not sure if you want to ignore these or add them. Either way thank you for putting the time into this!

Good to hear! I donā€™t have any smart water sensors, so itā€™s not immediately clear how to integrate those sensors. Iā€™d probably need some api calls captured from them to figure it out, unless there is another developer out there who can investigate. Maybe I can figure out the new ā€œdownload diagnosticsā€ feature to help?

1 Like

Excited to see this.
Was looking at the smart water assistant since I donā€™t need the valve but reviews are a mixed bag.
Do you all recommend it if not already purchased? Or too good to be true?
Happy to move this to another thread if you want to keep this one to development.

Iā€™m excited to try out the Test Drive. Unfortunately, when I enter my Phyn username and password, I get ā€œUnknown error occurredā€. I checked the logs and it looks like it doesnā€™t like my username. I have verified that the username are correct by logging in and out of the Phyn app.

Here are the last few lines from the log, let me know if you would like more:

File ā€œ/config/custom_components/phyn/config_flow.pyā€, line 46, in async_step_user
info = await validate_input(self.hass, user_input)
File ā€œ/config/custom_components/phyn/config_flow.pyā€, line 31, in validate_input
return {ā€œtitleā€: homes[0][ā€œalias_nameā€]}
KeyError: ā€˜alias_nameā€™

1 Like

Iā€™ve been testing this for a couple weeks, and it has been working wonderfully. Thank you for the work on this. I had been hoping for a long time to be able to control the Phyn valve from Home Assistant and use the sensor data (knowing the minimum water temperature available is important in some of the baking I do). I have my daily water usage running in energy cards, and itā€™s awesome being able to see our water use and track the cost. The one additional feature that would be great to have access to is the away mode where Phyn becomes extra sensitive to any water usage. Is the away mode exposed in the API by chance?

Would you be able to dumb down how to initialize the api calls outside of HA? I should be able to then print the results and send them your way if that helps for the PHYCF006 water sensors?

Absolutely brilliant, MizterB and bog thanks for your work on this thus far. It has been bugging me for some time that I could not add my Phyn to HA - I believe this should add a lot of value to Phyn as improved considerability for the product as well. Their promise to open it up via HomeKit is getting staleā€¦

I have been using the sensor now for almost a week, and it seems to working great. Any thoughts on making the notifications come alive? Would be great to be able to have HA react on water alerts and be able to set the valve status correctly to handle false positives from teens showering too long etc would be great. Also second the away_mode request that @jsteele made, HA could make use of motion sensors to set it more proactively, particularly if able to handle the false positives.

I am having the same issue.
I am assuming the username is in email format? as that is how you log into the app. Can anyone with it working validate that? also is it possible its special characters in email address? like periods?

Based on the error, I donā€™t think itā€™s an auth problem. Itā€™s failing trying to get the name of your house AFTER authenticating, so it can name the configuration correctly.

I can fix via code, but in the meantime, try this:

  • Got to Settings - Home - Address
  • Make sure the ā€œHome nameā€ field (last line) has a value. Mine is ā€œHomeā€.
  • Save
  • Try setting up in HA again
1 Like

Yes, I know how to control the away mode. I will get that included.

3 Likes

I know how to retrieve alerts, not sure how best to integrate them into HA.

I will try to move more of API endpoints into aiophyn, if others want to contribute PRs to help integrate with HA.

2 Likes

This is amazing, thank you for working on this!

I was wondering ā€“ is there a way to make real-time information available as well (say, for flow and pressure, as displayed in the app)? Iā€™d love to be able to make some custom alerts based on those.

I pushed a change to aiophyn to dump the details for all devices in an account.

Install the latest library:
pip3 install git+https://github.com/MizterB/aiophyn.git@main#aiophyn==2023.1.0

Run this:
python3 -c "from aiophyn.utils import device_dump"

You will be prompted for username and password, then the device info will be dumped as JSON. Send me that JSON, and Iā€™ll see what I can do with it. Feel free to inspect and scrub data if you have privacy concerns, but I specifically excluded all account and home data. Itā€™s just the devices.

1 Like

I wish I could - this would be much more interesting that the ā€˜averageā€™ data currently provided. Iā€™m sure youā€™ve seen the realtime flow/temperature data in the Phyn app. Unfortunately, I have been unable to sniff that data and determine how it is obtained. If I turn on a faucet with the app running, the sniffer shows no change. I suspect there may be some sort of websocket connection that I cannot see. So I canā€™t help at this time, but welcome help from anyone else with experience in reverse engineering APIs like this.

This was perfect! Iā€™ve sent over the output via a PM. If I can send any further data or output please let me know!