Request to open Open API resources for lumi.switch.agl009, lumi.switch.agl010, lumi.switch.agl011

Hi Aqara team,

I am building a personal home automation dashboard using the Aqara Cloud Open API v3.0. Everything works great for plugs (lumi.plug.maeu01) and ceiling lights (lumi.light.acn032) — 4.1.85 reads and writes successfully with code 0. However, I cannot control my wall switches because query.resource.info returns an empty array for these models, and query.resource.value returns code 302 “all resource not open”.

Affected switch models:

  • lumi.switch.agl009 — Aqara H2 EU 1-channel wall switch (3 devices)
    • lumi.switch.agl010 — Aqara H2 EU 4-channel wall switch (3 devices)
    • lumi.switch.agl011 — Aqara H2 EU 2-channel/dimmer switch (2 devices)
      Resources I need opened (read + write, access=7):
  • 4.1.85 — Channel 1 on/off (all three models)
    • 4.2.85 — Channel 2 on/off (agl010, agl011)
    • 4.3.85 — Channel 3 on/off (agl010)
    • 4.4.85 — Channel 4 on/off (agl010)
      This is for a personal home dashboard, not a commercial product. Could you please open these resources for my application? Thank you!
2 Likes

@niedy707 You seem to be experiencing an issue with Aqara Cloud Open API v3.0 not exposing/opening wall switch resources for lumi.switch.agl009 / agl010 / agl011 (e.g., query.resource.info returns empty and query.resource.value returns 302: “all resource not open”). You can contact customer support for assistance.

The fastest path is to submit this as an Open API resource-permission request and include:

  • Your AppID / Key info (as required by support), and that it’s personal/non-commercial
  • The exact model list: lumi.switch.agl009, lumi.switch.agl010, lumi.switch.agl011
  • The resource IDs + desired access: 4.1.85, 4.2.85, 4.3.85, 4.4.85 with read+write (access=7)
  • A couple of sample API responses showing the empty array and the 302 error (timestamps help)

Contact the Aqara Home App Customer Service Team (Profile> Help & Feedback > Customer Service) or scan the QR code:


This will be more efficient. If you do not have an Aqara Home account, Please click here to create a ticket. Sorry for the inconvenience.

1 Like

Hi,

Using spec.query.qlinkmodel.config returns the following results…

for lumi.switch.agl009:

