Method Reference

System methods

class gearthonic.methods.SystemMethodsCollection(caller)[source]

All XML RPC server provide a set of standard methods.

get_capabilities()[source]

Lists server’s XML RPC capabilities.

Example output:

{
    'xmlrpc': {'specUrl': 'http://example.com', 'specVersion': 1}
    'faults_interop': {'specUrl': 'http://example2.com', 'specVersion': 101}
    'introspection': {'specUrl': 'http://example3.com', 'specVersion': 42}
}
Returns:A dict containing all information
Return type:dict
list_methods()[source]

Lists servers’s XML RPC methods.

Returns:A list of available methods
Return type:list
method_help(method_name)[source]

Returns the description of a method.

Parameters:method_name (str) – The name of the method
Returns:The description of the method
Return type:str
method_signature(method_name)[source]

Returns the signature of a method.

Parameters:method_name (str) – The name of the method
Returns:The signature of the method
Return type:list
multicall(methods)[source]

Call multiple methods at once.

Example list of methods:

[
    {'methodName': 'getValue', 'params': [13, 4, 'TEMPERATURE']},
    {'methodName': 'getValue', 'params': [3, 3, 'HUMIDITY']}
]

Return value of the multicall:

[22.0, 58]
Parameters:methods (list) – A list of methods and their parameters
Returns:A list of method responses.
Return type:list

Device methods

class gearthonic.methods.DeviceMethodsCollection(caller)[source]

All device related methods.

Returns:
get_value(peer_id, channel, key, request_from_device=False, asynchronous=False)[source]

Return the value of the device, specified by channel and key (parameterName).

Per default the value is read from the local cache of Homegear. If the value should be read from the device, use request_from_device. If the value should be read from the device, this can be done asynchronously. The method returns immediately and doesn’t wait for the current value. The value will be sent as an event as soon as it’s returned by the device.

Error codes:

  • Returns -2 when the device or channel is unknown
  • Returns -5 when the key (parameter) is unknown
Parameters:
  • peer_id (int) – ID of the device
  • channel (int) – Channel of the device to get the value for
  • key (str) – Name of the parameter to get the value for
  • request_from_device (bool) – If true value is read from the device
  • asynchronous (bool) – If true value is read asynchronously
Returns:

The value of the parameter or error code

Return type:

unknown

list_devices()[source]

Return a list of devices.

Returns:List of devices
Return type:list
set_value(peer_id, channel, key, value)[source]

Set the value of the device, specified by channel and key (parameterName).

Parameters:
  • peer_id (int) – ID of the device
  • channel (int) – Channel of the device to set the value for
  • key (str) – Name of the parameter to get the value for
  • value (unknown) – The value to set
Returns:

  • None on success
  • -2 when the device or channel is unknown
  • -5 when the key (parameter) is unknown
  • -100 when the device did not respond
  • -101 when the device returns an error