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

Add support for new ubisys S1-R (Series 2). #7915

Merged
merged 4 commits into from
Sep 6, 2024

Conversation

lgraf
Copy link
Contributor

@lgraf lgraf commented Aug 29, 2024

Adds support for the new ubisys S1-R (Series 2). Currently a technical reference document for the device is not (yet) available. The main difference seems to be that there is no endpoint 4 in the new device and the energy related clusters are located in endpoint 1 (instead of 4 like the regular S1-R).

The device seems to be working fine:

{
    "energy": 0.01,
    "last_seen": "2024-08-29T19:51:12+02:00",
    "linkquality": 116,
    "power": 6.6,
    "state": "ON",
    "action": null
}

One thing i am unsure about is if the fingerprint is working correctly. When i test this Definition as external converter with only the fingerprint defined (no zigbeeModel attribute), the normal S1-R Definition is used. As external converter the new Definition is only picked up when i trump with the zigbeeModel attribute (S1-R (5601)). Not sure if this is normal behaviour for external converters or if there something wrong about the fingerprinting?

db entry (paired with the Definition of this PR)

{
    "id": 9,
    "type": "Router",
    "ieeeAddr": "0x001fee000000a8ea",
    "nwkAddr": 34094,
    "manufId": 4338,
    "manufName": "ubisys",
    "powerSource": "Mains (single phase)",
    "modelId": "S1-R (5601)",
    "epList": [
        1,
        2,
        3,
        232,
        242
    ],
    "endpoints": {
        "1": {
            "profId": 260,
            "epId": 1,
            "devId": 266,
            "inClusterList": [
                0,
                3,
                4,
                5,
                6,
                1794,
                2820
            ],
            "outClusterList": [],
            "clusters": {
                "genBasic": {
                    "attributes": {
                        "modelId": "S1-R (5601)",
                        "manufacturerName": "ubisys",
                        "powerSource": 1,
                        "zclVersion": 8,
                        "appVersion": 1,
                        "stackVersion": 1,
                        "hwVersion": 16,
                        "dateCode": "20240612-DE-FB1",
                        "swBuildId": "2.5.0"
                    }
                },
                "seMetering": {
                    "attributes": {
                        "multiplier": 1,
                        "divisor": 10000
                    }
                },
                "genOnOff": {
                    "attributes": {
                        "onOff": 0
                    }
                }
            },
            "binds": [
                {
                    "cluster": 1794,
                    "type": "endpoint",
                    "deviceIeeeAddress": "0x00124b002c3a8c02",
                    "endpointID": 1
                },
                {
                    "cluster": 6,
                    "type": "endpoint",
                    "deviceIeeeAddress": "0x00124b002c3a8c02",
                    "endpointID": 1
                }
            ],
            "configuredReportings": [
                {
                    "cluster": 1794,
                    "attrId": 1024,
                    "minRepIntval": 5,
                    "maxRepIntval": 3600,
                    "repChange": 1,
                    "manufacturerCode": null
                },
                {
                    "cluster": 6,
                    "attrId": 0,
                    "minRepIntval": 0,
                    "maxRepIntval": 65000,
                    "repChange": 1,
                    "manufacturerCode": null
                }
            ],
            "meta": {}
        },
        "2": {
            "profId": 260,
            "epId": 2,
            "devId": 260,
            "inClusterList": [
                0,
                3
            ],
            "outClusterList": [
                3,
                5,
                6,
                8,
                768,
                64514
            ],
            "clusters": {},
            "binds": [
                {
                    "cluster": 6,
                    "type": "endpoint",
                    "deviceIeeeAddress": "0x001fee000000a8ea",
                    "endpointID": 1
                },
                {
                    "cluster": 6,
                    "type": "endpoint",
                    "deviceIeeeAddress": "0x00124b002c3a8c02",
                    "endpointID": 1
                },
                {
                    "cluster": 8,
                    "type": "endpoint",
                    "deviceIeeeAddress": "0x00124b002c3a8c02",
                    "endpointID": 1
                },
                {
                    "cluster": 768,
                    "type": "endpoint",
                    "deviceIeeeAddress": "0x00124b002c3a8c02",
                    "endpointID": 1
                }
            ],
            "configuredReportings": [],
            "meta": {}
        },
        "3": {
            "profId": 260,
            "epId": 3,
            "devId": 260,
            "inClusterList": [
                0,
                3
            ],
            "outClusterList": [
                3,
                5,
                6,
                8,
                768,
                64514
            ],
            "clusters": {},
            "binds": [
                {
                    "cluster": 6,
                    "type": "endpoint",
                    "deviceIeeeAddress": "0x00124b002c3a8c02",
                    "endpointID": 1
                },
                {
                    "cluster": 8,
                    "type": "endpoint",
                    "deviceIeeeAddress": "0x00124b002c3a8c02",
                    "endpointID": 1
                },
                {
                    "cluster": 768,
                    "type": "endpoint",
                    "deviceIeeeAddress": "0x00124b002c3a8c02",
                    "endpointID": 1
                }
            ],
            "configuredReportings": [],
            "meta": {}
        },
        "232": {
            "profId": 260,
            "epId": 232,
            "devId": 1287,
            "inClusterList": [
                0,
                61,
                64512,
                64599
            ],
            "outClusterList": [
                3,
                25
            ],
            "clusters": {},
            "binds": [],
            "configuredReportings": [],
            "meta": {}
        },
        "242": {
            "profId": 41440,
            "epId": 242,
            "devId": 97,
            "inClusterList": [],
            "outClusterList": [
                33
            ],
            "clusters": {},
            "binds": [],
            "configuredReportings": [],
            "meta": {}
        }
    },
    "appVersion": 1,
    "stackVersion": 1,
    "hwVersion": 16,
    "dateCode": "20240612-DE-FB1",
    "swBuildId": "2.5.0",
    "zclVersion": 8,
    "interviewCompleted": true,
    "meta": {
        "configured": 332242049
    },
    "lastSeen": 1724949732485
}

