Hi all, is there a way once a matter device is added to Home Assistant that we can share it to Google Home, in the same way if you add it to Google first you can share to Home Assistant?
I’d like to know too. I connected my Nanoleaf lights directly to Home Assistant since the Yellow has the thread router and when I tried connecting to Google Home first the share to Hone Assistant failed.
There is a websocket API available on the Matter Server and one of its commands in particular can be used to "Open up a Commissioning Window. It is my understanding that opening up a Commissioning Window is used to commission an existing device on one Matter fabric to another Matter fabric.
It looks like there is a service available in the UI->DevTool->Services for this:
Matter (BETA): Open commissioning window
Looks like you can use “UI Mode” to select the device id.
I have not tried this myself.
Otherwise, the only other way I know to use this particular API command would be to write you own code to call the websocket API.
@wmaker I tried that today with my TP-Link Tapo TS25 Dimmer. It failed. Not unexpected since the matter server is in beta. I didn’t really expect it to work since I don’t have another matter device in the network so fabric can’t be used.
Logger: homeassistant.helpers.script.websocket_api_script
Source: helpers/script.py:468
First occurred: 8:34:29 AM (1 occurrences)
Last logged: 8:34:29 AM
websocket_api script: Error executing script. Unexpected error for call_service at pos 1: IM Error 0x00000602: Cluster-specific error: 0x02
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 704, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 666, in _async_run_long_action
return long_task.result()
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2067, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2104, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 986, in admin_handler
await result
File "/usr/src/homeassistant/homeassistant/components/matter/__init__.py", line 256, in open_commissioning_window
await matter_client.open_commissioning_window(node.node_id)
File "/usr/local/lib/python3.11/site-packages/matter_server/client/client.py", line 162, in open_commissioning_window
await self.send_command(
File "/usr/local/lib/python3.11/site-packages/matter_server/client/client.py", line 330, in send_command
return await future
^^^^^^^^^^^^
matter_server.common.errors.SDKStackError: IM Error 0x00000602: Cluster-specific error: 0x02
I have an HA Green and utilising the eve motion sensor Matter/thread. Its very stable on HA, I’ve so far had no issues with it. I want to share this device with Amazon echo fabric but to leave it in HA.
I utilised the “Open commissioning window” within the HA UI which seems to function as I get returned a green tick and a note saying it will be open for 60sec.
But a code is required by echo to grab this device and share it into the echo fabric. I’ve checked all the Log entries within HA for an issued code but cant locate it. Could anyone tell me where, once I’ve opened the commissioning window, this code resides in the HA Green.
Thanks in advance
I just tried this myself and got the same results (just a green check mark). This service call is suppose to return the codes, but apparently HA doesn’t yet display it. Maybe if you put the Matter Server AddOn logs in “debug” you might see it there.
A bit of an update…Some discussion on Discord and this Forum seems to say that this feature is not fully developed yet but is being worked on. I’m not sure if that means its just the client side (meaning HA core) or the Matter Server side. If anyone is interested, here is some Python client side code that one can try to see if the Matter Server itself works or not.
Make sure to change the node_id
for the device of interest.
from websocket import create_connection
#
# Open websocket, and get initial message from the other end
#
ws = create_connection("ws://homeassistant.local:5580/ws")
print("Opening receive message")
print(ws.recv())
print("Sending message ...")
ws.send('{\
"message_id":"101",\
"command":"open_commissioning_window",\
"args": {\
"node_id": 3 \
}\
}')
print("Sent")
print("Receiving...")
result = ws.recv()
print("Received '%s'" % result)
ws.close()
I tried this on my system the Matter Server does return pin code, manual code, and QR code, but I don’t have another Matter Fabric to make use of this.
[EDIT-UPDATE] I dug into the Matter-server logs, and I see that when the Matter Server gets the message from the Python code that the Matter-server turns around and starts communicating with the device and getting a positive acknowledgement back from the device, so my guess is that the Matter Server portion actually works.
I went through the debug logs and there didn’t seem to be any code return within those.
Not being familiar with YAML I haven’t tried the above solution and was hoping for a more user friendly resolution.
When you run the script you get the manual and QR code returned, where is this return displayed, in the matter server logs or does it generate within the lines of code you entered?
Run the Python code from a shell/command-line and it will print out the returned results including the codes at the shell/command-line. You should see something like the following at the end:
Receiving...
Received '{
"message_id": "101",
"result": {
"setupPinCode": 12345678,
"setupManualCode": "12345678901",
"setupQRCode": "MT:00000CQM00KKKK2ZH10"
}
}'
You should be able to use the returned setupManualCode
as the manual pairing code for the device (btw, the QR Code that is returned is not an image, but the actual string that a QR image would generate from a QR scanner, so don’t bother with it).
Also, I have tried this Python code within the “Advanced SSH & Web Terminal” Add-On and have gotten it to work, but you first have to do: pip install websocket-client
.
After than just run it as python3 name-of-code.py
Thanks, by putting device in pairing mode by using this python script I was able to add Sonoff minir4m to eWeLink app and update firmware from it!