Navigation :
Zwave
Config Time Setup example
class Config(ConfigObject):
def config(self):
config = {}
# Clock
config["clock"] = {}
config["clock"]["location"] = "copenhagen"
# Zwave
config["zwave"] = {}
config["zwave"]["device"] = "/dev/serial/by-id/usb_id_zwave_controller"
return config
def setup(self):
# time events ----------------------------------------------------------
self.clock = EventObject("clock", "now")
self.sunset = EventObject("clock", "sunset")
self.sunrise = EventObject("clock", "sunrise")
# zwave devices --------------------------------------------------------
self.zwave_hallway_light_power = EventObject("zwave", "72057462682163904")
def process_event(self):
if self.clock.event == self.sunset.value:
self.zwave_hallway_light_power.set("true")
if self.clock.event == self.sunrise.value:
self.zwave_hallway_light_power.set("false")
Config WebApp Setup example
class Config(ConfigObject):
def config(self):
config = {}
# Zwave
config["zwave"] = {}
config["zwave"]["device"] = "/dev/serial/by-id/usb_id_zwave_controller"
# WebApp
config["webapp"] = {}
config["webapp"]["servers"] = ["zwave"]
return config
def setup(self):
# zwave devices --------------------------------------------------------
self.zwave_hallway_light_power = EventObject("zwave", "72057462682163904")
# WebApp -------------------------------------------------------------------
self.webapp_hallway_light = EventObject("webapp", "toggle.hallway.hallway")
def process_event(self):
if self.webapp_hallway_light.event == "request_true":
self.webapp_hallway_light.set("request_true")
self.zwave_hallway_light_power.set("true")
if self.webapp_hallway_light.event == "request_false":
self.webapp_hallway_light.set("request_false")
self.zwave_hallway_light_power.set("false")
if self.zwave_hallway_light_power.event == "true":
self.zwave_hallway_light_power.set("true")
if self.zwave_hallway_light_power.event == "false":
self.zwave_hallway_light_power.set("false")