commandsColorCtrl({endpointNames: ['2', '3']}),
],
configure: async (device, coordinatorEndpoint) => {
const endpoint = device.getEndpoint(1);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything inside here is not needed because of electricityMeter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its needed because configureReporting is set to false for electricityMeter. The reason is that the currentSummDelivered is not bindable for this device (as far i can tell for the most ubisys devices). As workaround only the instantaneousDemand attribute is binded manually and currentSummDelivered read in onEvent.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see now, I think we can improve the ubisysOnEventReadCurrentSummDelivered a bit, I see 2 issues with it:

  • In case the Ubisys devices is sending a lot of messages, a lot of reads are done
  • In case no messages are send, the value becomes stale

We can solve this by polling at a certain interval, you can use the Tuya one as an example

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I will take a closer look at the weekend when I have the device for testing at hand.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was a bit uncertain to change this for devices i do not own myself, so i added a separate method that can be used for polling.

await reporting.readMeteringMultiplierDivisor(endpoint);
await reporting.instantaneousDemand(endpoint);
},
meta: {multiEndpointSkip: ['state', 'power', 'energy']},
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use multiEndpointSkip of deviceEndpoints instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

endpoints: [{ID: 1, profileID: 260, deviceID: 266, inputClusters: [0, 3, 4, 5, 6, 1794, 2820], outputClusters: []}],
},
],
model: 'S1-R (Series 2)',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
model: 'S1-R (Series 2)',
model: 'S1-R-2',

Can we use this here? It's a bit more friendly without the spaces

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@lgraf lgraf force-pushed the ubisys-s1-r-series2 branch from e8b23c7 to 8c4345f Compare September 6, 2024 14:54
src/devices/ubisys.ts Outdated Show resolved Hide resolved
Co-authored-by: Koen Kanters <[email protected]>
@Koenkk Koenkk merged commit 0b51cc0 into Koenkk:master Sep 6, 2024
2 checks passed
@Koenkk
Copy link
Owner

Koenkk commented Sep 6, 2024

Thanks!

@lgraf lgraf deleted the ubisys-s1-r-series2 branch September 6, 2024 20:04
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.

2 participants