from ospy import helpers from ospy.webpages import showInFooter # Enable plugin to display readings in UI footer NAME = 'UPS Monitor' MENU = _(u'Package: UPS Monitor') LINK = 'settings_page' ups_options = PluginOptions( NAME, { 'time': 60, # in minutes 'ups': False, 'sendeml': False, 'emlsubject': _(u'Report from OSPy UPS plugin'), 'enable_log': False, 'log_records': 0, # 0 = unlimited 'history': 0, # selector for graph history 'use_footer': True, # show data from plugin in footer on home page 'eplug': 0, # email plugin type (email notifications or email notifications SSL) } ) ################################################################################ # GPIO input pullup and output: # ################################################################################ import RPi.GPIO as GPIO # RPi hardware pin_power_ok = 16 # GPIO23 pin_ups_down = 18 # GPIO24
from blinker import signal NAME = 'Button Control' MENU = _(u'Package: Button Control') LINK = 'settings_page' plugin_options = PluginOptions( NAME, { 'use_button': False, 'button0': u'reboot', 'button1': u'pwrOff', 'button2': u'stopAll', 'button3': u'schedEn', 'button4': u'runP1', 'button5': u'runP2', 'button6': u'runP3', 'button7': u'runP4', 'used_stations': [], # use this stations for stoping scheduler if stations is activated in scheduler 'i2c_addr': 39, # 32 decimal to 37 decimal (is 0x20 to 0x27) 'first_stop': False, # First stop everything running and then start the program. If we want to start a new program and add it to the running ones, we will leave this option off. }) rebooted = signal('rebooted') def report_rebooted(): rebooted.send()
from ospy.log import log from ospy.options import options from ospy.webpages import ProtectedPage from ospy.helpers import determine_platform, get_rpi_revision, datetime_string from ospy.stations import stations from plugins import PluginOptions, plugin_url import i18n NAME = 'Direct 16 Relay Outputs' LINK = 'settings_page' plugin_options = PluginOptions( NAME, { 'enabled': False, # default is OFF 'relays': 1, # default 1 relay 'active': 'high' # default is normal logic }) ################################################################################ # Main function loop: # ################################################################################ class Relay16Checker(Thread): def __init__(self): Thread.__init__(self) self.daemon = True self._stop = Event() self._sleep_time = 0
from ospy.helpers import poweroff from ospy.log import log, logEM from plugins import PluginOptions, plugin_url from ospy.webpages import ProtectedPage from ospy.helpers import datetime_string from ospy.options import options import i18n NAME = 'UPS Monitor' LINK = 'settings_page' ups_options = PluginOptions( NAME, { 'time': 60, # in minutes 'ups': False, 'sendeml': False, 'emlsubject': _('Report from OSPy UPS plugin') }) ################################################################################ # GPIO input pullup and output: # ################################################################################ import RPi.GPIO as GPIO # RPi hardware pin_power_ok = 16 # GPIO23 pin_ups_down = 18 # GPIO24 try: GPIO.setup(pin_power_ok, GPIO.IN, pull_up_down=GPIO.PUD_UP)
plugin_options = PluginOptions( NAME, { 'enabled_a': False, # enable or disable regulation A 'enabled_b': False, # enable or disable regulation B 'enabled_c': False, # enable or disable regulation C 'probe_A_on': 0, # for selector temperature probe A ON (0-5) 'probe_B_on': 0, # for selector temperature probe B ON (0-5) 'probe_C_on': 0, # for selector temperature probe C ON (0-5) 'probe_A_off': 0, # for selector temperature probe A OFF (0-5) 'probe_B_off': 0, # for selector temperature probe B OFF (0-5) 'probe_C_off': 0, # for selector temperature probe C OFF (0-5) 'temp_a_on': 30, # temperature for output A ON 'temp_b_on': 40, # temperature for output B ON 'temp_c_on': 50, # temperature for output C ON 'temp_a_off': 25, # temperature for output A OFF 'temp_b_off': 35, # temperature for output B OFF 'temp_c_off': 45, # temperature for output C OFF 'control_output_A': 0, # selector for output A (0 to station count) 'control_output_B': 1, # selector for output B (0 to station count) 'control_output_C': 2, # selector for output C (0 to station count) 'ds_name_0': '', # name for DS probe 1 from air temp humi plugin 'ds_name_1': '', # name for DS probe 2 from air temp humi plugin 'ds_name_2': '', # name for DS probe 3 from air temp humi plugin 'ds_name_3': '', # name for DS probe 4 from air temp humi plugin 'ds_name_4': '', # name for DS probe 5 from air temp humi plugin 'ds_name_5': '', # name for DS probe 6 from air temp humi plugin 'ds_count': 0, # DS probe count from air temp humi plugin 'reg_mm_a': 60, # min for maximal runtime A 'reg_ss_a': 0, # sec for maximal runtime A 'reg_mm_b': 60, # min for maximal runtime B 'reg_ss_b': 0, # sec for maximal runtime B 'reg_mm_c': 60, # min for maximal runtime C 'reg_ss_c': 0, # sec for maximal runtime C 'use_footer': True # show data from plugin in footer on home page })
from plugins import PluginOptions, plugin_url from ospy.options import options from ospy.stations import stations from ospy.inputs import inputs from ospy.log import log, EVENT_FILE from ospy.helpers import datetime_string, get_input import i18n NAME = 'Remote Notifications' LINK = 'settings_page' remote_options = PluginOptions( NAME, { 'use': False, 'rem_adr': "your web server", 'api': "123456789" } ) ################################################################################ # Main function loop: # ################################################################################ class RemoteSender(Thread): def __init__(self): Thread.__init__(self) self.daemon = True self._stop = Event() self._sleep_time = 0
import i18n NAME = 'Email Notifications' LINK = 'settings_page' email_options = PluginOptions( NAME, { 'emlpwron': False, 'emllog': False, 'emlrain': False, 'emlrun': False, 'emlusr': '', 'emlpwd': '', 'emladr0': '', 'emladr1': '', 'emladr2': '', 'emladr3': '', 'emladr4': '', 'emlsubject': _('Report from OSPy SYSTEM') } ) ################################################################################ # Main function loop: # ################################################################################ class EmailSender(Thread): def __init__(self):
from ospy.programs import programs from ospy.stations import stations from ospy.helpers import datetime_string NAME = 'SMS Modem' MENU = _(u'Package: SMS Modem') LINK = 'settings_page' sms_options = PluginOptions( NAME, { u'tel1': u'+xxxyyyyyyyyy', u'tel2': u'+xxxyyyyyyyyy', u'use_sms': False, u'use_strength': False, u'txt1': u'info', u'txt2': u'stop', u'txt3': u'start', u'txt4': u'restart', u'txt5': u'power', u'txt6': u'update', u'txt7': u'foto', u'txt8': u'help', u'txt9': u'run' }) # Plugin system will catch the following error and disable the plugin automatically: # import gammu # for SMS modem import gammu # if no install modem and gammu visit: http://www.pihrt.com/elektronika/259-moje-rapsberry-pi-sms-ovladani-rpi # USB modem HUAWEI E303 + SIM card with telephone provider ################################################################################ # Main function loop: #
from ospy.webpages import ProtectedPage from plugins import PluginOptions, plugin_url, plugin_data_dir from ospy.log import log, logEM from ospy.helpers import datetime_string from ospy.webpages import showInFooter # Enable plugin to display readings in UI footer NAME = 'Door Opening' MENU = _(u'Package: Door Opening') LINK = 'start_page' plugin_options = PluginOptions( NAME, { 'open_time': 2, 'open_output': 0, 'use_footer': False } ) class PluginSender(Thread): def __init__(self): Thread.__init__(self) self.daemon = True self._sleep_time = 0 self.start() def update(self): self._sleep_time = 0