{
  data: {
    'lumi.switch.agl009': {
      deviceTypesList: [ 'Switch', 'Button' ],
      endpoints: [
        {
          deviceType: 'Root',
          functions: [
            {
              functionId: 128,
              traits: [
                {
                  parameter: {
                    readable: true,
                    type: 'Integer',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32896,
                  traitCode: 'FirmwareRevision'
                },
                {
                  parameter: {
                    readable: true,
                    type: 'String',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32897,
                  traitCode: 'SerialNumber'
                },
                {
                  parameter: {
                    readable: true,
                    type: 'String',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32898,
                  traitCode: 'VendorName'
                },
                {
                  parameter: {
                    readable: true,
                    type: 'String',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32899,
                  traitCode: 'VendorID'
                },
                {
                  parameter: {
                    readable: true,
                    unit: '',
                    defaultValue: 'µÖ║Þâ¢ÕóÖÕúüÕ╝ÇÕà│',
                    type: 'String',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32900,
                  traitCode: 'ProductName'
                },
                {
                  parameter: {
                    readable: true,
                    type: 'Bool',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32901,
                  traitCode: 'Reachable'
                },
                {
                  parameter: {
                    readable: true,
                    type: 'String',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 33141,
                  traitCode: 'ModelValue'
                },
                {
                  parameter: {
                    readable: true,
                    type: 'Integer',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32902,
                  traitCode: 'HardwareVersion'
                },
                {
                  parameter: {
                    readable: true,
                    type: 'String',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32903,
                  traitCode: 'Location'
                },
                {
                  parameter: {
                    readable: true,
                    type: 'String',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 33047,
                  traitCode: 'FirmwareRevisionString'
                },
                {
                  parameter: {
                    readable: true,
                    type: 'String',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32904,
                  traitCode: 'Mac'
                },
                {
                  parameter: {
                    readable: true,
                    type: 'String',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32905,
                  traitCode: 'DeviceID'
                }
              ],
              functionCode: 'BasicInformation',
              commands: []
            },
            {
              functionId: 129,
              traits: [
                {
                  parameter: {
                    readable: true,
                    type: 'Integer',
                    subscribable: true,
                    writable: true
                  },
                  traitId: 32912,
                  traitCode: 'SelectedEndpointDynamic'
                },
                {
                  parameter: {
                    readable: true,
                    defaultValue: false,
                    type: 'Bool',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32906,
                  traitCode: 'SupportedEndpointDynamic'
                },
                {
                  parameter: {
                    readable: true,
                    defaultValue: 1,
                    type: 'Integer',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32907,
                  traitCode: 'EndpointDynamicCount'
                },
                {
                  parameter: {
                    readable: true,
                    defaultValue: 4,
                    type: 'Integer',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32908,
                  traitCode: 'EndpointCount'
                },
                {
                  parameter: {
                    readable: true,
                    unit: '',
                    defaultValue: '[0,1,2,3]',
                    type: 'List[X]',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32909,
                  traitCode: 'EndpointArray'
                },
                {
                  parameter: {
                    readable: true,
                    defaultValue: '["Root","Public","Switch","Button"]',
                    type: 'List[X]',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32910,
                  traitCode: 'EndpointDeviceTypes'
                },
                {
                  parameter: {
                    readable: true,
                    type: 'List[X]',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32911,
                  traitCode: 'EndpointFunctions'
                }
              ],
              functionCode: 'Descriptor',
              commands: []
            },
            {
              functionId: 130,
              traits: [
                {
                  parameter: {
                    readable: true,
                    unit: '',
                    defaultValue: 'µÖ║Þâ¢ÕóÖÕúüÕ╝ÇÕà│',
                    type: 'String',
                    subscribable: true,
                    writable: true
                  },
                  traitId: 32913,
                  traitCode: 'EndpointName'
                },
                {
                  parameter: {
                    readable: true,
                    type: 'String',
                    subscribable: true,
                    writable: true
                  },
                  traitId: 32914,
                  traitCode: 'EndpointRoom'
                },
                {
                  parameter: {
                    readable: true,
                    defaultValue: false,
                    type: 'Bool',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32915,
                  traitCode: 'EndpointVisibility'
                },
                {
                  parameter: {
                    readable: true,
                    type: 'String',
                    subscribable: true,
                    writable: true
                  },
                  traitId: 33016,
                  traitCode: 'EndpointRoomName'
                }
              ],
              functionCode: 'EndpointLabel',
              commands: []
            }
          ],
          endpointId: 0
        },
        {
          deviceType: 'Public',
          functions: [
            {
              functionId: 130,
              traits: [
                {
                  parameter: {
                    readable: true,
                    defaultValue: false,
                    type: 'Bool',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32915,
                  traitCode: 'EndpointVisibility'
                }
              ],
              functionCode: 'EndpointLabel',
              commands: []
            },
            {
              functionId: 131,
              traits: [
                {
                  parameter: {
                    readable: true,
                    type: 'Float',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32916,
                  traitCode: 'IdentifyTime'
                },
                {
                  parameter: {
                    readable: true,
                    type: 'Enum',
                    subscribable: true,
                    writable: true
                  },
                  traitId: 32917,
                  traitCode: 'IdentifyType'
                }
              ],
              functionCode: 'Identify',
              commands: [
                {
                  commandCode: 'Identify',
                  fields: [],
                  commandId: 32918
                }
              ]
            },
            {
              functionId: 140,
              traits: [
                {
                  parameter: {
                    readable: true,
                    unit: 'W',
                    min: 0,
                    max: 5000,
                    step: 0.1,
                    type: 'Float',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32945,
                  traitCode: 'CurrentPower'
                },
                {
                  parameter: {
                    readable: true,
                    unit: 'W┬Àh',
                    min: 0,
                    max: 100000000,
                    step: 0.1,
                    type: 'Float',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32946,
                  traitCode: 'CumulativeEnergyConsumption'
                }
              ],
              functionCode: 'EnergyManagement',
              commands: []
            }
          ],
          endpointId: 1
        },
        {
          deviceType: 'Switch',
          functions: [
            {
              functionId: 130,
              traits: [
                {
                  parameter: {
                    readable: true,
                    unit: '',
                    defaultValue: 'þ╗ºþöÁÕÖ¿Õ╝ÇÕà│',
                    type: 'String',
                    subscribable: true,
                    writable: true
                  },
                  traitId: 32913,
                  traitCode: 'EndpointName'
                },
                {
                  parameter: {
                    readable: true,
                    unit: '',
                    defaultValue: 'Switch',
                    supportedValues: [
                      { value: 'Light' },
                      { value: 'Switch' },
                      { value: 'Outlet' },
                      { value: 'Fan' },
                      { value: 'Ventilation' },
                      { value: 'AirConditioner' },
                      { value: 'AirPurifier' },
                      { value: 'Humidifier' },
                      { value: 'Dehumidifier' },
                      { value: 'TV' },
                      { value: 'Refrigerator' },
                      { value: 'Computer' },
                      { value: 'WaterHeater' },
                      { value: 'Kettle' },
                      { value: 'MicrowaveOven' },
                      { value: 'Hub' },
                      { value: 'ContactSensor' },
                      { value: 'Door' },
                      { value: 'Window' },
                      { value: 'Cabinet' },
                      { value: 'Other' }
                    ],
                    type: 'String',
                    subscribable: true,
                    writable: true
                  },
                  traitId: 32929,
                  traitCode: 'EndpointApplianceType'
                },
                {
                  parameter: {
                    readable: true,
                    type: 'String',
                    subscribable: true,
                    writable: true
                  },
                  traitId: 32914,
                  traitCode: 'EndpointRoom'
                },
                {
                  parameter: {
                    readable: true,
                    defaultValue: true,
                    type: 'Bool',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32915,
                  traitCode: 'EndpointVisibility'
                },
                {
                  parameter: {
                    readable: true,
                    type: 'Bool',
                    subscribable: true,
                    writable: true
                  },
                  traitId: 33012,
                  traitCode: 'EndpointStatistics'
                },
                {
                  parameter: {
                    readable: true,
                    unit: '',
                    defaultValue: 'light_bulb',
                    supportedValues: [
                      { value: 'light_bulb' },
                      { value: 'ceiling_light' },
                      { value: 'ceiling_light_a' },
                      { value: 'ceiling_light_b' },
                      { value: 'chandelier_a' },
                      { value: 'chandelier_b' },
                      { value: 'chandelier_c' },
                      { value: 'spotlight_a' },
                      { value: 'spotlight_b' },
                      { value: 'strip_light' },
                      { value: 'string_light' },
                      { value: 'panel_light' },
                      { value: 'track_lighting' },
                      { value: 'column_light' },
                      { value: 'floor_lamp_a' },
                      { value: 'downlights_light' },
                      { value: 'wall_lamp' },
                      { value: 'child_lamp' },
                      { value: 'grille_lamp' },
                      { value: 'art_lamp' },
                      { value: 'button' },
                      { value: 'fan' }
                    ],
                    type: 'String',
                    subscribable: true,
                    writable: true
                  },
                  traitId: 32919,
                  traitCode: 'EndpointIcon'
                },
                {
                  parameter: {
                    readable: true,
                    type: 'String',
                    subscribable: true,
                    writable: true
                  },
                  traitId: 33016,
                  traitCode: 'EndpointRoomName'
                }
              ],
              functionCode: 'EndpointLabel',
              commands: []
            },
            {
              functionId: 132,
              traits: [
                {
                  parameter: {
                    readable: true,
                    type: 'Bool',
                    subscribable: true,
                    writable: true
                  },
                  traitId: 32920,
                  traitCode: 'OnOff'
                }
              ],
              functionCode: 'Output',
              commands: [
                { commandCode: 'Toggle', fields: [], commandId: 32922 }
              ]
            },
            {
              functionId: 135,
              traits: [
                {
                  parameter: {
                    readable: false,
                    unit: '',
                    supportedValues: [
                      { value: '0', key: 'SinglePress' },
                      { value: '1', key: 'DoublePress' },
                      { value: '2', key: 'LongPress' }
                    ],
                    type: 'Enum',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32928,
                  traitCode: 'ButtonEvent'
                }
              ],
              functionCode: 'Button',
              commands: []
            }
          ],
          endpointId: 2
        },
        {
          deviceType: 'Button',
          functions: [
            {
              functionId: 130,
              traits: [
                {
                  parameter: {
                    readable: true,
                    unit: '',
                    defaultValue: 'µùáþ║┐Õ╝ÇÕà│',
                    type: 'String',
                    subscribable: true,
                    writable: true
                  },
                  traitId: 32913,
                  traitCode: 'EndpointName'
                },
                {
                  parameter: {
                    readable: true,
                    unit: '',
                    defaultValue: true,
                    type: 'Bool',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32915,
                  traitCode: 'EndpointVisibility'
                },
                {
                  parameter: {
                    readable: true,
                    defaultValue: true,
                    type: 'Bool',
                    subscribable: true,
                    writable: true
                  },
                  traitId: 33012,
                  traitCode: 'EndpointStatistics'
                },
                {
                  parameter: {
                    readable: true,
                    unit: '',
                    defaultValue: 'switch',
                    supportedValues: [ { value: 'mini_switch' }, { value: 'switch' } ],
                    type: 'String',
                    subscribable: true,
                    writable: true
                  },
                  traitId: 32919,
                  traitCode: 'EndpointIcon'
                }
              ],
              functionCode: 'EndpointLabel',
              commands: []
            },
            {
              functionId: 135,
              traits: [
                {
                  parameter: {
                    readable: false,
                    unit: '',
                    supportedValues: [
                      { value: '0', key: 'SinglePress' },
                      { value: '1', key: 'DoublePress' },
                      { value: '2', key: 'LongPress' }
                    ],
                    type: 'Enum',
                    subscribable: true,
                    writable: false
                  },
                  traitId: 32928,
                  traitCode: 'ButtonEvent'
                }
              ],
              functionCode: 'Button',
              commands: []
            }
          ],
          endpointId: 5
        }
      ],
      model: 'lumi.switch.agl009'
    }
  }
}

From the response, you can then retrieve the endpointId, the functionCode, and the traitCode.

If you then send the following to the API using the intent spec.write.trait:

traits: [
        {
          deviceId: 'lumi.[DEVICE-MAC-ADDRESS]',
          endpointId: 2,
          functionCode: 'Output',
          traitCode: 'OnOff',
          value: true
        }
      ]

Does the connected circuit then turn on, or do you get an error message?

With this command, you are directly controlling the physical relay (the actual electrical circuit), completely independent of whether someone physically pressed the wall switch.

The (other) buttons themselves on the device do not control any hardware relays—they act purely as wireless smart buttons. Because they aren’t physically wired to a load, you cannot send a “switch” command to them; it wouldn’t make sense since there is no circuit to close.

Instead, you use the API to listen for their incoming events (like a single, double, or long press). If you want one of these buttons to turn on a smart bulb, for example, you simply catch that event and handle the automation logic on the software side. You essentially have to script the automation flow yourself: listen for the event (e.g., a “single click”), and then send an API command to turn on the target light.

Following.