PyMochad API¶
The PyMochad Controller Class¶
This is used to interact with the X10 controller directly using the mochad socket
-
class
pymochad.controller.PyMochad(server=None, port=1099)¶ Bases:
objectPyMochad controller class
This class is used to create a PyMochad controller object that is used to send commands to a running PyMochad daemon.
Parameters: - server (str) – The host to connect to the pymochad socket on, it defaults to localhost
- port (int) – The port to use for remote connections. If one is not provided it will just use the default port of 1099.
-
read_data()¶ Read data from mochad
Return data: The data returned over the mochad socket Return type: str
-
reconnect()¶ Reconnect when mochad server is restarted/lost connection.
-
send_cmd(cmd)¶ Send a raw command to mochad.
Parameters: cmd (str) – The command to send to mochad
-
status()¶ Send a show device status command.
Return status: The status of device including RF security devices Return type: str
The PyMochad Device Class¶
This is used to interact with an X10 device
-
class
pymochad.device.Device(controller, address, comm_type='pl')¶ Bases:
objectPyMochad Device class
This class represents an X1 device connected to your controller
Parameters: - controller (PyMochad) – A PyMochad controller object for the device to use
- address (str) – The device address
- comm_type (str) – The communication type to use for the device. This is either pl (for power line) or rf (for radio frequency)
-
get_status()¶ Get the on/off status for the devices
Returns: Device status Return type: str
-
get_statussec()¶ Get the on/off status for the X10 Security devices
Returns: Device status Return type: str
-
send_cmd(cmd)¶ Send a raw command to device.
Parameters: cmd (str) – The command to send to the device