Add MODEL_ALIASES for devices reporting different PRODUCT_CODE#21
Conversation
|
While investigating this issue, I also noticed that |
|
@lmaertin a friendly reminder in case you've missed recent activity in the repository |
|
Hi @ronaldvdmeer, thanks for the reminder. Actually I have missed the notification. I like you proposal and will review the PR over weekend. Thanks for contributing! |
Great! Also did some other PR's and made a proposal to fix an open issue. If you need some clarification let me know. |
Hi @ronaldvdmeer, HA Core PR home-assistant/core#165507 got merged, may you want to use this script to switch from core component to a custom component based on the Dev Branch for pooldose from HA's terminal: Kindly let me know if all works for you. |
|
Hi @lmaertin, I tested the custom component and the integration works correctly with my device. I also verified that the environment is now using As mentioned in my original PR, the additional values still need the corresponding Do you prefer to add those mappings on the HA side yourself, or would you like me to open a follow-up core PR for that? |
|
Do you have experiences with HA integration development? May you start and I can review. |
|
I don't have experience with Home Assistant integration development yet. If it's relatively straightforward, with a clear structure and well documented guidelines from the HA side, I'm happy to have a look and give it a try. Otherwise it might be better if you handle that part. |
|
May we can share work. Which items do you want to propagate? Monitoring, Diagnostics, Control? Shall some of those be deactivated by default in HA? |
|
Let me review the new values from my device and propose a small set that I think would make sense to expose in Home Assistant (monitoring vs diagnostics vs control). I'll come back with a suggestion for which entities should be included and which ones might be better disabled by default. Do you agree with that approach? |
|
Yes, this makes sense, as I cannot test with my device. Please share example values as well, I need those for the test fixtures. |
|
Hi @lmaertin, here's my proposal for the new entities, including categorization, default enabled/disabled state, and example values from my live device. Let me know if you agree with this categorization, or if you'd like to adjust anything. Once aligned, I'd like to open a draft PR on HA core (dev branch) so you can review it before it goes live. Sound good? Binary sensors — Monitoring (11 new)All use
Sensors — Diagnostics (6 new)All use
Numbers — Config / Control (5 new)All use
Example fixture data (additions to
|
| Category | New entities | Default enabled | Default disabled |
|---|---|---|---|
| Monitoring (binary_sensor) | 11 | 11 | 0 |
| Diagnostics (sensor) | 5 + 1 update | 0 | 5 |
| Config/Control (number) | 5 | 0 | 5 |
| Total | 22 | 11 | 10 |
|
Thanks, very well done. I will have a closer look tomorrow and give feedback. |
|
Hi @lmaertin, I've implemented the HA core changes for the 22 new entities on my fork. Could you review? Diff: ronaldvdmeer/core@dev...add-pooldose-entities What's included:
Verified locally:
Once you're happy with this, I'll open the draft PR on |
|
Thanks, I will include it now, please standy-by |
Is there no alarm_cl_too_low (without ORP)? |
|
No,
The direct CL sensor only triggers an alarm when chlorine is too high, not when it's too low. This matches the device's web interface which shows exactly these three alarms. |
|
Do you have an idea why there are secondary overfeed alarms? On my device only the secondary alarm is present. |
|
The OFA2 (secondary overfeed) alarms only exist on the PDPR1H1HAW100 model (FW539187). Looking at all four device mappings:
The PDPR1H1HAW100 firmware (FW539187) exposes two separate sets of OFA widgets, one on the Instant Values tab (OFA1/OFA2 indicators) and a duplicate set on the Alarms tab. My guess is the device has a primary and secondary overfeed threshold, but I don't know exactly why this model has both while yours only has the primary. It could be a firmware version difference, your device runs FW539176 while mine runs FW539187. Since these entities are only created when the device's mapping actually contains them (the library only returns entities that exist in the device's widget list), |
|
Done, I've renamed the OFA2 entities to use "alternative" instead of "2":
This matches your naming convention. Updated strings, snapshots, and all 75 tests still pass. Changes are pushed to the branch. |
|
I'm working on a PR already - merged your commit from the initial PR. you do not need to adapt yours ;) |
|
Haha great, thanks for picking it up! Happy to help with the groundwork. Let me know if you need anything else for the PR. Glad to assist where I can. |
|
PR draft home-assistant/core#165608 |
|
Ok, Core and Docs PR are on the way. Seems there is an issue in the CORE PR pipeline; It's failing, but I do not see an issue in our inputs... I have another point: Actually I'm thinking of to move the "enabled/disabled" sensors to binary_sensors. In python-pooldose those must be mapped accordingly. |
|
Reviewer spotted just the same ;-) Please map to type binary_sensor and conversion to "True" for "Enabled" and "False" for "Disabled". Please share the cli output for cross-check, so we will bring this to python-pooldose 0.8.6. We can include #25 then as well in that release. |
|
if the binary_sensor work for all previous enable/disable sensors, please create a PR so we are faster. |
|
I'm making a new PR, give me a couple of minutes Changing:
|
|
done, #28 |
|
@lmaertin I believe I have updated everything required. Do you need anything else from me? |
|
I don't think so, I will wrap everything up an bump the HA integration to 0.8.6, then I will go into review with the major PR... |
|
Thanks for taking the time to look into this and for maintaining the project. Really appreciate the work you put into it. |
|
Thanks for your support as well, I like to see how community improves this API now 👍 |
|
Hi @lmaertin, Thanks for cleaning up my PR. Especially the alphabetical ordering, renaming the I'll make sure to run |
|
Hi @ronaldvdmeer, the per-commit checks and the pipeline guides you for most of the things. As well the AI setup in PR helps. Overall the HA dev ecosystem is brilliant. |
|
Yeah, for me this was the first time working on an integration and seeing how the proces of a PR works with Home Assistant. Learned alot! |

Problem
Some devices report a
PRODUCT_CODEthat differs from the model ID used in their data keys and mapping files. The POOLDOSE pH+ORP CF Group Wi-Fi device reportsPDPR1H1HAW102as itsPRODUCT_CODE, but the actual data keys and labels usePDPR1H1HAW100.This causes
MappingInfo.load()to fail because it looks formodel_PDPR1H1HAW102_FW539187.jsonwhich does not exist. The data prefix also mismatches, breakinginstant_values().Error in Home Assistant:
Solution
Introduce a centralized
MODEL_ALIASESdictionary inconstants.pythat maps reportedPRODUCT_CODEvalues to the actual model ID used in data keys and mappings.This replaces the existing hardcoded
if model_id == 'PDHC1H1HAR1V1'workaround ininstant_values()with a cleaner, extensible approach that also covers the mapping-loading step in_load_device_info().Changes
constants.py: AddMODEL_ALIASESdict with entries forPDHC1H1HAR1V1(existing) andPDPR1H1HAW102(new)client.py: UseMODEL_ALIASESin both_load_device_info()andinstant_values()instead of the hardcoded if-statementconftest.py: Add test fixtures for aliased device scenariostest_client.py: Add 3 tests verifying alias resolution during connect and data fetchingDevice info
{ "MODEL": "POOLDOSE pH+ORP CF Group Wi-Fi", "MODEL_ID": "PDPR1H1HAW102", "FW_VERSION": "1.7", "SW_VERSION": "3.00", "FW_CODE": "539187" }All 126 tests pass.
Tested on real device
Verified with a POOLDOSE pH+ORP CF Group Wi-Fi device (PRODUCT_CODE:
PDPR1H1HAW102, FW code:539187).Before fix:
After fix: