libHAASP
HAASP library contains all essential help function to communicate between application and core.
The library is divided in three main parts:
app_object
config_object
event_object
Installation
Pip:
Make sure you have python3, git and pip installed
pip install -U git+https://git.cmtec.se/haasp/libhaasp.git
Usage
This is only a python library intended as help develop HAASP modules. The library can not be run stand alone.
Developmen usage
app_object
Definition classes
class MONITOR_PAYLOAD:
APP = "app"
REFERENCE = "reference"
VALUE = "value"
NAME = "name"
DIRECTION = "direction"
class MESSAGE:
EVENT = "event"
REFERENCE = "reference"
VALUE = "value"
SOURCE = "source"
DESTINATION = "destination"
COMMAND = "command"
COMMAND_RESPOND = "command_respond"
OPTIONS = "options"
class COMMAND:
GET_CONFIG = "get_config"
RESEND_OBJECT_EVENTS = "resend_object_events"
PING = "ping"
CLI_SEND_EVENT = "cli_send_event"
CLI_PING = "cli_ping"
CLI_WAIT = "cli_wait"
class DESTINATION:
CORE = "core"
TIMER = "timer"
CLOCK = "clock"
ZWAVE = "zwave"
HUEE = "huee"
BROADLINK = "broadlink"
WEBAPP = "webapp"
YEELIGHT = "yeelight"
POSTGRESQL = "postgresql"
OCTOPRINT = "octoprint"
WEPAPI = "webapi"
CHROMECAST = "chromecast"
class SOURCE:
CORE = "core"
TIMER = "timer"
CLOCK = "clock"
ZWAVE = "zwave"
HUEE = "huee"
BROADLINK = "broadlink"
WEBAPP = "webapp"
YEELIGHT = "yeelight"
CoreZMQ
Communication class for HASSP Core
AppZMQ
Communication class for HAASP Applications
AppObject
Object class for HAASP Applications
Example
from libhaasp import AppObject, SOURCE, DESTINATION, COMMAND, MESSAGE
class Zwave(AppObject):
config_object
ConfigObject
Configuration class used in the main core configuration
Example
from libhaasp import EventObject, ConfigObject
class Config(ConfigObject):
event_object
Definition classes
class EVENT_MESSAGE:
APP = "app"
REFERENCE = "reference"
VALUE = "value"
OPTIONS = "options"
EventObject
Event object used in the main core configuration
Example
from libhaasp import EventObject, ConfigObject
class Config(ConfigObject):
def setup(self):
# -------------------------------------------------------------------------
# Create event objects
# -------------------------------------------------------------------------
self.clock = EventObject("clock", "now")