How to use stateless programmable switch?

Does home assistant support stateless programmable switch?
how to use stateless programmable switch?
Thanks.

Depends on the switch, there are a lot of supported ones. Which one do you have?

For a stateless switch you will receive events in home assistant

@ Burningstone
Thanks for reply

My switch is xiaomi stateless programmable switch.
and in my entities list ,there are no xiaomi stateless programable switch there,there are some “Stateless Programmable Switch Battery”

How are you connecting to the Xiaomi Switch? Are you using the xiaomi gateway itself, or something like the conbee stick?

@ dgaust
First,i add the wireless switch to xiaomi smart multi-mode hub by mi home.
then,I add xiaomi smart multi-mode hub as a homkit.

Which device is it exactly? Can you give a model number or even a pointer to the device for sale?

There will be no entity created for the switch, instead you will receive the button presses as a event. In home assistant go to Developer Tools -> Events -> in the “listen to events” box enter “xiaomi_aqara.click” -> press “start listening” -> press a button on the switch and see if you receive an event there. If this works you can check the examples here to understand how to use these events.

@nickrout

I find this in file homekit_controller-entity-map

{
“aid”: 17,
“services”: [
{
“characteristics”: [
{
“description”: “Identify”,
“format”: “bool”,
“iid”: 2,
“perms”: [
“pw”
],
“type”: “00000014-0000-1000-8000-0026BB765291”
},
{
“description”: “Manufacturer”,
“ev”: false,
“format”: “string”,
“iid”: 3,
“perms”: [
“pr”
],
“type”: “00000020-0000-1000-8000-0026BB765291”,
“value”: “Mi”
},
{
“description”: “Model”,
“ev”: false,
“format”: “string”,
“iid”: 4,
“perms”: [
“pr”
],
“type”: “00000021-0000-1000-8000-0026BB765291”,
“value”: “MK001”
},
{
“description”: “Name”,
“ev”: false,
“format”: “string”,
“iid”: 5,
“perms”: [
“pr”
],
“type”: “00000023-0000-1000-8000-0026BB765291”,
“value”: “Stateless Programmable Switch”
},
{
“description”: “Serial Number”,
“ev”: false,
“format”: “string”,
“iid”: 6,
“perms”: [
“pr”
],
“type”: “00000030-0000-1000-8000-0026BB765291”,
“value”: “lumi.158d0003cc08c0”
},
{
“description”: “Firmware Revision”,
“ev”: false,
“format”: “string”,
“iid”: 7,
“perms”: [
“pr”
],
“type”: “00000052-0000-1000-8000-0026BB765291”,
“value”: “1.0.1”
},
{
“description”: “Hardware Revision”,
“ev”: false,
“format”: “string”,
“iid”: 8,
“perms”: [
“pr”
],
“type”: “00000053-0000-1000-8000-0026BB765291”,
“value”: “1”
}
],
“hidden”: false,
“iid”: 1,
“linked”: [],
“primary”: false,
“stype”: “accessory-information”,
“type”: “0000003E-0000-1000-8000-0026BB765291”
},
{
“characteristics”: [
{
“ev”: false,
“format”: “string”,
“iid”: 255,
“perms”: [
“pr”
],
“type”: “00000023-0000-1000-8000-0026BB765291”,
“value”: “Button”
},
{
“ev”: false,
“format”: “uint8”,
“iid”: 272,
“maxValue”: 2,
“minStep”: 1,
“minValue”: 0,
“perms”: [
“pr”,
“ev”
],
“type”: “00000073-0000-1000-8000-0026BB765291”,
“valid-values”: [
0,
1,
2
],
“value”: null
}
],
“hidden”: false,
“iid”: 57,
“linked”: [],
“primary”: true,
“stype”: “stateless-programmable-switch”,
“type”: “00000089-0000-1000-8000-0026BB765291”
},
{
“characteristics”: [
{
“ev”: false,
“format”: “string”,
“iid”: 254,
“perms”: [
“pr”
],
“type”: “00000023-0000-1000-8000-0026BB765291”,
“value”: “Battery”
},
{
“ev”: false,
“format”: “uint8”,
“iid”: 265,
“maxValue”: 100,
“minStep”: 1,
“minValue”: 0,
“perms”: [
“pr”,
“ev”
],
“type”: “00000068-0000-1000-8000-0026BB765291”,
“unit”: “percentage”,
“value”: 75
},
{
“ev”: false,
“format”: “uint8”,
“iid”: 266,
“maxValue”: 2,
“minStep”: 1,
“minValue”: 0,
“perms”: [
“pr”,
“ev”
],
“type”: “0000008F-0000-1000-8000-0026BB765291”,
“valid-values”: [
0,
1,
2
],
“value”: 2
},
{
“ev”: false,
“format”: “uint8”,
“iid”: 267,
“maxValue”: 1,
“minStep”: 1,
“minValue”: 0,
“perms”: [
“pr”,
“ev”
],
“type”: “00000079-0000-1000-8000-0026BB765291”,
“valid-values”: [
0,
1
],
“value”: 0
}
],
“hidden”: false,
“iid”: 52,
“linked”: [],
“primary”: false,
“stype”: “battery”,
“type”: “00000096-0000-1000-8000-0026BB765291”
}
]
}
],

why? there is a xiaomi integration in HA.

The wireless is a zigbee device,it must connect to a hub, ha can not directly connect to the wireless switch. and the hub is the latest product,it supports connection as a homekit.

Yes you are right, but HA can connect directly to the Xiaomi gateway instead of going through homekit.

@ Burningstone
The hub is the newest hub,ha did’t support the device.
The hub’s name is Mi Smart Home Hub-6399 in file core.device_registry

link here
https://www.cnx-software.com/2020/01/02/xiaomi-smart-multi-mode-gateway-supports-zigbee-3-0-wifi-bluetooth-and-bluetooth-mesh/

I can’t find event ““xiaomi_aqara.click” in log file,when i get home,i will post the log file here.

What log file are you talking about? If you are talking about the home assistant log, you will not see these events there.

When i set logger level = debug,i found some events in [home-assistant.log]

You need to go into the Developer Tools screen, select the Events tab and then subscribe to the homekit event (should be on the right hand side of the screen).

Type the name of the available event into the “Event to subscribe to” box at the bottom of the screen.

You should see the events there once you press the buttons.

1 Like

Get a different hub, conbee or zigbee2mqtt

Conbee (using deConz) is the same… except it uses deconz_events rather than homebridge events.

Thanks.
I set ‘*’ to listen, and click the switch about 50 times,and wait for 5 minutes, no any click event show there.
This is the picture of the switch.
https://www.zigbee2mqtt.io/devices/WXKG01LM.html

May be i need to wait homekit upgrade to support the switch.

Or use DeCONZ or ZigBee2MQTT and ditch the phone-home Xiaomi hub.