def initialize(self): self.timer_handle_list = [] self.listen_event_handle_list = [] self.listen_state_handle_list = [] self.app_switch = globals.get_arg(self.args,"app_switch") self.rain_precip_sensor = globals.get_arg(self.args,"rain_precip_sensor") self.rain_precip_intensity_sensor = globals.get_arg(self.args,"rain_precip_intensity_sensor") self.precip_type_sensor = globals.get_arg(self.args,"precip_type_sensor") self.notify_name = globals.get_arg(self.args,"notify_name") self.user_id = globals.get_arg(self.args,"user_id") self.reminder_acknowledged_entity = globals.get_arg(self.args,"reminder_acknowledged_entity") self.message = globals.get_arg(self.args,"message_DE") self.message_not_needed = globals.get_arg(self.args,"message_not_needed_DE") self.message_evening = globals.get_arg(self.args,"message_evening_DE") self.intensity_minimum = 2 # mm/h self.propability_minimum = 90 # % self.keyboard_callback = "/plants_watered" self.notifier = self.get_app('Notifier') self.reminder_acknowledged = self.get_state(self.reminder_acknowledged_entity) self.listen_event_handle_list.append(self.listen_event(self.receive_telegram_callback, 'telegram_callback')) #Remind daily at 08:00 self.timer_handle_list.append(self.run_daily(self.run_morning_callback, datetime.time(8, 0, 0))) #Remind daily at 18:00 self.timer_handle_list.append(self.run_daily(self.run_evening_callback, datetime.time(18, 0, 0)))
def initialize(self): self.listen_state_handle_list = [] self.app_switch = globals.get_arg(self.args, "app_switch") self.watch_list = globals.get_arg_list(self.args, "watch_list") self.message = globals.get_arg(self.args, "message") self.message_back_online = globals.get_arg(self.args, "message_back_online") self.notify_name = globals.get_arg(self.args, "notify_name") try: self.use_alexa = globals.get_arg(self.args, "use_alexa") except KeyError: self.use_alexa = False self.notifier = self.get_app("Notifier") if self.get_state(self.app_switch) == "on": for sensor in self.watch_list: if (self.get_state(sensor) is None or self.get_state(sensor).lower() == "unknown"): self.notifier.notify( self.notify_name, self.message.format(self.friendly_name(sensor)), useAlexa=self.use_alexa, ) for sensor in self.watch_list: self.listen_state_handle_list.append( self.listen_state(self.state_change, sensor))
def initialize(self): self.listen_event_handle_list = [] self.tag = globals.get_arg(self.args, "tag") try: self.script = globals.get_arg(self.args, "script") self.log("script set to " + self.script) except: self.script = None self.log("No script set!") try: self.entity = globals.get_arg(self.args, "entity") self.log("entity set to " + self.entity) except: self.entity = None self.log("No entity set!") try: self.action = globals.get_arg(self.args, "action") self.log("action set to " + self.action) except: self.action = None self.log("No action set!") self.listen_event_handle_list.append( self.listen_event(self.scanned, "tag_scanned", tag_id=str(self.tag)))
def initialize(self): self.timer_handle_list = [] self.listen_event_handle_list = [] self.listen_state_handle_list = [] self.alarm_time = globals.get_arg(self.args, "alarm_time") self.wakemeup = globals.get_arg(self.args, "wakemeup") self.naturalwakeup = globals.get_arg(self.args, "naturalwakeup") self.alarmweekday = globals.get_arg(self.args, "alarmweekday") self.radiowakeup = globals.get_arg(self.args, "radiowakeup") self.isweekday = globals.get_arg(self.args, "isweekday") self.notify_name = globals.get_arg(self.args, "notify_name") self.wakeup_light = globals.get_arg(self.args, "wakeup_light") self.fade_in_time_multiplicator = globals.get_arg( self.args, "fade_in_time_multiplicator") self.message = globals.get_arg(self.args, "message_DE") self.notifier = self.get_app('Notifier') self.brightness = 100 self.rgb = (255, 255, 255) self.cached_alarm_time = self.get_state(self.alarm_time) self.cached_fade_in_time = self.get_state(self.naturalwakeup) self.add_timer() self.listen_state_handle_list.append( self.listen_state(self.state_change, self.alarm_time)) self.listen_state_handle_list.append( self.listen_state(self.state_change, self.naturalwakeup))
def initialize(self): self.isInitialized = "trigger" in self.args if not self.isInitialized: self.log("Skipping setup, no trigger.") return self.timer_handle = None self.listen_state_handle_list = [] self.timer_handle_list = [] self.app_switch = globals.get_arg(self.args, "app_switch", allow_empty=True) self.sensors = globals.get_arg_list(self.args, "sensors") self.entities_on = globals.get_arg_list(self.args, "entities_on", allow_empty=True) self.entities_off = globals.get_arg_list(self.args, "entities_off", allow_empty=True) self.services = globals.get_arg_list(self.args, "services", allow_empty=True) self.trigger = globals.get_arg(self.args, "trigger") for sensor in self.sensors: self.listen_state_handle_list.append( self.listen_state(self.state_changed, sensor))
def initialize(self): self.listen_state_handle_list = [] self.timer_handle_list = [] self.delay = 600 self.app_switch = globals.get_arg(self.args, "app_switch") self.input_boolean = globals.get_arg(self.args, "input_boolean") self.device_tracker = globals.get_arg(self.args, "device_tracker") self.door_sensor = globals.get_arg(self.args, "door_sensor") device_tracker_state = self.get_state(self.device_tracker, attribute="all") if self.get_state(self.app_switch) == "on": if device_tracker_state["state"] == "home": self.log("User is home") self.timer_handle_list.append( self.run_in(self.turn_on_callback, 0, turn_on_entity=self.input_boolean)) else: self.log("User is not home") self.timer_handle_list.append( self.run_in(self.turn_off_callback, 0, turn_off_entity=self.input_boolean)) self.listen_state_handle_list.append( self.listen_state(self.state_change, self.door_sensor)) self.listen_state_handle = None
def initialize(self): self.listen_event_handle_list = [] self.notify_name = globals.get_arg(self.args, "notify_name") self.user_id = globals.get_arg(self.args, "user_id") self.message = globals.get_arg(self.args, "message") self.fritzbox_url = globals.get_arg(self.args, "fritzbox_url") self.fritzbox_user = globals.get_arg(self.args, "fritzbox_user") self.fritzbox_password = globals.get_arg(self.args, "fritzbox_password") self.fritzbox_profile_name = globals.get_arg(self.args, "fritzbox_profile_name") self.message_allow_access = globals.get_arg(self.args, "message_allow_access") self.message_access_allowed = globals.get_arg( self.args, "message_access_allowed") self.message_access_blocked = globals.get_arg( self.args, "message_access_blocked") self.notifier = self.get_app('Notifier') self.listen_event_handle_list.append( self.listen_event(self.newDevice, "device_tracker_new_device")) #subscribe to telegram events self.listen_event_handle_list.append( self.listen_event(self.receive_telegram_callback, 'telegram_callback'))
def state_changed(self, entity, attribute, old, new, kwargs): if self.app_switch is not None and self.get_state( self.app_switch) != "on": self.log("Switch is not on, skipping update_color.") return if self.trigger == new: do_work = True # TODO: Check if a switch is off to disable if do_work: for entity_on in self.entities_on: if self.get_state(entity_on) == "off": self.turn_on(entity_on) for entity_off in self.entities_off: if self.get_state(entity_off) == "on": self.turn_off(entity_off) for service in self.services: self.call_service(globals.get_arg(service, "service"), title=globals.get_arg(service, "title", allow_empty=True, default_value=""), message=globals.get_arg( service, "message", allow_empty=True, default_value=""))
def initialize(self): self.listen_state_handle_list = [] self.timer_handle_list = [] self.app_switch = globals.get_arg(self.args, "app_switch") self.user_name = globals.get_arg(self.args, "user_name") self.zone = globals.get_arg(self.args, "zone") self.notify_name = globals.get_arg(self.args, "notify_name") self.device = globals.get_arg(self.args, "device") # 'lingering_time' the time a user has to stay in a zone # for this app to trigger self.lingering_time = globals.get_arg(self.args, "lingering_time") self.delay = globals.get_arg(self.args, "delay") self.message = globals.get_arg(self.args, "message") try: self.travel_time_sensor = globals.get_arg(self.args, "travel_time_sensor") except KeyError: self.travel_time_sensor = None try: self.travel_time_sensor_message = globals.get_arg( self.args, "travel_time_sensor_message") except KeyError: self.travel_time_sensor_message = None self.user_entered_zone = None self.false_positive = False self.notifier = self.get_app("Notifier") self.listen_state_handle_list.append( self.listen_state(self.zone_state_change, self.device, attribute="all"))
def initialize(self): self.lead = globals.get_arg(self.args, "lead") self.follow = globals.get_arg(self.args, "follow") self.attributes = globals.get_arg(self.args, "attributes") self.listen_state_handle_list = [] self.listen_state_handle_list.append( self.listen_state(self.lead_change, self.lead))
def initialize(self): self.listen_state_handle_list = [] self.app_switch = globals.get_arg(self.args, "app_switch") self.ishome = globals.get_arg(self.args, "ishome") self.input_booleans = globals.get_arg_list(self.args, "input_booleans") self.message = globals.get_arg(self.args, "message_DE") if self.get_state(self.app_switch) == "on": for input_boolean in self.input_booleans: self.log("{} is {}".format(input_boolean, self.get_state(input_boolean))) self.listen_state_handle_list.append( self.listen_state(self.state_change, input_boolean)) if self.get_state(input_boolean) == "on" and self.get_state( self.ishome) == "off": self.turn_on(self.ishome) self.log("Setting {} to on".format(self.ishome)) if self.get_state(input_boolean) == "off" and self.get_state( self.ishome) == "on": if self.are_others_away(input_boolean): self.turn_off(self.ishome) self.log("Setting {} to off".format(self.ishome)) self.call_service("notify/group_notifications", message=self.message)
def initialize(self): self.listen_state_handle_list = [] self.app_switch = globals.get_arg(self.args, "app_switch") try: self.entities_on = globals.get_arg_list(self.args, "entities_on") except KeyError: self.entities_on = [] try: self.entities_off = globals.get_arg_list(self.args, "entities_off") except KeyError: self.entities_off = [] try: self.after_sundown = globals.get_arg(self.args, "after_sundown") except KeyError: self.after_sundown = None self.trigger_entity = globals.get_arg(self.args, "trigger_entity") self.trigger_state = globals.get_arg(self.args, "trigger_state") self.message = globals.get_arg(self.args, "message_DE") self.message_off = globals.get_arg(self.args, "message_off_DE") self.message_reed = globals.get_arg(self.args, "message_reed_DE") self.message_reed_off = globals.get_arg(self.args, "message_reed_off_DE") self.notify_name = globals.get_arg(self.args, "notify_name") self.use_alexa = globals.get_arg(self.args, "use_alexa") self.notifier = self.get_app('Notifier') self.listen_state_handle_list.append( self.listen_state(self.state_change, self.trigger_entity))
def initialize(self): self.timer_handle_list = [] self.alexa_tts = globals.get_arg(self.args, "alexa_tts") self.alexa_media_player = globals.get_arg_list(self.args, "alexa_media_player") self.app_switch_alexa = globals.get_arg(self.args, "app_switch_alexa") self.last_alexa_notification_time = None
def initialize(self): self.alexa_media_player = globals.get_arg(self.args,"alexa_media_player") self.app_switch_alexa = globals.get_arg(self.args,"app_switch_alexa") self.__NOTIFY__ = "notify/" self.__ALEXA_TTS__ = "media_player/alexa_tts" self.__GROUP_NOTIFICATIONS__ = "group_notifications"
def initialize(self): self.timer_handle = None self.listen_event_handle_list = [] self.listen_state_handle_list = [] self.timer_handle_list = [] self.player = globals.get_arg(self.args, "player") self.master = globals.get_arg(self.args, "master") self.volume = globals.get_arg(self.args, "volume")
def initialize(self): self.listen_state_handle_list = [] self.cube = globals.get_arg(self.args, "cube") self.actions = globals.get_arg(self.args, "actions") self.action_dict = json.loads(str(self.actions)) self.listen_state_handle_list.append( self.listen_state(self.state_change, self.cube) )
def initialize(self): self.listen_state_handle_list = [] self.app_switch = globals.get_arg(self.args, "app_switch") self.location_sensors = globals.get_arg_list(self.args, "location_sensors") self.room = globals.get_arg(self.args, "room") self.not_home = globals.get_arg(self.args, "not_home") self.after = globals.get_arg(self.args, "after") self.delay = globals.get_arg(self.args, "delay")
def initialize(self): self.channel = globals.get_arg(self.args, "channel") self.userSimon = globals.get_arg(self.args, "userA") self.userMegan = globals.get_arg(self.args, "userB") self.userStaci = globals.get_arg(self.args, "userC") self.userDelia = globals.get_arg(self.args, "userD") #set messaging platform self.listen_state(self.mess_flag, "input_select.message_flag")
def initialize(self): self.scp_user = globals.get_arg(self.args, "scp_user") self.scp_api_passw = globals.get_arg(self.args, "scp_api_passw") self.timer = globals.get_arg(self.args, "timer") # self.singles = False # self.singles = globals.get_arg(self.args "enable_singe_sensors") self.server = None url = 'https://www.servercontrolpanel.de:443/WSEndUser?wsdl' self.client = Client(url) self.run_every(self.getvalues, "now", self.timer * 60)
def initialize(self): self.timer_handle_list = [] self.listen_state_handle_list = [] self.device_tracker = globals.get_arg(self.args, "device_tracker") self.notify_name = globals.get_arg(self.args, "notify_name") self.remindMessageSkeleton = globals.get_arg(self.args, "remindMessageSkeleton") self.notifier = self.get_app("Notifier") return
def initialize(self): self.timer_handle_list = [] self.app_switch = globals.get_arg(self.args, "app_switch") self.time = globals.get_arg(self.args, "time") self.counter = globals.get_arg(self.args, "counter") runtime = self.get_next_run_time() self.log("Next reset will be: {}".format(runtime)) self.timer_handle_list.append( self.run_at(self.run_at_callback, runtime))
def initialize(self): self.listen_state_handle_list = [] self.app_switch = globals.get_arg(self.args, "app_switch") self.alexa_entity = globals.get_arg(self.args, "alexa_entity") self.alexa_entity_source = globals.get_arg(self.args, "alexa_entity_source") self.receiver = globals.get_arg(self.args, "receiver") self.receiver_source = globals.get_arg(self.args, "receiver_source") self.listen_state_handle_list.append( self.listen_state(self.state_change, self.alexa_entity))
def initialize(self): self.timer_handle_list = [] self.listen_event_handle_list = [] self.app_switch = globals.get_arg(self.args, "app_switch") self.domain = globals.get_arg(self.args, "domain") self.service = globals.get_arg(self.args, "service") self.entity_ids = globals.get_arg_list(self.args, "entity_id") self.counter = globals.get_arg(self.args, "counter") self.listen_event_handle_list.append( self.listen_event(self.call_service_callback, "call_service"))
def initialize(self): self.listen_state_handle_list = [] self.app_switch = globals.get_arg(self.args, "app_switch") self.location_sensor = globals.get_arg(self.args, "location_sensor") self.room = globals.get_arg(self.args, "room") self.duration = globals.get_arg(self.args, "duration") self.input_boolean = globals.get_arg(self.args, "input_boolean") self.listen_state_handle_list.append( self.listen_state(self.asleep, self.location_sensor, new=self.room, duration=self.duration)) self.listen_state_handle_list.append( self.listen_state(self.awake, self.location_sensor, old=self.room, duration=self.duration))
def initialize(self): self.timer_handle_list = [] self.listen_event_handle_list = [] self.listen_state_handle_list = [] self.notify_name = globals.get_arg(self.args,"notify_name") self.message = globals.get_arg(self.args,"message_DE") self.notifier = self.get_app('Notifier') self.listen_state_handle_list.append(self.listen_state(self.state_change, "persistent_notification.httplogin"))
def initialize(self): self.listen_event_handle_list = [] self.notify_name = globals.get_arg(self.args, "notify_name") self.user_id = globals.get_arg(self.args, "user_id") self.message = globals.get_arg(self.args, "message") try: self.fritzbox_url = globals.get_arg(self.args, "fritzbox_url") except KeyError: self.fritzbox_url = None try: self.fritzbox_user = globals.get_arg(self.args, "fritzbox_user") except KeyError: self.fritzbox_user = None try: self.fritzbox_password = globals.get_arg(self.args, "fritzbox_password") except KeyError: self.fritzbox_password = None try: self.fritzbox_profile_name = globals.get_arg( self.args, "fritzbox_profile_name") except KeyError: self.fritzbox_profile_name = None try: self.fritzbox_message_allow_access = globals.get_arg( self.args, "fritzbox_message_allow_access") except KeyError: self.fritzbox_message_allow_access = None try: self.fritzbox_message_access_allowed = globals.get_arg( self.args, "fritzbox_message_access_allowed") except KeyError: self.fritzbox_message_access_allowed = None try: self.fritzbox_message_access_blocked = globals.get_arg( self.args, "fritzbox_message_access_blocked") except KeyError: self.fritzbox_message_access_blocked = None self.notifier = self.get_app("Notifier") self.listen_event_handle_list.append( self.listen_event(self.newDeviceCallback, "device_tracker_new_device")) self.listen_event_handle_list.append( self.listen_event(self.entityRegistryUpdatedCallback, "entity_registry_updated")) self.listen_event_handle_list.append( self.listen_event(self.receiveTelegramCallback, "telegram_callback"))
def initialize(self): self.notify_name = globals.get_arg(self.args, "notify_name") self.notify_message = globals.get_arg(self.args, "notify_message") self.include_log_message_in_notification = globals.get_arg( self.args, "include_log_message_in_notification") try: self.exclude_apps = globals.get_arg_list(self.args, "exclude_apps") except KeyError: self.exclude_apps = None # App dependencies self.notifier = self.get_app('Notifier') self.listen_log(self.log_message_callback)
def initialize(self): self.timer_handle_list = [] self.listen_state_handle_list = [] self.app_switch = globals.get_arg(self.args, "app_switch") self.climate_entity = globals.get_arg(self.args, "climate_entity") self.target_entity = globals.get_arg(self.args, "target_entity") self.proximity = globals.get_arg(self.args, "proximity") self.min_radius = globals.get_arg(self.args, "min_radius") try: self.message = globals.get_arg(self.args, "message") except KeyError: self.message = None try: self.notify_name = globals.get_arg(self.args, "notify_name") except KeyError: self.notify_name = None try: self.use_alexa = globals.get_arg(self.args, "use_alexa") except KeyError: self.use_alexa = False self.notifier = self.get_app("Notifier") self.listen_state_handle_list.append( self.listen_state(self.state_change, self.proximity, attribute="all") )
def initialize(self): self.timer_handle_list = [] self.listen_state_handle_list = [] self.app_switch = globals.get_arg(self.args, "app_switch") self.trigger_entity = globals.get_arg(self.args, "trigger_entity") self.trigger_state = globals.get_arg(self.args, "trigger_state") self.climate_entity = globals.get_arg(self.args, "climate_entity") self.target_entity = globals.get_arg(self.args, "target_entity") try: self.message = globals.get_arg(self.args, "message") except KeyError: self.message = None try: self.notify_name = globals.get_arg(self.args, "notify_name") except KeyError: self.notify_name = None try: self.use_alexa = globals.get_arg(self.args, "use_alexa") except KeyError: self.use_alexa = False self.notifier = self.get_app('Notifier') self.listen_state_handle_list.append(self.listen_state(self.state_change, self.trigger_entity))
def initialize(self): self.listen_state_handle_list = [] self.timer_handle_list = [] self.sensor = globals.get_arg(self.args, "sensor") self.sensor_realtime = globals.get_arg(self.args, "sensor_realtime") self.destination_name = globals.get_arg(self.args, "destination_name") self.notify_input_boolean = globals.get_arg(self.args, "notify_input_boolean") self.notify_name = globals.get_arg(self.args, "notify_name") self.message = globals.get_arg(self.args, "message") try: self.acceptable_range = globals.get_arg(self.args, "acceptable_range") except KeyError: self.acceptable_range = 1.2 try: self.notify_use_Alexa = globals.get_arg(self.args, "notify_use_Alexa") except KeyError: self.notify_use_Alexa = True self.notifier = self.get_app('Notifier') self.listen_state_handle_list.append( self.listen_state(self.state_change, self.sensor_realtime, attribute="all"))