Issue with integration of Domoticz and Matter server: Unable to switch On/Off

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!

Moderators: leecollings, remb0

Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post

Please mark your topic as Solved when the problem is solved.
Post Reply
Jamboman
Posts: 2
Joined: Tuesday 31 December 2024 12:35
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Issue with integration of Domoticz and Matter server: Unable to switch On/Off

Post by Jamboman »

I am experiencing a problem controlling a Matter On/Off device from Domoticz using the Python Matter Server.

The Matter device is discovered correctly and state synchronization works in one direction, but switching the device from Domoticz fails.


Environment
Domoticz: 2026.2 (build 18141)
Hardware type: Matter (python-matterjs-server)

Matter Server Docker image:

ghcr.io/matter-js/python-matter-server:stable

Matter Server version:

2025.7.0
Platform:
Synology DS918+
DSM 7.x
Container Manager
Docker network mode: host

Docker compose:

services:
matter-server:
image: ghcr.io/matter-js/python-matter-server:stable
container_name: matter-server
restart: unless-stopped
network_mode: host
security_opt:
- apparmor:unconfined
volumes:
- ./data:/data


Matter device

KlikAanKlikUit MAGC-2300 (Matter smart plug/switch)

Commissioned using Apple Home.

Added to the Python Matter Server via Multi-Admin.


Behaviour

- Works correctly
Apple Home can switch the device.
Matter Server receives the correct state.
Domoticz discovers the device.
Domoticz correctly updates the device status when it is switched from Apple Home.

- Does not work
Switching the device from Domoticz immediately fails.


Domoticz logs:

Status: User: admin initiated a switch command (.../On)

Error: Matter: Server error:
type object 'Commands' has no attribute 'on'

Matter: Light/Switch (...)

Matter Server logs:

AttributeError:
type object 'Commands' has no attribute 'on'. Did you mean: 'On'?

Traceback (most recent call last):

File "/usr/local/lib/python3.12/site-packages/matter_server/server/client_handler.py", line 213, in _run_handler
raise err

File "/usr/local/lib/python3.12/site-packages/matter_server/server/client_handler.py", line 196, in _run_handler
result = await result

File "/usr/local/lib/python3.12/site-packages/matter_server/server/device_controller.py", line 703, in send_device_command
command_cls = getattr(cluster_cls.Commands, command_name)


Analysis

The Python Matter Server attempts:

getattr(cluster_cls.Commands, command_name)

where command_name appears to be:

on

However, the current CHIP SDK exposes:

Commands.On
Commands.Off


which results in the AttributeError.

It is therefore unclear whether:

Domoticz sends "on" instead of "On", or
the Matter Server converts "On" to "on" before calling getattr().

Since the Matter Server traceback indicates the exception occurs inside send_device_command(), it may be helpful to log the received command_name before the getattr() call.


Expected behaviour

Clicking On or Off in Domoticz should switch the Matter device successfully.


Additional observations

State synchronization from Apple Home → Matter Server → Domoticz works perfectly.

Only Domoticz → Matter Server → device fails.
User avatar
gizmocuz
Posts: 3026
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Issue with integration of Domoticz and Matter server: Unable to switch On/Off

Post by gizmocuz »

Thanks for the detailed report, the logs made this easy to track down!

You found a real bug. The Matter driver was developed and tested against matterjs-server, which is tolerant about command name casing (it converts whatever it receives).
The original python-matter-server that you are running is strict: it looks up the command name directly on the Matter SDK command classes, which are PascalCase. Domoticz was sending "on" instead of "On", hence the AttributeError you saw.
That also explains why state updates worked fine in one direction: those don't involve command names at all.

I've just pushed a fix that sends the proper PascalCase command names (On, Off, MoveToLevelWithOnOff, etc.) for all device commands. This works with both python-matter-server and matterjs-server.

The fix will be included in beta build 18167 (or later).

Please update to the latest beta once it's available and let me know if you can control your MAGC-2300 from Domoticz.
Quality outlives Quantity!
Post Reply