Phyn integration - Water leak detector

I figured it out. logger: instead of logging:

Also, similar logging results:

2023-11-05 14:34:10.691 INFO (MainThread) [aiophyn.mqtt] Creating timer
2023-11-05 14:34:10.691 INFO (MainThread) [aiophyn.api] Auhenticating to Kohler
2023-11-05 14:34:10.692 DEBUG (MainThread) [aiophyn.partners.kohler] Logging into Kohler
2023-11-05 14:34:12.724 DEBUG (MainThread) [aiophyn.partners.kohler] Received Kohler Token
2023-11-05 14:34:12.724 INFO (MainThread) [aiophyn.partners.kohler] Getting Kohler settings from Phyn
2023-11-05 14:34:16.711 DEBUG (MainThread) [aiophyn.partners.kohler] Getting token from Phyn
2023-11-05 14:34:18.982 DEBUG (MainThread) [aiophyn.partners.kohler] Token received
2023-11-05 14:34:18.997 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File “/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py”, line 433, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py”, line 504, in _handle
resp = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py”, line 117, in impl
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/components/http/security_filter.py”, line 85, in security_filter_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/components/http/forwarded.py”, line 100, in forwarded_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/components/http/request_context.py”, line 28, in request_context_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/components/http/ban.py”, line 80, in ban_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/components/http/auth.py”, line 236, in auth_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/components/http/headers.py”, line 31, in headers_middleware
response = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/components/http/view.py”, line 148, in handle
result = await handler(request, **request.match_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/components/http/decorators.py”, line 63, in with_admin
return await func(self, request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/components/config/config_entries.py”, line 177, in post
return await super().post(request, flow_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/components/http/data_validator.py”, line 72, in wrapper
result = await method(view, request, data, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py”, line 110, in post
result = await self._flow_mgr.async_configure(flow_id, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/data_entry_flow.py”, line 293, in async_configure
result = await self._async_handle_step(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/data_entry_flow.py”, line 389, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/config/custom_components/phyn/config_flow.py”, line 52, in async_step_user
info = await validate_input(self.hass, user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/config/custom_components/phyn/config_flow.py”, line 29, in validate_input
api = await async_get_api(
^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/aiophyn/api.py”, line 192, in async_get_api
await api.async_authenticate()
File “/usr/local/lib/python3.11/site-packages/aiophyn/api.py”, line 142, in async_authenticate
await self._partner_api.authenticate()
File “/usr/local/lib/python3.11/site-packages/aiophyn/partners/kohler.py”, line 59, in authenticate
self._phyn_password = await self.token_to_password(token)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/aiophyn/partners/kohler.py”, line 198, in token_to_password
return unpad(cipher.decrypt(bytearray.fromhex(ct)), AES.block_size).decode()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/Crypto/Util/Padding.py”, line 92, in unpad
raise ValueError(“Padding is incorrect.”)
ValueError: Padding is incorrect.

Thanks for the logs. I believe I see what the issue is and I’ll have to do some work to figure out how I can fix it.

1 Like

Really appreciate it! If I can help with anything please DM me and I am happy to try.

Thank you!!

I just released an update (v2023.11.0b0) that should fix the issue you ran into. If you don’t mind letting me know whether it works one way or another, that’d be much appreciated.

1 Like

That did it, thank you so much!!!

@shdw Looks like the device stopped reporting things correctly. I.E. water flow is no longer accurate. Are you having any issues?

Is anyone else having issues with the Phyn Integration. Mine stopped working. I deleted and tried re-adding. it won’t authenticate.

image

When I go to the Integration details, it no longer appears to be defined anymore.

I think something has changed. Even with the Kohler H2Wise+ my automations are no longer working. Seems like they changed something with realtime info as the automations I setup stopped working and are very sporadic now.

I’ve been busy but am starting to get back at finishing and finalizing the realtime updates.

1 Like

Really appreciate it! If you have a way I can donate to your cause I am happy to help!

I tired re-adding this and it’s working again for now.

FYI, installing the fork https://github.com/jordanruthe/homeassistant-phyn via HACS and using with the original Phyn Plus (PP1) 1st Gen Model of the Phyn Smart Water Assistant from Belkin/Uponor/Wemo/Zensi (Foxconn Interconnect Technology) works great!

Thank you for improving this custom integration! Looking forware to more extensions with new entities!

I just installed an available update and it works really well now. I appreciate the fix!!

1 Like

What updates are you referring to? I still see the last update being nine months ago for GitHub - MizterB/homeassistant-phyn

There are several forks and jordanruthe has the most active forked Phyn custom components + others have collaborated and contributed to his forks as well (because upstream repo has been dormant):

If you install from that reposity instead then you should then get the releases that are published here:

https://github.com/jordanruthe/homeassistant-phyn/releases

Installation via HACS

This custom component can be integrated into HACS, so you can track future updates. If you have do not have have HACS installed, please see their installation guide.

  1. Select HACS from the left-hand navigation menu.

  2. Click Integrations.

  3. Click the three dots in the upper right-hand corner and select Custom Repositories.

  4. Paste “https://github.com/jordanruthe/homeassistant-phyn” into Repository, select “Integration” as Category, and click Add.

  5. Close the Custom repositories dialog after it updates with the new integration.

  6. “Phyn Smart Water Assistant” will appear in your list of repositories. Click to open, click the following Download buttons.

A “custom component” is also an integration (and it is also refered to as a “custom integration”) but it is not integrated into the Home Assistant core by default as as such does not ship with Home Assistant core or get updated with it. FYI, official integrations also have components, that are just included in the core. Custom components can become an included integration if submitted and accepted into Home Assistant core, but until it is you as the user must manually install it (either via HACS or other method):

Here is what I show. And, I just got an update to install as well.

For clarity, I am using the H2Wise+ Kohler rebrand of the Phyn device. Wish I would have bought the Phyn one but this was almost half the price when I bought it.

I had the same issue, I bought a Kohler for half the price but the app is terrible and slow. Additionally I don’t think you can add the phyn water sensors, which is unfortunate.

I might be able to figure out a way to add one, but it may be problematic.

I ended up getting a regular phyn for my second use case.

Ironically enough, everything broke now. Likely after the most recent update. I am also signed up for the beta version of HA. Clearly I spoke too soon.

Reinstalled and its working. LOL, not sure what the deal is but I am not going to change anything for a while.