Code Monkey home page Code Monkey logo

homeassistant-phyn's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

homeassistant-phyn's Issues

Phyn Integration Stopped working. Tried delete/re-install, but failing

I've had the Phyn HASS integration working for about a year. I noticed the other day it was erroring out. I deleted it and tried to re-install it, but I get an error.

Has something changed on Phyn's side causing this error/issue?

image

Logger: homeassistant.config_entries
Source: config_entries.py:402
First occurred: December 14, 2023 at 7:11:17 PM (3 occurrences)
Last logged: 12:44:25 PM

Error setting up entry My House for phyn
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/phyn/init.py", line 28, in async_setup_entry
hass.data[DOMAIN][entry.entry_id][CLIENT] = client = await async_get_api(
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiophyn/api.py", line 140, in async_get_api
await api.async_authenticate()
File "/usr/local/lib/python3.11/site-packages/aiophyn/api.py", line 104, in async_authenticate
auth_response = await asyncio.wrap_future(future)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiophyn/api.py", line 114, in _authenticate
client = boto3.client("cognito-idp", region_name=COGNITO_REGION)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/boto3/init.py", line 92, in client
"""

File "/usr/local/lib/python3.11/site-packages/boto3/session.py", line 299, in client
:type use_ssl: boolean
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/botocore/session.py", line 971, in create_client
self._session = session
^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/botocore/session.py", line 1042, in _resolve_defaults_mode
env_var_names = None

File "/usr/local/lib/python3.11/site-packages/botocore/session.py", line 818, in _get_internal_component
'response_parser_factory')
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/botocore/session.py", line 1140, in get_component
File "/usr/local/lib/python3.11/site-packages/botocore/session.py", line 216, in create_default_config_resolver
try:

File "/usr/local/lib/python3.11/site-packages/botocore/loaders.py", line 471, in load_data
File "/usr/local/lib/python3.11/site-packages/botocore/loaders.py", line 142, in _wrapper
File "/usr/local/lib/python3.11/site-packages/botocore/loaders.py", line 453, in load_data_with_path
:type extra_models: iterable of dict
botocore.exceptions.DataNotFoundError: Unable to load data for: sdk-default-configuration

[REQUEST] Real-time sensors for water flow, pressure, and temperature?

Can currently only see sensors for the average water flow-rate, water pressure, water temperature in this Phyn integration.

Is it possible to add real-time sensors as well for the water flow-rate, the water pressure, and the water temperature?

At least the water pressure and water temperature need to be real-time to be of any real use as those are key values to keep track of to prevent leaks or damage to appliances and frozen pipe bursts.

PS: The original Phyn app/software does show real-time data and for example warns of "High Base Pressure Alert" if the average water pressure is higher than 80 psi over the past 24-hour period or warns of "High-Pressure Warning" if the water pressure is much higher than normal for more than 1-minute and gives the recommendation to install a PRV (Pressure Reducing Valve), just as it gives a "Freeze Warning" or "Freeze Emergency" warnings depending if the temperature is too low or a combination of lower temperature and high pressure during a shorter period.

References:

https://phynsupport.my.salesforce-sites.com/FAQ/article_Datacategory1?id=3

https://helpcenter.phyn.com/help/i-got-a-high-base-pressure-alert-what-does-that-mean-and-what-should-i-do

https://helpcenter.phyn.com/help/what-are-the-normal-water-pressure-ranges-and-when-is-a-high-base-pressure-alert-sent

https://helpcenter.phyn.com/help/i-got-a-freeze-warning-alert-what-does-this-mean-and-what-should-i-do-c8c769b6

https://helpcenter.phyn.com/help/what-is-a-pressure-regulating-valve-prv

Phyn Home Name can't be set to "Home" or you'll get an "Unknown Error" during integration setup

First time user having an issue during the setup of the integration / Phyn:

If I enter an incorrect username/password, then I get an error about the username/password in the Logs.

If I enter the correct username/password, then I get an error about homes[0]["alias_name"]:

File "/config/custom_components/phyn/config_flow.py", line 31, in validate_input
return {"title": homes[0]["alias_name"]}
~~~~~~~~^^^^^^^^^^^^^^
KeyError: 'alias_name'

If I change
return {"title": homes[0]["alias_name"]}
to
return {"title": homes[0]}
... then the Integration adds successfully but then I only get the water consumption stats and not the toggles, and not the Phyn gets added as [object][object] or the like...

Did something change with the Phyn API?


Logger: aiohttp.server
Source: /usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py:403
First occurred: 7:22:58 PM (5 occurrences)
Last logged: 7:39:21 PM

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 394, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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'

Phyn username email address is case sensitive

I was getting an error when trying to first initialize saying User Not Found. I couldn't figure it out but then later realized that the Home Assistant UI on iPad defaults to first letter capitalized for email so if my email username with Phyn was "[email protected]" when I first typed it in, the iPad HA app made it "[email protected]".

Turns out, that was enough to cause an API error. So you might want to make everything lowercase on submit?

Add a feature to control away mode for the Phyn Plus device

Corresponding to the feature in aiophyn this feature would add a switch entity to the Phyn device in Home Assistant in order to toggle on/off the away mode.

Switch On = Away Mode Active
Switch Off = Away Mode Inactive / Disabled

This would allow not only monitoring and awareness of the away mode setting, but it could then be used in conjunction with other triggers, scenes and automations to protect your home as well as not cause unexpected functionality.

Example Automation Scenarios:

  1. Disable automated home water use when Away Mode is turned On (for example hot water recirculation, sprinkler system, pet and plant watering systems)
  2. Use GeoLocation / Presence sensors to automatically enable Away Mode when no one is home / everyone leaves and to enable when people return.
  3. Disable automatic away mode when 'guest' mode is enabled so it doesn't inadvertently disable water with a guest in your home

Support for water events connected to entities

Curious if there are any plans to add support for water entities to this integration. For instance if phyn thinks a shower is on it would be nice if there was shower entity that would be represented showing its active and(assuming possible), how much water its using

Integration does not support Phyn setups with Phyn Water Sensors

After working around the issue in #10, I now hit an issue where I don't get my switches from the Integration.

Would anyone be able to help me out as to why it doesn't like _device_state["sov_status"] or _device_state["flow"]?

Is anyone else testing against a Phyn Plus 1st gen (pp1)? Or does everyone here have 2nd gens (pp2)? Could this also be the same issue I reported to @rsocko in #5 where having water sensors (pw1)'s is interfering with logic since the structure is different?

Error while setting up phyn platform for switch

Logger: homeassistant.components.switch
Source: helpers/entity_platform.py:359
Integration: Switch (documentation, issues)
First occurred: 9:59:58 PM (1 occurrences)
Last logged: 9:59:58 PM

Error while setting up phyn platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/phyn/switch.py", line 30, in async_setup_entry
    entities.append(PhynSwitch(device))
                    ^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/phyn/switch.py", line 40, in __init__
    self._state = self._device.valve_state == "Open"
                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/phyn/device.py", line 116, in valve_state
    return self._device_state["sov_status"]["v"]
           ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
KeyError: 'sov_status'

Error adding entities for domain sensor with platform phyn

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:507
Integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: 9:59:58 PM (1 occurrences)
Last logged: 9:59:58 PM
Error adding entities for domain sensor with platform phyn

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1057, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 779, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 879, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 820, in _async_generate_attributes
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 785, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 475, in state
    value = self.native_value
            ^^^^^^^^^^^^^^^^^
  File "/config/custom_components/phyn/sensor.py", line 89, in native_value
    if self._device.current_flow_rate is None:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/phyn/device.py", line 86, in current_flow_rate
    return self._device_state["flow"]["mean"]
           ~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'flow'

Error while setting up phyn platform for sensor

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:367
Integration: Sensor (documentation, issues)
First occurred: 9:59:58 PM (1 occurrences)
Last logged: 9:59:58 PM

Error while setting up phyn platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 367, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1057, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 779, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 879, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 820, in _async_generate_attributes
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 785, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 475, in state
    value = self.native_value
            ^^^^^^^^^^^^^^^^^
  File "/config/custom_components/phyn/sensor.py", line 89, in native_value
    if self._device.current_flow_rate is None:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/phyn/device.py", line 86, in current_flow_rate
    return self._device_state["flow"]["mean"]
           ~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'flow'

Only Daily water usage works for Phyn Smart Water Assistant

Hi. I have Phyn Smart Water Assistant configured, and only Daily water usage works.

image

All the others are grey, I think it should show for Hot and Cold separately. Is this even supported?

If you can show me how I can debug this, I would be happy to help with coding :)

`Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:367
Integration: Sensor (documentation, issues)
First occurred: 12:44:47 PM (2 occurrences)
Last logged: 7:19:52 PM
Error while setting up phyn platform for sensor

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 367, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1057, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 779, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 879, in _async_write_ha_state
state, attr = self._async_generate_attributes()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 820, in _async_generate_attributes
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 785, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 475, in state
value = self.native_value
^^^^^^^^^^^^^^^^^
File "/config/custom_components/phyn/sensor.py", line 89, in native_value
if self._device.current_flow_rate is None:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/phyn/device.py", line 86, in current_flow_rate
return self._device_state["flow"]["mean"]
~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'flow'`

API Error

Received this error today trying to re-initialize the integration.

Logger: homeassistant.config_entries
Source: custom_components/phyn/init.py:28
Integration: Phyn
First occurred: 8:11:45 AM (1 occurrences)
Last logged: 8:11:45 AM

Error setting up entry HAHouse for phyn
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/phyn/init.py", line 28, in async_setup_entry
hass.data[DOMAIN][entry.entry_id][CLIENT] = client = await async_get_api(
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiophyn/api.py", line 140, in async_get_api
await api.async_authenticate()
File "/usr/local/lib/python3.11/site-packages/aiophyn/api.py", line 104, in async_authenticate
auth_response = await asyncio.wrap_future(future)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
asyncio.exceptions.CancelledError: aiohttp connection lost

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.