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

Update Inovelli VZM35-SN fan switch for firmware 1.05 #2937

Merged
merged 4 commits into from
Jan 30, 2024

Conversation

Rogue136198
Copy link
Contributor

Proposed change

Updating this to support changes made to the latest beta firmware v1.05 for VZM35SN

Additional information

This is my first time I have submitted an update to a quirk. If someone could please advise if this change should be done this way
or if another way would be better such as adding a new quirk specifically for firmware 1.05 in the event this breaks those devices
still using 1.04

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 Jan 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (04ac526) 87.61% compared to head (ace04fe) 87.64%.
Report is 6 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #2937      +/-   ##
==========================================
+ Coverage   87.61%   87.64%   +0.03%     
==========================================
  Files         295      297       +2     
  Lines        9032     9059      +27     
==========================================
+ Hits         7913     7940      +27     
  Misses       1119     1119              

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

@javicalle
Copy link
Collaborator

Definitely that would be a breaking change for the not updated devices.
IMHO it will be better to put the new device signature in another quirk.
Just put your code in a new class (ie: InovelliVZM35SN_var02(CustomDevice)), keeping the current quirk as is.

@codyhackw
Copy link
Contributor

We'll also need to update the __init__.py file for the new attributes, I believe this is what's going to be needed in total -

Add to VZM35SN.py with the import you added for the fan cluster
class InovelliVZM35SNv5(CustomDevice):
    """VZM35-SN Fan Switch"""
    signature = {
        MODELS_INFO: [("Inovelli", "VZM35-SN")],
        ENDPOINTS: {
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: DeviceType.DIMMABLE_LIGHT,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Identify.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    OnOff.cluster_id,
                    LevelControl.cluster_id,
                    Fan.cluster_id,
                    Diagnostic.cluster_id,
                    INOVELLI_VZM35SN_CLUSTER_ID,
                    WWAH_CLUSTER_ID,
                ],
                OUTPUT_CLUSTERS: [
                    Ota.cluster_id,
                ],
            },
            2: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: DeviceType.DIMMER_SWITCH,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Identify.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                ],
                OUTPUT_CLUSTERS: [
                    Identify.cluster_id,
                    OnOff.cluster_id,
                    LevelControl.cluster_id,
                ],
            },
            3: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: DeviceType.DIMMER_SWITCH,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Identify.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                ],
                OUTPUT_CLUSTERS: [
                    Identify.cluster_id,
                    OnOff.cluster_id,
                    LevelControl.cluster_id,
                ],
            },
            242: {
                PROFILE_ID: zgp.PROFILE_ID,
                DEVICE_TYPE: zgp.DeviceType.PROXY_BASIC,
                INPUT_CLUSTERS: [],
                OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
            },
        },
    }

    replacement = {
        ENDPOINTS: {
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: DeviceType.DIMMABLE_LIGHT,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Identify.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    OnOff.cluster_id,
                    LevelControl.cluster_id,
                    Fan.cluster_id,
                    Diagnostic.cluster_id,
                    Inovelli_VZM35SN_Cluster,
                    WWAH_CLUSTER_ID,
                ],
                OUTPUT_CLUSTERS: [
                    Ota.cluster_id,
                ],
            },
            2: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: DeviceType.DIMMER_SWITCH,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Identify.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                ],
                OUTPUT_CLUSTERS: [
                    Identify.cluster_id,
                    OnOff.cluster_id,
                    LevelControl.cluster_id,
                    Inovelli_VZM35SN_Cluster,
                ],
            },
            3: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: DeviceType.DIMMER_SWITCH,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Identify.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                ],
                OUTPUT_CLUSTERS: [
                    Identify.cluster_id,
                    OnOff.cluster_id,
                    LevelControl.cluster_id,
                    Inovelli_VZM35SN_Cluster,
                ],
            },
            242: {
                PROFILE_ID: zgp.PROFILE_ID,
                DEVICE_TYPE: zgp.DeviceType.PROXY_BASIC,
                INPUT_CLUSTERS: [],
                OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
            },
        },
    }
Update VZM35SN Cluster in __init__.py
class Inovelli_VZM35SN_Cluster(Inovelli_VZM31SN_Cluster):
    """Inovelli VZM35-SN custom cluster."""

    attributes = {
        key: Inovelli_VZM31SN_Cluster.attributes[key]
        for key in Inovelli_VZM31SN_Cluster.attributes
        if key not in VZM35SN_REMOVES
    }
    attributes.update(
        {
            0x0017: ("quick_start_time", t.uint8_t, True),
            0x001E: ("non_neutral_aux_med_gear_learn_value", t.uint8_t, True),
            0x001F: ("non_neutral_aux_low_gear_learn_value", t.uint8_t, True),
            0x0034: ("smart_fan_mode", t.Bool, True),
            0x0078: ("fan_single_tap_behavior", t.uint8_t, True),
            0x0079: ("fan_timer_display", t.Bool, True),
            0x0081: ("fan_breeze_mode", t.uint32_t, True),
            0x0082: ("fan_module_binding_control", t.uint8_t, True),
            0x0083: ("low_for_bound_control", t.uint8_t, True),
            0x0084: ("medium_for_bound_control", t.uint8_t, True),
            0x0085: ("high_for_bound_control", t.uint8_t, True),
            0x0086: ("led_color_for_bound_control", t.uint8_t, True),
            0x0107: ("smart_fan_led_display_levels", t.uint8_t, True),
        }
    )

@TheJulianJES TheJulianJES changed the title Update VZM35SN.py for firmware 1.05 Update Inovelli VZM35-SN fan switch for firmware 1.05 Jan 26, 2024
@TheJulianJES
Copy link
Collaborator

Thanks @Rogue136198 and @codyhackw!
@codyhackw I've now added the new quirk class separately and added the custom attributes like you mentioned.

Let me know if the PR looks good to you know.

@TheJulianJES TheJulianJES marked this pull request as ready for review January 29, 2024 22:32
@codyhackw
Copy link
Contributor

@TheJulianJES that looks good to me!

@TheJulianJES
Copy link
Collaborator

Thanks

@TheJulianJES TheJulianJES merged commit 2070f3a into zigpy:dev Jan 30, 2024
14 checks passed
@Rogue136198
Copy link
Contributor Author

Whoops, forgot I was working on this. Been a crazy week.

I imported the updates files as a custom quirk and everything seems to be working well.

Thanks for finishing this up for me.

lgraf pushed a commit to lgraf/zha-device-handlers that referenced this pull request May 6, 2024
Co-authored-by: TheJulianJES <TheJulianJES@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants