Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
12.08k stars 1.68k forks source link

[Feature request]: Please add RGB Effects to Aqara T1M Ceiling light (CL-L02D) #22247

Open johnsturgeon opened 6 months ago

johnsturgeon commented 6 months ago

Is your feature request related to a problem? Please describe

Currently the support for the T1M is limited.

Describe the solution you'd like

I would love to have access to all of the RGB effects that are in the ceiling light, and even (if possible) the ability to create new ones.

Describe alternatives you've considered

I could use the Aqara hub, but that doesn't get the effects into Home Assistant

Additional context

Here is a discussion of the issue https://github.com/Koenkk/zigbee2mqtt/discussions/22215

LZXCorp commented 6 months ago

Here is the Aqara T1M (CL-L02D) external definition if it is required.

External Definition

const {deviceEndpoints, identify, light} = require('zigbee-herdsman-converters/lib/modernExtend');

const definition = {
    zigbeeModel: ['lumi.light.acn032'],
    model: 'lumi.light.acn032',
    vendor: 'Aqara',
    description: 'Automatically generated definition',
    extend: [deviceEndpoints({"endpoints":{"1":1,"2":2}}), identify(), light({"colorTemp":{"range":[153,370]},"color":true}), light({"colorTemp":{"range":[153,370]}})],
    meta: {"multiEndpoint":true},
};

module.exports = definition;

Database Entry

{
    "id": 41,
    "type": "Router",
    "manufName": "Aqara",
    "powerSource": "DC Source",
    "modelId": "lumi.light.acn032",
    "epList": [2, 1],
    "endpoints": {
        "1": {
            "profId": 260,
            "epId": 1,
            "devId": 258,
            "inClusterList": [5, 4, 3, 0, 768, 8, 6, 64704],
            "outClusterList": [25, 10],
            "clusters": {
                "genBasic": {
                    "attributes": {
                        "61440": 2,
                        "modelId": "lumi.light.acn032",
                        "manufacturerName": "Aqara",
                        "powerSource": 4,
                        "zclVersion": 3,
                        "appVersion": 23,
                        "stackVersion": 27,
                        "hwVersion": 1,
                        "dateCode": "20230525"
                    }
                },
                "lightingColorCtrl": {
                    "attributes": {
                        "245": 10498122,
                        "colorCapabilities": 16,
                        "colorTempPhysicalMin": 153,
                        "colorTempPhysicalMax": 370,
                        "colorTemperature": 250
                    }
                },
                "manuSpecificLumi": {
                    "attributes": {
                        "223": {
                            "type": "Buffer",
                            "data": [
                                22, 33, 0, 0, 23, 33, 0, 0, 12, 33, 0, 0, 24, 33, 241, 12
                            ]
                        },
                        "229": {
                            "type": "Buffer",
                            "data": [
                                9, 0, 9, 0, 0, 4, 155, 154, 28, 37, 61, 66, 64, 37, 132, 73, 65,
                                37, 191, 33, 79, 37, 79, 24, 86, 37, 50, 166, 136, 37, 96, 154,
                                181, 37, 135, 89, 225, 37, 130
                            ]
                        },
                        "247": {
                            "type": "Buffer",
                            "data": [117, 32, 254, 115, 35, 239, 135, 30, 69]
                        }
                    }
                },
                "genLevelCtrl": {
                    "attributes": { "245": 10498121, "currentLevel": 132 }
                },
                "genOnOff": { "attributes": { "245": 10498246, "onOff": 0 } }
            },
            "binds": [],
            "configuredReportings": [],
            "meta": {}
        },
        "2": {
            "profId": 260,
            "epId": 2,
            "devId": 258,
            "inClusterList": [5, 4, 3, 768, 8, 6, 64704],
            "outClusterList": [],
            "clusters": {
                "lightingColorCtrl": {
                    "attributes": {
                        "245": 10498273,
                        "currentX": 17694,
                        "currentY": 34799,
                        "colorCapabilities": 24,
                        "colorTempPhysicalMin": 153,
                        "colorTempPhysicalMax": 370,
                        "colorMode": 1,
                        "colorTemperature": 153
                    }
                },
                "genOnOff": { "attributes": { "245": 10498275, "onOff": 0 } },
                "genLevelCtrl": {
                    "attributes": { "245": 10498272, "currentLevel": 254 }
                }
            },
            "binds": [],
            "configuredReportings": [],
            "meta": {}
        }
    },
    "appVersion": 23,
    "stackVersion": 27,
    "hwVersion": 1,
    "dateCode": "20230525",
    "zclVersion": 3,
}
schwagerik commented 5 months ago

Hi guys, where can find External Definition and Database Entry? Can´t find, somebody me navigate?

Here is the Aqara T1M (CL-L02D) external definition if it is required.

External Definition

const {deviceEndpoints, identify, light} = require('zigbee-herdsman-converters/lib/modernExtend');

const definition = {
    zigbeeModel: ['lumi.light.acn032'],
    model: 'lumi.light.acn032',
    vendor: 'Aqara',
    description: 'Automatically generated definition',
    extend: [deviceEndpoints({"endpoints":{"1":1,"2":2}}), identify(), light({"colorTemp":{"range":[153,370]},"color":true}), light({"colorTemp":{"range":[153,370]}})],
    meta: {"multiEndpoint":true},
};

module.exports = definition;

Database Entry

{
  "id": 41,
  "type": "Router",
  "manufName": "Aqara",
  "powerSource": "DC Source",
  "modelId": "lumi.light.acn032",
  "epList": [2, 1],
  "endpoints": {
      "1": {
          "profId": 260,
          "epId": 1,
          "devId": 258,
          "inClusterList": [5, 4, 3, 0, 768, 8, 6, 64704],
          "outClusterList": [25, 10],
          "clusters": {
              "genBasic": {
                  "attributes": {
                      "61440": 2,
                      "modelId": "lumi.light.acn032",
                      "manufacturerName": "Aqara",
                      "powerSource": 4,
                      "zclVersion": 3,
                      "appVersion": 23,
                      "stackVersion": 27,
                      "hwVersion": 1,
                      "dateCode": "20230525"
                  }
              },
              "lightingColorCtrl": {
                  "attributes": {
                      "245": 10498122,
                      "colorCapabilities": 16,
                      "colorTempPhysicalMin": 153,
                      "colorTempPhysicalMax": 370,
                      "colorTemperature": 250
                  }
              },
              "manuSpecificLumi": {
                  "attributes": {
                      "223": {
                          "type": "Buffer",
                          "data": [
                              22, 33, 0, 0, 23, 33, 0, 0, 12, 33, 0, 0, 24, 33, 241, 12
                          ]
                      },
                      "229": {
                          "type": "Buffer",
                          "data": [
                              9, 0, 9, 0, 0, 4, 155, 154, 28, 37, 61, 66, 64, 37, 132, 73, 65,
                              37, 191, 33, 79, 37, 79, 24, 86, 37, 50, 166, 136, 37, 96, 154,
                              181, 37, 135, 89, 225, 37, 130
                          ]
                      },
                      "247": {
                          "type": "Buffer",
                          "data": [117, 32, 254, 115, 35, 239, 135, 30, 69]
                      }
                  }
              },
              "genLevelCtrl": {
                  "attributes": { "245": 10498121, "currentLevel": 132 }
              },
              "genOnOff": { "attributes": { "245": 10498246, "onOff": 0 } }
          },
          "binds": [],
          "configuredReportings": [],
          "meta": {}
      },
      "2": {
          "profId": 260,
          "epId": 2,
          "devId": 258,
          "inClusterList": [5, 4, 3, 768, 8, 6, 64704],
          "outClusterList": [],
          "clusters": {
              "lightingColorCtrl": {
                  "attributes": {
                      "245": 10498273,
                      "currentX": 17694,
                      "currentY": 34799,
                      "colorCapabilities": 24,
                      "colorTempPhysicalMin": 153,
                      "colorTempPhysicalMax": 370,
                      "colorMode": 1,
                      "colorTemperature": 153
                  }
              },
              "genOnOff": { "attributes": { "245": 10498275, "onOff": 0 } },
              "genLevelCtrl": {
                  "attributes": { "245": 10498272, "currentLevel": 254 }
              }
          },
          "binds": [],
          "configuredReportings": [],
          "meta": {}
      }
  },
  "appVersion": 23,
  "stackVersion": 27,
  "hwVersion": 1,
  "dateCode": "20230525",
  "zclVersion": 3,
}
steuerlexi commented 4 months ago

any progress on this feature request?

LZXCorp commented 4 months ago

any progress on this feature request?

From what I can see, there is absolutely 0 progress. Aqara also didn't seem to be interested in sharing the technical aspects of the RGB animations too.

So another year of waiting ig.

fillwe commented 4 months ago

Would really like to see this as well!

adamk125 commented 3 months ago

Would love for this to be improved. Currently can only set solid colours using the Z2M Integration for the Aqara T1M. Cant seem to use the flashing (blinking) function on the device nor any Effects etc for the device.

Hopefully some smarter people can help :)

jyenzen commented 3 months ago

I would also really like for this to be added :D

saxxonian commented 2 months ago

I would love this option in HA too! Any progress or roadmap? I wish I had the skill to help...

jncanches commented 2 months ago

Is there some hopes about this feature ?

adamk125 commented 2 months ago

Havent heard anything about this feature yet from anyone on here - not sure how we get this some attention for those smarter than me :) @LZXCorp or @johnsturgeon any updates?

samzorio commented 1 month ago

probably need someone with an aqara hub to sniff traffic to find out if they are using non ZCL clusters or weird attributes for the effects.

adamk125 commented 1 month ago

probably need someone with an aqara hub to sniff traffic to find out if they are using non ZCL clusters or weird attributes for the effects.

I have a Camera Hub G2H and the T1M. If you can tell me how to sniff the traffic I can pair the T1M to the Aqara system and do it

samzorio commented 1 month ago

probably need someone with an aqara hub to sniff traffic to find out if they are using non ZCL clusters or weird attributes for the effects.

I have a Camera Hub G2H and the T1M. If you can tell me how to sniff the traffic I can pair the T1M to the Aqara system and do it

Forgot to mention you will also need a CC2531 USB stick (5-10$ on ebay) You will also need a programmer to flash the needed firmware can also be done with a raspberrypi/arduino see: https://www.zigbee2mqtt.io/advanced/zigbee/04_sniff_zigbee_traffic.html#_1-flashing-the-cc2531-adapter and: https://www.zigbee2mqtt.io/guide/adapters/flashing/alternative_flashing_methods.html

For instructions on how to sniff traffic see: https://www.zigbee2mqtt.io/advanced/zigbee/04_sniff_zigbee_traffic.html

You will need to extract the network key from your Camera Hub G2H ( I started exploring how to do it, found this) https://github.com/Koenkk/zigbee2mqtt/discussions/13976

I may get an aqara hub to try that in the future but would be kind of a waste as im never going to need it after that. Would be awesome if someone else can do it :)

Also someone might know a better way to do it. Just figured if it works with aqara hubs we sould be able to sniff the data

samzorio commented 1 month ago

So i ended up buying a E1 aqara hub to sniff traffic of t1m.

Here is what i found so far looks like to control the effects its done via the following endpoint/cluster (One would assume it would be done via endpoint 2 but no)

Destination Endpoint: 1
    Cluster: Manufacturer Specific (0xfcc0)
    Profile: Home Automation (0x0104)

The build in effects are the following:

DINNER: 
    Command: Write Attributes (0x02)
    Attribute Field, Octets: 47:41:02:01:01:01:01
        Attribute: 0x050a
        Data Type: Octet String (0x41)
        Octet String: 47:41:02:01:01:01:01

SUNSET: 
    Command: Write Attributes (0x02)
    Attribute Field, Octets: 48:42:02:01:01:01:01
        Attribute: 0x050a
        Data Type: Octet String (0x41)
        Octet String: 48:42:02:01:01:01:01

AUTUMN:
    Command: Write Attributes (0x02)
    Attribute Field, Octets: 49:43:02:01:01:01:01
        Attribute: 0x050a
        Data Type: Octet String (0x41)
        Octet String: 49:43:02:01:01:01:01

GALAXY:
    Command: Write Attributes (0x02)
    Attribute Field, Octets: 4a:44:02:01:01:01:01
        Attribute: 0x050a
        Data Type: Octet String (0x41)
        Octet String: 4a:44:02:01:01:01:01

DAYDREAM:
    Command: Write Attributes (0x02)
    Attribute Field, Octets: 4b:45:02:01:01:01:01
        Attribute: 0x050a
        Data Type: Octet String (0x41)
        Octet String: 4b:45:02:01:01:01:01

HOLIDAY: 
    Command: Write Attributes (0x02)
    Attribute Field, Octets: 4c:46:02:01:01:01:01
        Attribute: 0x050a
        Data Type: Octet String (0x41)
        Octet String: 4c:46:02:01:01:01:01

PARTY:
    Command: Write Attributes (0x02)
    Attribute Field, Octets: 4d:47:02:01:01:01:01
        Attribute: 0x050a
        Data Type: Octet String (0x41)
        Octet String: 4d:47:02:01:01:01:01

METEOR:
    Command: Write Attributes (0x02)
    Attribute Field, Octets: 4e:48:02:01:01:01:01
        Attribute: 0x050a
        Data Type: Octet String (0x41)
        Octet String: 4e:48:02:01:01:01:01

ALERT:
    Command: Write Attributes (0x02)
    Attribute Field, Octets: 51:4b:02:01:01:01:01
        Attribute: 0x050a
        Data Type: Octet String (0x41)
        Octet String: 51:4b:02:01:01:01:01

There is also the option to add custom effects. Have not played with that yet will try to capture it later this week and try and figure it out.

As for getting the built-in effects working in z2m, this is all new to me will try to create an extended definition to get this working or at least try to get it working via the dev console of zigbee2mqtt (Devices --> dev console tab)

Well tried a bunch of stuff nothing works guess what needs to be done to get this working is add the missing attribute (0x050a) to cluster 0xfcc0 (manuSpecificLumi)

If anyone with more experience would like to jump in or help me with this I would appreciate it.

Thanks all.

adamk125 commented 1 month ago

So i ended up buying a E1 aqara hub to sniff traffic of t1m.

Here is what i found so far looks like to control the effects its done via the following endpoint/cluster (One would assume it would be done via endpoint 2 but no)

Destination Endpoint: 1
  Cluster: Manufacturer Specific (0xfcc0)
  Profile: Home Automation (0x0104)

The build in effects are the following:

DINNER: 
    Command: Write Attributes (0x02)
    Attribute Field, Octets: 47:41:02:01:01:01:01
        Attribute: 0x050a
        Data Type: Octet String (0x41)
        Octet String: 47:41:02:01:01:01:01

SUNSET:   
    Command: Write Attributes (0x02)
    Attribute Field, Octets: 48:42:02:01:01:01:01
        Attribute: 0x050a
        Data Type: Octet String (0x41)
        Octet String: 48:42:02:01:01:01:01

AUTUMN:
    Command: Write Attributes (0x02)
    Attribute Field, Octets: 49:43:02:01:01:01:01
        Attribute: 0x050a
        Data Type: Octet String (0x41)
        Octet String: 49:43:02:01:01:01:01

GALAXY:
    Command: Write Attributes (0x02)
    Attribute Field, Octets: 4a:44:02:01:01:01:01
        Attribute: 0x050a
        Data Type: Octet String (0x41)
        Octet String: 4a:44:02:01:01:01:01

DAYDREAM:
    Command: Write Attributes (0x02)
    Attribute Field, Octets: 4b:45:02:01:01:01:01
        Attribute: 0x050a
        Data Type: Octet String (0x41)
        Octet String: 4b:45:02:01:01:01:01

HOLIDAY: 
    Command: Write Attributes (0x02)
    Attribute Field, Octets: 4c:46:02:01:01:01:01
        Attribute: 0x050a
        Data Type: Octet String (0x41)
        Octet String: 4c:46:02:01:01:01:01

PARTY:
    Command: Write Attributes (0x02)
    Attribute Field, Octets: 4d:47:02:01:01:01:01
        Attribute: 0x050a
        Data Type: Octet String (0x41)
        Octet String: 4d:47:02:01:01:01:01

METEOR:
    Command: Write Attributes (0x02)
    Attribute Field, Octets: 4e:48:02:01:01:01:01
        Attribute: 0x050a
        Data Type: Octet String (0x41)
        Octet String: 4e:48:02:01:01:01:01

ALERT:
    Command: Write Attributes (0x02)
    Attribute Field, Octets: 51:4b:02:01:01:01:01
        Attribute: 0x050a
        Data Type: Octet String (0x41)
        Octet String: 51:4b:02:01:01:01:01

There is also the option to add custom effects. Have not played with that yet will try to capture it later this week and try and figure it out.

As for getting the built-in effects working in z2m, this is all new to me will try to create an extended definition to get this working or at least try to get it working via the dev console of zigbee2mqtt (Devices --> dev console tab)

If anyone with more experience would like to jump in or help me with this I would appreciate it.

Thanks all.

I wish I could help but most of what you have just stated is a bit out out of my depth.

Looks like a step in the right direction though and I’m sure heaps of us would be very grateful for some extra functionality of the T1M.

SixFive7 commented 1 month ago

Great effort @samzorio! I understand you didn't get the custom command to work (yet). But did you get the build-in command to work without a hub (using the data you provided)? Or is there also something missing for those? Also, let me know if there is anything I can do or test for you on my end. I have a light, but no hub.

Caine72 commented 1 month ago

@samzorio I tried to use the devconsole to write to the specific cluster, but was stopped more or less at the gate.

Screenshot from 2024-09-09 16-28-36

Tried with 0x00 and 01 as well. No go.

samzorio commented 1 month ago

Again, I'm new to all this trying to figure things out(I have no idea what im doing really). But i think for dev console payload to work attribute/command would need to be added here

https://github.com/Koenkk/zigbee-herdsman/blob/2e948a96c311d9ad27670e8a6ee11c1d34f4598a/src/zspec/zcl/definition/cluster.ts#L4273

I'm running ha OS so i don't have direct access to the z2m container to try and modify that file.

And unless i'm wrong payload should look something like this

{"attrId":"0x050a", "dataType":"0x41", "attrData":"47410201010101"} or {"attrId":1290, "dataType":65, "attrData":47410201010101}

Caine72 commented 1 month ago

Again, I'm new to all this trying to figure things out(I have no idea what im doing really). But i think for dev console payload to work attribute/command would need to be added here

https://github.com/Koenkk/zigbee-herdsman/blob/2e948a96c311d9ad27670e8a6ee11c1d34f4598a/src/zspec/zcl/definition/cluster.ts#L4273

Ah makes sense that it needs to be added. I am also running z2m on HassOS so i do not have the possibility to change it. Or .. does the code need to compile? It's Node.js right? So .. I think we can jump directly into the docker container and change the file in runtime.

Seem to remember me doing this some time ago. Use the "Advanced SSH & Web Terminal" Add-on.

Will investigate more tomorrow. :)

Caine72 commented 1 month ago

Was a bit curious and could not drop it. ( well now I am) So yes I, was right. At least with what i discovered so far. :)

* note these instructions are not for setting this up securely, only for a fast test if it works or not. I to set it up in a more secure manner if you the reader intend to keep running the Advanced SSH- add-on.

  1. Download and install the add-on: Advanced SSH & Web Terminal
  2. Disable ( or change the port of Advanced SSH) the official SSH add-on if you have it.
  3. In it's Main page, i.e. where you start it, turn off Protected mode (required to access docker), and log in via the Web UI-link.
  4. Enter the command: docker ps
  5. Copy the container id ( far left column) for zigbee2mqtt/zigbee2mqtt
  6. Enter the command (added my container id): docker exec -it 16bc9cc4e813 /bin/bash
  7. The file is under this path: /app/node_modules/zigbee-herdsman/dist/zspec/zcl/definition
  8. Should be possible to edit with with. e.g. vi. So command:vi cluster.ts ( if you never used the vi-editor before, please do a fast read-up with the basics, else you will have a miserable experience. :))
samzorio commented 1 month ago

Was a bit curious and could not drop it. ( well now I am) So yes I, was right. At least with what i discovered so far. :)

* note these instructions are not for setting this up securely, only for a fast test if it works or not. I to set it up in a more secure manner if you the reader intend to keep running the Advanced SSH- add-on.

  1. Download and install the add-on: Advanced SSH & Web Terminal
  2. Disable ( or change the port of Advanced SSH) the official SSH add-on if you have it.
  3. In it's Main page, i.e. where you start it, turn off Protected mode (required to access docker), and log in via the Web UI-link.
  4. Enter the command: docker ps
  5. Copy the container id ( far left column) for zigbee2mqtt/zigbee2mqtt
  6. Enter the command (added my container id): docker exec -it 16bc9cc4e813 /bin/bash
  7. The file is under this path: /app/node_modules/zigbee-herdsman/dist/zspec/zcl/definition
  8. Should be possible to edit with with. e.g. vi. So command:vi cluster.ts ( if you never used the vi-editor before, please do a fast read-up with the basics, else you will have a miserable experience. :))

i'll try setting up something in a vm to play with it can't really mess around too much with my z2m setup atm as it's used for the whole house. Some ppl might get angry :rofl:

If you want to play with it you could try adding t1meffects: {ID: 0x050a, type: DataType.OCTET_STR}, to manuSpecificLumi: {} . Although i believe what we're looking for might need to be added under commands: {},. I'm reading through the cluster.ts to try and make sense of it.

Patresss commented 1 month ago

@samzorio Hey, did you manage to get anything done?

samzorio commented 1 month ago

@samzorio Hey, did you manage to get anything done?

did not have much time to play with it i did try and modify the cluster defintion to add the attribute. "t1meffects: {ID: 0x050a, type: DataType.OCTET_STR},"

I'm able to read it now and returns zhc:tz: Read result of 'manuSpecificLumi': {"t1meffects":{"type":"Buffer","data":[]}}

But can't figure out how to send the payload i'm assuming it has to be done via command:{}

to be honnest i havent had much time to spend on this will circle back to it eventually

geduxas commented 2 weeks ago

Hi @samzorio nice work you had done! i am almost on same way for now, have sniffed traffic and by searching for data, i stepped in on this thread :D could you share your progress right now?

geduxas commented 2 weeks ago

A litle bit of play with static effect, Static effect is directly transmitted while creating it: Attribute: 0x0527 Type: 0x42 Octet sample: 01:01:01:0f:ff:ff:ff:ff:c0:00:00:00:00:00:00:00:00:02:bc

First bytes alway 01:01:01:0F Next byte is brightnest of whole string: 03-FF (1-100%) Second goes MASK to which element is making changes (brigthenst makes changes to all elements) 80:00:00:00 for First LED element 00:00:00:40 for last LED element FF:FF:FF:C0 Mask for all LED's

Next goes spacing 00:00:00:00 And Y X for color White: 50:0d:54:39 Red: a3:db:54:78 Green: 4c:cc:99:99 Blue: 26:67:0f:5c

Everything ends: 02:bc

To save and run static preset Attribute: 0x050A Type: 0x41 Octet: 06:00:02:01:01:01:01

Every save increases first byte. Save/run2: 07:01:02:01:01:01:01 Save/run3: 08:02:02:01:01:01:01

To delete 3rd saved effect: 08:01:03:01:01:01:01

Hope it help's

adamk125 commented 2 weeks ago

A litle bit of play with static effect, Static effect is directly transmitted while creating it: Attribute: 0x0527 Type: 0x42 Octet sample: 01:01:01:0f:ff:ff:ff:ff:c0:00:00:00:00:00:00:00:00:02:bc

First bytes alway 01:01:01:0F Next byte is brightnest of whole string: 03-FF (1-100%) Second goes MASK to which element is making changes (brigthenst makes changes to all elements) 80:00:00:00 for First LED element 00:00:00:40 for last LED element FF:FF:FF:C0 Mask for all LED's

Next goes spacing 00:00:00:00 And Y X for color White: 50:0d:54:39 Red: a3:db:54:78 Green: 4c:cc:99:99 Blue: 26:67:0f:5c

Everything ends: 02:bc

To save and run static preset Attribute: 0x050A Type: 0x41 Octet: 06:00:02:01:01:01:01

Every save increases first byte. Save/run2: 07:01:02:01:01:01:01 Save/run3: 08:02:02:01:01:01:01

To delete 3rd saved effect: 08:01:03:01:01:01:01

Hope it help's

Looks like a step in the right direction. Hopefully this is helpful to those that can - help!