Service¶
Service Base class for a HAP Accessory
.
-
class
pyhap.service.
Service
(type_id, display_name=None, unique_id=None)[source]¶ A representation of a HAP service.
A Service contains multiple characteristics. For example, a TemperatureSensor service has the characteristic CurrentTemperature.
-
configure_char
(char_name, properties=None, valid_values=None, value=None, setter_callback=None, getter_callback=None)[source]¶ Helper method to return fully configured characteristic.
-
classmethod
from_dict
(name, json_dict, loader)[source]¶ Initialize a service object from a dict.
Parameters: json_dict (dict) – Dictionary containing at least the keys UUID and RequiredCharacteristics
-
get_characteristic
(name)[source]¶ Return a Characteristic object by the given name from this Service.
Parameters: name (str) – The name of the characteristic to search for. :raise ValueError if characteristic is not found.
Returns: A characteristic with the given name. Return type: Characteristic
-