Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zlinky_TIC conversion to quirk v2 #3456

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from

Conversation

blauret
Copy link
Contributor

@blauret blauret commented Oct 25, 2024

Proposed change

The quirk for is converted to v2 and adds more sensor to the use in HA

Additional information

Checklist

  • The changes are tested and work correctly
  • pre-commit checks pass / the code has been formatted using Black
  • Tests have been added to verify that the new code works

Copy link

codecov bot commented Oct 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.67%. Comparing base (213ce10) to head (d1ab195).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #3456   +/-   ##
=======================================
  Coverage   89.67%   89.67%           
=======================================
  Files         316      316           
  Lines       10281    10287    +6     
=======================================
+ Hits         9219     9225    +6     
  Misses       1062     1062           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@blauret blauret changed the title [WIP, Do not merge] Zlinky_TIC conversion to quirk v2 Zlinky_TIC conversion to quirk v2 Nov 2, 2024
@steenlarsen
Copy link

Many thanks! I just tested and it looks very good!
Lixee

@TheJulianJES TheJulianJES added the v2 quirk Quirks using v2 API. Might add custom entities that need translation keys in HA. label Nov 24, 2024
@blauret blauret marked this pull request as ready for review November 25, 2024 08:16
@blauret
Copy link
Contributor Author

blauret commented Nov 25, 2024

This is ready to review.

@TheJulianJES, some of the attributes added in the latest iterations are not automatically updating. Specifically, I'm thinking about "Max Power Phase 2". From what I could figure out from code analysis, the polling the polling interval for those attributes should be added in ZHA itself, for the first phase I could find:

        AttrReportConfig(
            attr=ElectricalMeasurement.AttributeDefs.active_power_max.name,
            config=REPORT_CONFIG_DEFAULT,
        ),

Which does not exist for the other 2phases attributes. If I can change it in the quick, please let me know. Otherwise, I'll open a separate PR in ZHA.

@steenlarsen
Copy link

Update on my previous test :

  1. I also noted the lack of automatic updates for the Tariff field. It does update if I manually query the cluster.

  2. Model is always unavailable. This comes from the Basic cluster and does not appear even after a manual read of this cluster.

Looking at your quirk I managed to add the Relay status as well withe the code below. This has the same update problem though:

class ZLinkyTICRelay(t.enum8):
    """ZLinkyTICTarif tarif enumeration."""

    Off = 0
    On = 1

and

    .enum(
        "std_relay",
        SLZLinkyTICRelay,
        ZLinkyTICManufacturerCluster.cluster_id,
        entity_type=EntityType.STANDARD,
        entity_platform=EntityPlatform.SENSOR,
        translation_key="relay_HPHC",
        fallback_name="Relay HPHC",

@TheJulianJES TheJulianJES added the needs review This PR should be reviewed soon, as it generally looks good. label Nov 26, 2024
@blauret
Copy link
Contributor Author

blauret commented Nov 26, 2024

Update on my previous test :

  1. I also noted the lack of automatic updates for the Tariff field. It does update if I manually query the cluster.
  2. Model is always unavailable. This comes from the Basic cluster and does not appear even after a manual read of this cluster.

Looking at your quirk I managed to add the Relay status as well withe the code below. This has the same update problem though:

class ZLinkyTICRelay(t.enum8):
    """ZLinkyTICTarif tarif enumeration."""

    Off = 0
    On = 1

and

    .enum(
        "std_relay",
        SLZLinkyTICRelay,
        ZLinkyTICManufacturerCluster.cluster_id,
        entity_type=EntityType.STANDARD,
        entity_platform=EntityPlatform.SENSOR,
        translation_key="relay_HPHC",
        fallback_name="Relay HPHC",

Added to PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review This PR should be reviewed soon, as it generally looks good. v2 quirk Quirks using v2 API. Might add custom entities that need translation keys in HA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants