Open opq8 opened 1 year ago
Also pasting what I wrote in #5:
I don't think this integration works at all with a Phyn setup where it's more than just the Phyn Plus, that is, when the setup also includes Phyn water sensors.
async_add_entities(entities) tries to add the same set of attributes in sensor.py and switch.py regardless of the device being a pp1/2 (the Phyn Plus) vs. a pw1 (water sensor).
And here are the attributes taken from my logs:
For a water sensor (PW1)
2023-10-12 22:28:13.312 DEBUG (MainThread) [custom_components.phyn] Phyn device state: {'battery_level': {'v': 100, 'ts': REDACTED}, 'signal_strength': 71, 'online_status': {'ts': REDACTED, 'v': 'online'}, 'sd_status': {'ts': REDACTED, 'v': 'G'}, 'hw_version': '0', 'device_id': 'REDACTED', 'product_code': 'PW1', 'network_name': 'REDACTED', 'temperature': {'v': REDACTED, 'ts': REDACTED}, 'name': 'REDACTED', 'auto_shutoff_eligible': 0, 'serial_number': 'REDACTED', 'fw_version': 'REDACTED', 'timezone': 'America/Los_Angeles', 'partner': 'phyn', 'humidity': {'v': REDACTED, 'ts': REDACTED}, 'users': ['REDACTED'], 'auto_shutoff_enable': False, 'created_ts': REDACTED}
For the Phyn Plus itself (pp1 or pp2, example taken from pp1)
2023-10-12 22:28:13.407 DEBUG (MainThread) [custom_components.phyn] Phyn device state: {'signal_strength': -65, 'online_status': {'v': 'online', 'sid': 'REDACTED', 'ts': REDACTED}, 'sd_status': {'v': 'G', 'r': 'watchdog', 'ts': REDACTED}, 'hw_version': '0', 'device_id': 'REDACTED', 'product_code': 'PP1', 'network_name': 'REDACTED', 'temperature': {'min': REDACTED, 'max': REDACTED, 'mean': REDACTED, 'ts': REDACTED}, 'auto_shutoff_eligible': 100, 'serial_number': 'REDACTED', 'sov_status': {'a': 'REDACTED', 'v': 'Open', 'ts': REDACTED}, 'flow': {'min': REDACTED, 'max': REDACTED, 'mean': REDACTED, 'ts': REDACTED}, 'pressure': {'min': REDACTED, 'median': REDACTED, 'max': REDACTED, 'mean': REDACTED, 'percentile95': REDACTED, 'pressure_threshold_95': REDACTED, 'percentile5': REDACTED, 'ts': REDACTED}, 'fw_version': 'REDACTED', 'timezone': 'America/Los_Angeles', 'partner': 'phyn', 'users': ['REDACTED'], 'auto_shutoff_enable': True, 'created_ts': REDACTED}
This probably means #5 and #11 (this issue) will need to be fixed together.
Created https://github.com/MizterB/homeassistant-phyn/pull/12 to fix this. I'll stack further changes in future to add the Water Sensors (pw1) to HA.
Not sure if this repo is still actively maintained so I created a fork https://github.com/opq8/homeassistant-phyn/tree/development with this fix. Happy to merge everything back into here as needed.
FYI, it looks like jordanruthe has the most active fork(s) so might want to submit PR there to if wish to collaborate and consolidate:
https://github.com/jordanruthe/homeassistant-phyn -> https://github.com/jordanruthe/homeassistant-phyn/commits/dev/
https://github.com/jordanruthe/aiophyn -> https://github.com/jordanruthe/aiophyn/commits/dev/
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
Error adding entities for domain sensor with platform phyn
Error while setting up phyn platform for sensor