ZWaveCommandClass
homey.zwave_command_class
A Z-Wave Command Class for a ZWaveNode in Homey. At runtime this class is populated with static methods corresponding to the commands of the command class.
Example
from homey.device import Device
from homey.zwave_node import ZWaveNode
class MyDevice(Device):
node: ZWaveNode
async def on_init(self):
self.node = await self.homey.zwave.get_node(self)
command_class = self.node.command_classes["COMMAND_CLASS_BASIC"]
if command_class is not None:
command_class.on("report", self.handle_report)
self.log("Device state:", await command_class.send_command("BASIC_GET"))
def handle_report(self, command, report):
self.log(command.name, "report:", report)
homey_export = MyDevice
This class must not be initialized by the developer, but retrieved from <code><a title="homey.zwave_node.ZWaveNode.command_classes" href="zwave_node.html#homey.zwave_node.ZWaveNode.command_classes">ZWaveNode.command\_classes</a></code>.
Ancestors
- SimpleClass
- homey.util.event_emitter.EventEmitter
- typing.Generic
Methods
send_command
async def send_command(self, command: str, arguments: dict[str, Any] | None = None) ‑> AnySend the given command with the given arguments.
Returns
The response from the Z-Wave device.
on_report
def on_report(self,f: Callable[[Command, dict, int], None]) ‑> Self
This event is fired when a report has been received from this command class.
Args
| Name | Type | Description |
|---|---|---|
f |
Callable[[Command, dict, int], None] | A callback that receives the command object, the report, and the ID of the node. |
Inherited members
Command
Ancestors
- builtins.dict