Device Templates¶
- class
festivalgrid.device_templates.device.
DeviceTemplate
(device)[source]¶ The base class for device templates.
Note
Usually you will only inherit from this class if you implement a new low level device template class like
MQTTDevice
.-
__init__
(device)[source]¶ Initialize a device template.
- Args:
device (
festivalgrid.models.Device
): Device object instance.
-
digest_msg
(msg)[source]¶ This method gets called whenever we fetch/receive a new message from a device. You must take care of parsing/interpreting the message and return a dict that can be stored into the time series database.
- Args:
msg (str): The message that needs digesting
- Returns:
bool:
True -- Cut the power
-
get_device_admin_link
()[source]¶ Implement this if your device has a web admin interface.
- Returns:
dict. Should return a dict with two keys:
title -- Title of the link url -- Full url to the device admin (e.g. http://192.168.1.4/admin)
-
notify_setup_change
(model)[source]¶ This method gets called whenever a device’s configuration was changed (e.g. through the app or admin interface)
- Args:
model (
festivalgrid.models.Device
): The device that was changed.
-