def GET(self): global must_stop qdict = web.input() if checker is not None: stop = helpers.get_input(qdict, 'stop', False, lambda x: True) clear = helpers.get_input(qdict, 'clear', False, lambda x: True) if 'test' in qdict: command = -1 data = {} if 'state' in qdict and int(qdict['state']) == 1: command = plugin_options['on'][int(qdict['test'])] if 'state' in qdict and int(qdict['state']) == 0: command = plugin_options['off'][int(qdict['test'])] if len(plugin_options['sounds']) > 0 and command != -1: data['song'] = plugin_options['sounds'][command] path = os.path.join(plugin_data_dir(), data['song']) if os.path.isfile(path): log.info( NAME, datetime_string() + u': ' + _(u'Button test, song {}.').format(data['song'])) update_song_queue(data) # save song name to song queue else: log.info( NAME, datetime_string() + u': ' + _(u'File not exists!')) else: log.info( NAME, datetime_string() + u': ' + _(u'File not exists!')) if stop: must_stop = True log.info(NAME, datetime_string() + u': ' + _(u'Button Stop.')) if clear: must_stop = True song_queue = read_song_queue() while len(song_queue) > 0: song_queue = read_song_queue() del song_queue[0] write_song_queue(song_queue) log.clear(NAME) log.info( NAME, datetime_string() + u': ' + _(u'Button clear playlist.')) try: return self.plugin_render.voice_station(plugin_options, log.events(NAME)) except Exception: log.error( NAME, _(u'Voice Station plug-in') + ':\n' + traceback.format_exc()) set_to_default() return self.plugin_render.voice_station(plugin_options, log.events(NAME))
def GET(self): global wind_sender qdict = web.input() reset = helpers.get_input(qdict, 'reset', False, lambda x: True) delete = helpers.get_input(qdict, 'delete', False, lambda x: True) show = helpers.get_input(qdict, 'show', False, lambda x: True) if wind_sender is not None and reset: wind_sender.status['max_meter'] = 0 wind_sender.status['log_date_maxspeed'] = datetime_string() log.clear(NAME) log.info( NAME, datetime_string() + ' ' + _(u'Maximal speed has reseted.')) raise web.seeother(plugin_url(settings_page), True) if wind_sender is not None and delete: write_log([]) create_default_graph() log.info(NAME, datetime_string() + ' ' + _(u'Deleted all log files OK')) raise web.seeother(plugin_url(settings_page), True) if wind_sender is not None and 'history' in qdict: history = qdict['history'] wind_options.__setitem__('history', int(history)) if wind_sender is not None and show: raise web.seeother(plugin_url(log_page), True) return self.plugin_render.wind_monitor(wind_options, wind_sender.status, log.events(NAME))
def GET(self): global sender qdict = web.input() delete = helpers.get_input(qdict, 'delete', False, lambda x: True) show = helpers.get_input(qdict, 'show', False, lambda x: True) state = helpers.get_input(qdict, 'state', False, lambda x: True) if sender is not None and 'test' in qdict: test = qdict['test'] if state: log.clear(NAME) log.info(NAME, _(u'Test CMD: {} ON.').format(int(test) + 1)) command = plugin_options['on'] data = command[int(test)] if data: run_command(data) else: log.clear(NAME) log.info(NAME, _(u'Test CMD: {} OFF.').format(int(test) + 1)) command = plugin_options['off'] data = command[int(test)] if data: run_command(data) if sender is not None and delete: write_log([]) log.info(NAME, _(u'Deleted all log files OK')) raise web.seeother(plugin_url(settings_page), True) if sender is not None and show: raise web.seeother(plugin_url(log_page), True) return self.plugin_render.cli_control(plugin_options, log.events(NAME))
def GET(self): global sender if sender is not None: sender.update() return self.plugin_render.pool_heating(plugin_options, log.events(NAME), sender.status)
def GET(self): global sender qdict = web.input() stop = helpers.get_input(qdict, 'stop', False, lambda x: True) if sender is not None and stop: sender.stop() sender.join(5) sender = None raise web.seeother(plugin_url(start_page), True) return self.plugin_render.pulse(pulse_options, log.events(NAME))
def GET(self): global lcd_sender qdict = web.input() refind = helpers.get_input(qdict, 'refind', False, lambda x: True) if lcd_sender is not None and refind: lcd_options['address'] = 0 log.clear(NAME) log.info(NAME, _('I2C address has re-finded.')) find_lcd_address() raise web.seeother(plugin_url(settings_page), True) return self.plugin_render.lcd_display(lcd_options, log.events(NAME))
def GET(self): global sender, status qdict = web.input() reset = helpers.get_input(qdict, 'reset', False, lambda x: True) if sender is not None and reset: plugin_options.__setitem__('sum_one', 0) plugin_options.__setitem__('sum_two', 0) plugin_options.__setitem__('last_reset', datetime_string()) log.clear(NAME) log.info(NAME, datetime_string() + ': ' + _(u'Counter has reseted')) raise web.seeother(plugin_url(settings_page), True) return self.plugin_render.water_consumption_counter(plugin_options, log.events(NAME))
def GET(self): global sender qdict = web.input() delete = helpers.get_input(qdict, 'delete', False, lambda x: True) show = helpers.get_input(qdict, 'show', False, lambda x: True) test = helpers.get_input(qdict, 'test', False, lambda x: True) if sender is not None and delete: write_log([]) create_default_graph() raise web.seeother(plugin_url(settings_page), True) if sender is not None and test: log.clear(NAME) try: new_speeds = get_new_speeds() sender._sleep(2) tempText = _( 'Ping {} ms, Download {} Mb/s, Upload {} Mb/s').format( sender.status['ping'], sender.status['down'], sender.status['up']) except: new_speeds = 0, 0, 0 tempText = _('Cannot be loaded') log.error( NAME, _('Speed Monitor plug-in') + ':\n' + traceback.format_exc()) pass sender.status['ping'] = new_speeds[0] # Ping (ms) sender.status['down'] = new_speeds[1] # Download (Mb/s) sender.status['up'] = new_speeds[2] # Upload (Mb/s) log.info( NAME, datetime_string() + ' ' + _('Test button') + '\n' + tempText) raise web.seeother(plugin_url(settings_page), True) if sender is not None and 'history' in qdict: history = qdict['history'] speed_options.__setitem__('history', int(history)) if sender is not None and show: raise web.seeother(plugin_url(log_page), True) return self.plugin_render.speed_monitor(speed_options, log.events(NAME))
def GET(self): global sender, status, avg_lst, avg_cnt, avg_rdy qdict = web.input() reset = helpers.get_input(qdict, 'reset', False, lambda x: True) show = helpers.get_input(qdict, 'show', False, lambda x: True) debug = helpers.get_input(qdict, 'debug', False, lambda x: True) del_rain = helpers.get_input(qdict, 'del_rain', False, lambda x: True) log_now = helpers.get_input(qdict, 'log_now', False, lambda x: True) if sender is not None and reset: status['minlevel'] = status['level'] status['maxlevel'] = status['level'] tank_options['saved_max'] = status['level'] tank_options['saved_min'] = status['level'] status['minlevel_datetime'] = datetime_string() status['maxlevel_datetime'] = datetime_string() log.info( NAME, datetime_string() + ': ' + _(u'Minimum and maximum has reseted.')) raise web.seeother(plugin_url(settings_page), True) if sender is not None and log_now: update_log() if sender is not None and 'history' in qdict: history = qdict['history'] tank_options.__setitem__('history', int(history)) if sender is not None and show: raise web.seeother(plugin_url(log_page), True) if sender is not None and debug: raise web.seeother(plugin_url(log_debug_page), True) if sender is not None and del_rain: if NAME in rain_blocks: del rain_blocks[NAME] log.info( NAME, datetime_string() + ': ' + _(u'Removing Rain Delay') + '.') raise web.seeother(plugin_url(settings_page), True) return self.plugin_render.tank_monitor(tank_options, log.events(NAME))
def GET(self): global ups_sender qdict = web.input() delete = helpers.get_input(qdict, 'delete', False, lambda x: True) show = helpers.get_input(qdict, 'show', False, lambda x: True) if ups_sender is not None and delete: write_log([]) create_default_graph() raise web.seeother(plugin_url(settings_page), True) if ups_sender is not None and 'history' in qdict: history = qdict['history'] ups_options.__setitem__('history', int(history)) if ups_sender is not None and show: raise web.seeother(plugin_url(log_page), True) return self.plugin_render.ups_adj(ups_options, ups_sender.status, log.events(NAME))
def GET(self): global water_sender qdict = web.input() reset = helpers.get_input(qdict, 'reset', False, lambda x: True) if water_sender is not None and reset: if options['enabled']: qdict['enabled'] = u'on' if options['address']: qdict['address'] = u'on' qdict['sum'] = 0 qdict['log_date_last_reset'] = datetime_string() options.web_update(qdict) log.clear(NAME) log.info(NAME, str(options['log_date_last_reset']) + ' ' + _(u'Water summary was reseting...')) log.info(NAME, _(u'Please wait for minutes/hours data...')) raise web.seeother(plugin_url(settings_page), True) return self.plugin_render.water_meter(options, log.events(NAME))
def GET(self): global sender qdict = web.input() delete = helpers.get_input(qdict, 'delete', False, lambda x: True) show = helpers.get_input(qdict, 'show', False, lambda x: True) if sender is not None and delete: write_log([]) create_default_graph() log.info(NAME, _(u'Deleted all log files OK')) raise web.seeother(plugin_url(settings_page), True) if sender is not None and 'history' in qdict: history = qdict['history'] plugin_options.__setitem__( 'history', int(history)) #__setitem__(self, key, value) if sender is not None and show: raise web.seeother(plugin_url(log_page), True) return self.plugin_render.air_temp_humi(plugin_options, log.events(NAME))
def GET(self): return self.plugin_render.volt_temp_da(pcf_options, pcf_sender.status, log.events(NAME))
def GET(self): return self.plugin_render.remote_ftp_control(plugin_options, log.events(NAME))
def GET(self): return self.plugin_render.mqtt_zones(plugin_options, log.events(NAME))
def GET(self): return self.plugin_render.tank_humi_monitor(tank_options, log.events(NAME))
def GET(self): get_run_cam() return self.plugin_render.webcam(cam_options, log.events(NAME))
def GET(self): return self.plugin_render.real_time(plugin_options, log.events(NAME))
def GET(self): return self.plugin_render.telegram_bot(plugin_options, log.events(NAME))
def GET(self): return self.plugin_render.button_control(plugin_options, log.events(NAME))
def GET(self): return self.plugin_render.remote_notifications(remote_options, log.events(NAME))
def GET(self): checker.started.wait(10) # Make sure we are initialized return self.plugin_render.system_update(plugin_options, log.events(NAME), checker.status)
def GET(self): return self.plugin_render.email_notifications(email_options, log.events(NAME))
def GET(self): return self.plugin_render.mqtt_runonce(plugin_options, log.events(NAME), options.name)
def GET(self): return self.plugin_render.pressurizer(plugin_options, log.events(NAME))
def GET(self): return self.plugin_render.lcd_display(lcd_options, log.events(NAME))
def GET(self): checker.started.wait(4) # Make sure we are initialized return self.plugin_render.sunrise_and_sunset(plugin_options, log.events(NAME), checker.status, city_table)
def GET(self): return self.plugin_render.signaling_examples(plugin_options, log.events(NAME))
def GET(self): return self.plugin_render.weather_based_rain_delay( plugin_options, log.events(NAME))
def GET(self): return self.plugin_render.relay_16(plugin_options, log.events(NAME))