Matter Bindings [script]

I don’t know the routing details within the Thread mesh or once it’s on Ethernet. I’ve never dug into that layer.

1 Like

Note that a device using bindings could as well subscribe to the bound / target device to receive changes so it actually depends on how the “from” device is implemented since it’s the one initiating the interaction.

Here are three examples of a motion sensor turning on a light.

  1. With a hub automation, the hub subscribes for changes in the occupancy state so the motion sensor tells the hub there’s someone and the hub runs its automation and sends the “switch on” command to the light.

  2. With a binding from the sensor to the light, the motion sensor will send a “switch on” command to the light when it detects someone. Note that the light doesn’t even know it’s a motion sensor and the motion sensor doesn’t care at all if the light was on or off.

  3. With a binding from the light to the motion sensor. The light subscribes to the occupancy state in the motion sensor, the motion sensor will tell the light that there’s someone and the light will say “oh, there’s someone, I’ll switch on”. Note the sensor doesn’t even know it’s a light, it just reports its occupancy state instead of controlling the light.

Case 2 depends on the motion sensor supporting bindings to the OnOff cluster (I believe Eve supports it) and case 3 depends on the light supporting bindings to the Occupancy Sensing cluster (I believe there’s none in the market).

1 Like

Hello once again,

to make sure, to have a fresh start I reset the devices and brought them back to home assistant. They received new node IDs (bulb 37, switch 38).
I also have to mention, that after a restart of my Mac I had to rerun all 3 lines you provided:

python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install websocket-client

After verifying, that I could switch the light on/off through Home Assistant I tried to do the binding:
That is what I typed / received:

(.venv) markus@MacBook-Pro-Markus PythonScript % python3 matter-binding.py --from 38 --to 37
Connection successful to ws://homeassistant.local:5580/ws
Fabric ID: 2
Updating ACL…
ACL updated
Creating binding…
An error occurred: ‘str’ object has no attribute ‘items’

Tried suggested :1 subset of switch, but it seems this did not cause the error to come up:

(.venv) markus@MacBook-Pro-Markus PythonScript % python3 matter-binding.py --from 38:1 --to 37
Connection successful to ws://homeassistant.local:5580/ws
Fabric ID: 2
Updating ACL…
ACL updated
Creating binding…
An error occurred: ‘str’ object has no attribute ‘items’

So I am some steps further but have not managed a binding yet.

Cheers,
Session

Evidently my script falls on its face for your device. DM sent so we can debug it.