Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong example for sending a command #384

Closed
farshidtz opened this issue Sep 8, 2023 · 2 comments · Fixed by #387
Closed

Wrong example for sending a command #384

farshidtz opened this issue Sep 8, 2023 · 2 comments · Fixed by #387

Comments

@farshidtz
Copy link
Contributor

farshidtz commented Sep 8, 2023

I find it hard to make sense of the example given for sending a command:

command = clusters.OnOff.Commands.On()
payload = dataclass_to_dict(command)
{
"message_id": "device_command",
"command": "device_command",
"args": {
"endpoint": int(self.attribute['endpoint']),
"node_id": int(self.attribute['node_id']),
"payload": payload
}
}

Are the message ID and command values correct? Endpoint and node ID values reference some missing code. Is the given dictionary meant to be a JSON example, outside the Python code?
How will the controller know which cluster command is being executed? In the given example, payload will be an empty object.

@farshidtz
Copy link
Contributor Author

The JSON object for the On command should be, for example:

{
    "message_id": "4",
    "command": "device_command",
    "args": {
      "endpoint_id": 1,
      "node_id": 1,
      "payload": {},
      "cluster_id": 6,
      "command_name": "On"
    }
}

farshidtz added a commit to farshidtz/home-assistant-python-matter-server that referenced this issue Sep 8, 2023
@marcelveldt
Copy link
Contributor

You can have a look at the included client for a reference implementation, together with Home Assistant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants