def __init__(self, load_from_file=True):
        weather_underground_config = file_locations.weather_underground_config
        CreateGeneralConfiguration.__init__(self,
                                            weather_underground_config,
                                            load_from_file=load_from_file)
        self.config_file_header = "Enable = 1 & Disable = 0"
        self.valid_setting_count = 5
        self.config_settings_names = [
            "Enable Weather Underground", "Send to Server in Seconds",
            "Sensor is Outdoors", "Weather Underground Station ID",
            "Weather Underground Station Key"
        ]

        self.weather_underground_enabled = 0
        self.interval_seconds = 900.0
        self.outdoor_sensor = 1
        self.station_id = "NA"
        self.station_key = "NA"

        # Weather Underground URL Variables
        self.wu_main_url_start = "https://weatherstation.wunderground.com/weatherstation/updateweatherstation.php?"
        self.wu_rapid_fire_url_start = "https://rtupdate.wunderground.com/weatherstation/updateweatherstation.php?"
        self.wu_rapid_fire_url_end = "&realtime=1&rtfreq="

        self.wu_id = "ID="
        self.wu_key = "&PASSWORD="******"&dateutc=now"
        self.wu_software_version = "&softwaretype=Kootnet%20Sensors%20"
        self.wu_action = "&action=updateraw"

        self.update_configuration_settings_list()
        if load_from_file:
            self._init_config_variables()
            self._update_variables_from_settings_list()
    def __init__(self, load_from_file=True):
        CreateGeneralConfiguration.__init__(self,
                                            file_locations.luftdaten_config,
                                            load_from_file=load_from_file)
        self.config_file_header = "Enable = 1 & Disable = 0"
        self.valid_setting_count = 2
        self.config_settings_names = [
            "Enable Luftdaten", "Send to server every (Seconds)"
        ]

        self.luftdaten_url = "https://api.sensor.community/v1/push-sensor-data/"

        self.return_software_version = "Kootnet Sensors "

        self.luftdaten_enabled = 0
        self.interval_seconds = 180
        self.station_id = self._get_cpu_serial()

        self.update_configuration_settings_list()
        if load_from_file:
            sw_version_text_list = software_version.version.split(".")
            sw_version_text = str(sw_version_text_list[0]) + "." + str(
                sw_version_text_list[1])
            self.return_software_version += sw_version_text
            self._init_config_variables()
            self._update_variables_from_settings_list()
    def __init__(self, load_from_file=True):
        CreateGeneralConfiguration.__init__(
            self,
            file_locations.mqtt_subscriber_config,
            load_from_file=load_from_file)
        self.config_file_header = "Configure MQTT Subscriber Settings here. Enable = 1 & Disable = 0"
        self.valid_setting_count = 10
        self.config_settings_names = [
            "Enable MQTT Subscriber", "Broker Server Address", "Broker Port #",
            "Enable Authentication", "User Name (Optional)",
            "Password (Optional)", "MQTT Quality of Service Level (0-2)",
            "Topics as CSV Eg. KS/Sensor32/EnvironmentTemperature,KS/Sensor12/#",
            "Enable MQTT write to SQL DB",
            "Maximum Sensor posts to show on the main MQTT Subscriber page"
        ]

        self.enable_mqtt_subscriber = 0
        self.enable_mqtt_sql_recording = 0

        self.broker_address = ""
        self.broker_server_port = 1883
        self.enable_broker_auth = 0
        self.broker_user = ""
        self.broker_password = ""
        self.subscribed_topics_list = ["#"]

        self.mqtt_subscriber_qos = 0

        self.mqtt_page_view_max_entries = 15

        self.update_configuration_settings_list()
        if load_from_file:
            self._init_config_variables()
            self._update_variables_from_settings_list()
    def __init__(self, load_from_file=True):
        CreateGeneralConfiguration.__init__(self,
                                            file_locations.osm_config,
                                            load_from_file=load_from_file)
        self.config_file_header = "Enable = 1 & Disable = 0"
        self.valid_setting_count = 25
        self.config_settings_names = [
            "Enable Open Sense Map", "SenseBox ID",
            "Send to Server in Seconds", "Temperature Sensor ID",
            "Pressure Sensor ID", "Altitude Sensor ID", "Humidity Sensor ID",
            "Gas VOC Sensor ID", "Gas NH3 Sensor ID", "Gas Oxidised Sensor ID",
            "Gas Reduced Sensor ID", "PM 1.0 Sensor ID", "PM 2.5 Sensor ID",
            "PM 4 Sensor ID", "PM 10 Sensor ID", "Lumen Sensor ID",
            "Red Sensor ID", "Orange Sensor ID", "Yellow Sensor ID",
            "Green Sensor ID", "Blue Sensor ID", "Violet Sensor ID",
            "Ultra Violet Index Sensor ID", "Ultra Violet A Sensor ID",
            "Ultra Violet B Sensor ID"
        ]

        self.open_sense_map_main_url_start = "https://api.opensensemap.org/boxes"
        self.open_sense_map_login_url = "https://api.opensensemap.org/users/sign-in"

        self.open_sense_map_enabled = 0
        self.sense_box_id = ""
        self.interval_seconds = 900.0

        self.temperature_id = ""
        self.pressure_id = ""
        self.altitude_id = ""
        self.humidity_id = ""
        self.gas_voc_id = ""
        self.gas_oxidised_id = ""
        self.gas_reduced_id = ""
        self.gas_nh3_id = ""
        self.pm1_id = ""
        self.pm2_5_id = ""
        self.pm4_id = ""
        self.pm10_id = ""

        self.lumen_id = ""
        self.red_id = ""
        self.orange_id = ""
        self.yellow_id = ""
        self.green_id = ""
        self.blue_id = ""
        self.violet_id = ""

        self.ultra_violet_index_id = ""
        self.ultra_violet_a_id = ""
        self.ultra_violet_b_id = ""

        self.update_configuration_settings_list()
        if load_from_file:
            self._init_config_variables()
            self._update_variables_from_settings_list()
    def __init__(self, load_from_file=True):
        CreateGeneralConfiguration.__init__(
            self,
            file_locations.checkin_configuration,
            load_from_file=load_from_file)
        self.config_file_header = "Enable = 1 and Disable = 0"
        self.valid_setting_count = 16
        self.config_settings_names = [
            "Enable Check-Ins Server",
            "Count Sensors Checked-In the past X Days",
            "Delete sensors with checkin older then X Days",
            "Send Sensor Name with Checkins", "Send IP with Checkins",
            "Send Program Version with Checkins",
            "Send Installed Sensors with Checkins",
            "Send System Uptime with Checkins",
            "Send System Temperature with Checkins", "Max Logs Lines to send",
            "Send Primary Logs with Checkins",
            "Send Network Logs with Checkins",
            "Send Sensors Logs with Checkins", "Enable Sensor Checkins",
            "Hours between Sensor Checkins",
            "Maximum Sensors shown in Sensor Checkins"
        ]

        self.enable_checkin_recording = 0

        # This setting is no longer used as of Beta.35.16
        self.main_page_max_sensors = 15

        self.count_contact_days = 7.0
        self.delete_sensors_older_days = 365.0

        # These settings are used when sending a sensor checkin to a server.
        self.enable_checkin = 1
        self.checkin_wait_in_hours = 24

        self.send_sensor_name = 0
        self.send_ip = 0
        self.send_program_version = 1
        self.send_installed_sensors = 1
        self.send_system_uptime = 1
        self.send_system_temperature = 1
        self.max_log_lines_to_send = 40
        self.send_primary_log = 1
        self.send_network_log = 0
        self.send_sensors_log = 1

        self.update_configuration_settings_list()
        if load_from_file:
            self._init_config_variables()
            self._update_variables_from_settings_list()
    def __init__(self, load_from_file=True):
        CreateGeneralConfiguration.__init__(self,
                                            file_locations.mqtt_broker_config,
                                            load_from_file=load_from_file)
        self.config_file_header = "Configure MQTT Broker Server settings here. Enable = 1 & Disable = 0"
        self.valid_setting_count = 1
        self.config_settings_names = ["Enable MQTT Broker"]

        self.enable_mqtt_broker = 0

        self.update_configuration_settings_list()
        if load_from_file:
            self._init_config_variables()
            self._update_variables_from_settings_list()
Beispiel #7
0
    def __init__(self, load_from_file=True):
        CreateGeneralConfiguration.__init__(self,
                                            file_locations.live_graphs_config,
                                            load_from_file=load_from_file)
        self.config_file_header = "Live Graphs Configuration. Enable = 1 and Disable = 0"
        self.valid_setting_count = 22
        self.config_settings_names = [
            "Sensor Address", "Graph Update Interval in seconds",
            "Enable Uptime", "Enable CPU Temperature",
            "Enable Environmental Temperature", "Enable Pressure",
            "Enable Altitude", "Enable Humidity", "Enable Dew Point",
            "Enable Distance", "Enable GAS", "Enable Particulate Matter",
            "Enable Lumen", "Enable Colours", "Enable Ultra Violet",
            "Enable Accelerometer", "Enable Magnetometer", "Enable Gyroscope",
            "Graphs Per Row - Enter 12 for 1 sensor per row, 6 for 2, 4 for 3 and 3 for 4",
            "Enable SSL Verification", "Max Data Points per Graph",
            "Enable Performance Mode (Renders graphs faster)"
        ]

        self.graph_sensor_address = None
        self.live_graph_update_interval = 5
        self.graphs_per_row = "6"
        self.max_graph_data_points = 720  # 1 hour long graphs, assuming 5 seconds for the update interval
        self.enable_ssl_verification = 1
        self.enable_performance_mode = 1

        self.live_graph_uptime = 1
        self.live_graph_cpu_temp = 1
        self.live_graph_env_temp = 1
        self.live_graph_pressure = 1
        self.live_graph_altitude = 1
        self.live_graph_humidity = 1
        self.live_graph_dew_point = 1
        self.live_graph_distance = 1
        self.live_graph_gas = 1
        self.live_graph_particulate_matter = 1
        self.live_graph_lumen = 1
        self.live_graph_colours = 1
        self.live_graph_ultra_violet = 1
        self.live_graph_acc = 1
        self.live_graph_mag = 1
        self.live_graph_gyro = 1

        self.update_configuration_settings_list()
        if load_from_file:
            self._init_config_variables()
            self._update_variables_from_settings_list()
Beispiel #8
0
    def __init__(self, load_from_file=True):
        CreateGeneralConfiguration.__init__(self,
                                            file_locations.email_config,
                                            load_from_file=load_from_file)
        self.config_file_header = "Enable = 1 and Disable = 0"
        self.valid_setting_count = 15
        self.config_settings_names = [
            "SMTP send from email address", "SMTP server address",
            "Enable SMTP SSL", "SMTP server port #", "SMTP user name",
            "SMTP password", "Enable Reports email server",
            "Send Report every (daily, weekly, monthly, yearly)",
            "Send Report to CSV emails", "Enable Graph email server",
            "Sending Graph every (daily, weekly, monthly, yearly)",
            "Send Graph to CSV emails", "Email Report at time of day",
            "Email Graph at time of day", "Enable SMTP TLS"
        ]

        # If set to 1+, emails are sent on program start for Graphs and Reports (They must be enabled)
        self.send_on_start = 0

        self.server_sending_email = ""
        self.server_smtp_address = ""
        self.server_smtp_ssl_enabled = 0
        self.server_smtp_tls_enabled = 0
        self.server_smtp_port = 25
        self.server_smtp_user = ""
        self.server_smtp_password = ""

        self.send_option_daily = "daily"
        self.send_option_weekly = "weekly"
        self.send_option_monthly = "monthly"
        self.send_option_yearly = "yearly"

        self.enable_combo_report_emails = 0
        self.send_report_every = self.send_option_monthly
        self.email_reports_time_of_day = "07:00"
        self.send_report_to_csv_emails = ""

        self.enable_graph_emails = 0
        self.send_graph_every = self.send_option_monthly
        self.email_graph_time_of_day = "07:00"
        self.send_graphs_to_csv_emails = ""

        self.update_configuration_settings_list()
        if load_from_file:
            self._init_config_variables()
            self._update_variables_from_settings_list()
Beispiel #9
0
    def __init__(self, load_from_file=True):
        CreateGeneralConfiguration.__init__(self,
                                            file_locations.display_config,
                                            load_from_file=load_from_file)
        self.config_file_header = "Enable = 1 and Disable = 0"
        self.valid_setting_count = 19
        self.config_settings_names = [
            "Enable display", "Display every minutes", "Display type",
            "Show sensor uptime", "Show system temperature",
            "Show environmental temperature", "Show pressure", "Show altitude",
            "Show humidity", "Show distance", "Show GAS",
            "Show particulate matter", "Show lumen", "Show colors",
            "Show ultra violet", "Show accelerometer", "Show magnetometer",
            "Show gyroscope", "Dew Point"
        ]

        self.enable_display = 0
        self.display_type_numerical = "numerical"
        self.display_type_graph = "graph"

        self.minutes_between_display = 60
        self.display_type = self.display_type_numerical

        # Enable or Disable Sensors to Display.  0 = Disabled, 1 = Enabled
        self.sensor_uptime = 0
        self.system_temperature = 1
        self.env_temperature = 0
        self.pressure = 0
        self.altitude = 0
        self.humidity = 0
        self.dew_point = 0
        self.distance = 0
        self.gas = 0
        self.particulate_matter = 0
        self.lumen = 0
        self.color = 0
        self.ultra_violet = 0
        self.accelerometer = 0
        self.magnetometer = 0
        self.gyroscope = 0

        self.update_configuration_settings_list()
        if load_from_file:
            self._init_config_variables()
            self._update_variables_from_settings_list()
Beispiel #10
0
    def __init__(self, load_from_file=True):
        CreateGeneralConfiguration.__init__(self,
                                            file_locations.urls_configuration,
                                            load_from_file=load_from_file)
        self.config_file_header = "Enable = 1 and Disable = 0"
        self.valid_setting_count = 3
        self.config_settings_names = [
            "HTTP Update Server URL", "Checkin Server", "SMB Update Server URL"
        ]

        self.url_update_server = "https://kootenay-networks.com/installers/"
        self.url_checkin_server = "server.dragonwarz.net"
        self.url_update_server_smb = "//smbServer21/installers/"

        self.update_configuration_settings_list()
        if load_from_file:
            self._init_config_variables()
            self._update_variables_from_settings_list()
    def __init__(self, load_from_file=True):
        CreateGeneralConfiguration.__init__(self,
                                            file_locations.upgrades_config,
                                            load_from_file=load_from_file)
        self.config_file_header = "This contains server addresses used in Checkins & Upgrades"
        self.valid_setting_count = 9
        self.config_settings_names = [
            "Enable Automatic Upgrades",
            "Delay in Hours between Automatic Upgrade Checks", "SMB Username",
            "SMB Password", "Selected Upgrade Type",
            "Enable Automatic Feature version upgrades",
            "Enable Automatic Minor version upgrades",
            "Enable Automatic Developmental version upgrades",
            "Enable MD5 Validation"
        ]
        # Location is hardcoded into kootnet_sensors_upgrade.py in upgrade scripts folder
        self.update_script_config_location = file_locations.upgrade_scripts_folder + "/upgrade_options.conf"

        self.upgrade_filename_md5 = "KootnetSensors-deb-MD5.txt"
        self.upgrade_filename_version = "kootnet_version.txt"
        self.upgrade_filename_full_installer = "KootnetSensors.deb"
        self.upgrade_filename_update_installer = "KootnetSensors_online.deb"

        self.upgrade_type_http = "http"
        self.upgrade_type_smb = "smb"

        self.enable_automatic_upgrades = 1
        self.automatic_upgrade_delay_hours = 6
        self.smb_user = "******"
        self.smb_password = "******"

        self.selected_upgrade_type = self.upgrade_type_http
        self.enable_automatic_upgrades_feature = 0
        self.enable_automatic_upgrades_minor = 1
        self.enable_automatic_upgrades_developmental = 0
        self.md5_validation_enabled = 1
        self.verify_ssl = 1

        self.update_configuration_settings_list()
        if load_from_file:
            self._init_config_variables()
            self._update_variables_from_settings_list()
Beispiel #12
0
    def __init__(self, load_from_file=True):
        CreateGeneralConfiguration.__init__(
            self,
            file_locations.sensor_offsets_config,
            load_from_file=load_from_file)
        self.config_file_header = "Enable = 1 and Disable = 0"
        self.valid_setting_count = 4
        self.config_settings_names = [
            "Enable Temperature Offset", "Temperature Offset",
            "Enable Temperature Correction Factor",
            "Temperature Correction Factor"
        ]

        self.enable_temp_offset = 0
        self.temperature_offset = 0.0
        self.enable_temperature_comp_factor = 0
        self.temperature_comp_factor = 0.0

        self.update_configuration_settings_list()
        if load_from_file:
            self._init_config_variables()
            self._update_variables_from_settings_list()
    def __init__(self, load_from_file=True):
        CreateGeneralConfiguration.__init__(self, file_locations.interval_config, load_from_file=load_from_file)
        self.config_file_header = "Enable = 1 and Disable = 0"
        self.valid_setting_count = 19
        self.config_settings_names = [
            "Enable interval recording", "Recording interval in seconds * Caution *", "Enable sensor uptime",
            "Enable CPU temperature", "Enable environmental temperature", "Enable pressure", "Enable humidity",
            "Enable altitude", "Enable distance", "Enable lumen", "Enable color", "Enable ultra violet", "Enable GAS",
            "Enable particulate matter", "Enable accelerometer", "Enable magnetometer", "Enable gyroscope",
            "Enable Dew Point", "Enable GPS"
        ]

        self.enable_interval_recording = 1
        self.sleep_duration_interval = 300.0

        self.enable_interval_recording = 1
        self.sensor_uptime_enabled = 1
        self.cpu_temperature_enabled = 1
        self.env_temperature_enabled = 1
        self.pressure_enabled = 1
        self.humidity_enabled = 1
        self.dew_point_enabled = 1
        self.altitude_enabled = 1
        self.distance_enabled = 1
        self.lumen_enabled = 1
        self.colour_enabled = 1
        self.ultra_violet_enabled = 1
        self.gas_enabled = 1
        self.particulate_matter_enabled = 1
        self.accelerometer_enabled = 1
        self.magnetometer_enabled = 1
        self.gyroscope_enabled = 1

        self.gps_enabled = 1

        self.update_configuration_settings_list()
        if load_from_file:
            self._init_config_variables()
            self._update_variables_from_settings_list()
Beispiel #14
0
    def __init__(self, load_from_file=True):
        CreateGeneralConfiguration.__init__(self,
                                            file_locations.primary_config,
                                            load_from_file=load_from_file)
        self.config_file_header = "Enable = 1 and Disable = 0"
        self.valid_setting_count = 3
        self.config_settings_names = [
            "HTTPS port number (Default is 10065)", "Enable debug logging",
            "DateTime offset in hours (Program uses UTC 0)"
        ]

        self.demo_mode = False
        self.sensor_id = app_cached_variables.tmp_sensor_id
        self.flask_http_ip = ""
        self.web_portal_port_changed = 0

        self.enable_debug_logging = 0
        self.utc0_hour_offset = 0.0
        self.web_portal_port = 10065

        self.update_configuration_settings_list()
        if load_from_file:
            self._init_config_variables()
            self._update_variables_from_settings_list()
    def __init__(self, load_from_file=True):
        installed_sensors_config = file_locations.installed_sensors_config
        CreateGeneralConfiguration.__init__(self,
                                            installed_sensors_config,
                                            load_from_file=load_from_file)
        self.config_file_header = "Enable = 1 and Disable = 0"
        self.valid_setting_count = 29
        w1_therm_sensor = "W1ThermSensor - Maxim/Dallas DS18S20 / DS1822 / DS18B20 / DS28EA00 / DS1825/MAX31850K"
        self.config_settings_names = [
            "Kootnet Dummy Sensors", "Gnu/Linux", "Raspberry Pi",
            "Raspberry Pi Sense HAT", "Pimoroni BH1745", "Pimoroni AS7262",
            "Pimoroni MCP9600", "Pimoroni BMP280", "Pimoroni BME680",
            "Pimoroni Enviro pHAT (No Display)", "Pimoroni Enviro+",
            "Pimoroni SGP30", "Pimoroni PMS5003", "Pimoroni MSA301",
            "Pimoroni LSM303D", "Pimoroni ICM20948", "Pimoroni VL53L1X",
            "Pimoroni LTR-559", "Pimoroni VEML6075",
            "Pimoroni 11x7 LED Matrix",
            "Pimoroni 10.96 SPI Colour LCD (160x80)",
            "Pimoroni 1.12 Mono OLED (128x128, white/black)",
            "Sensirion SPS30", w1_therm_sensor, "Pimoroni Enviro with Display",
            "Pimoroni BME280", "Pimoroni MICS6814", "Pimoroni RV3028",
            "PA1010D GPS"
        ]

        self.kootnet_dummy_sensor = 0

        self.linux_system = 1
        self.raspberry_pi = 0

        self.raspberry_pi_sense_hat = 0
        self.pimoroni_bh1745 = 0
        self.pimoroni_as7262 = 0
        self.pimoroni_mcp9600 = 0
        self.pimoroni_bmp280 = 0
        self.pimoroni_bme280 = 0
        self.pimoroni_bme680 = 0
        self.pimoroni_enviro = 0
        self.pimoroni_enviro2 = 0
        self.pimoroni_enviroplus = 0
        self.pimoroni_sgp30 = 0
        self.pimoroni_pms5003 = 0
        self.pimoroni_msa301 = 0
        self.pimoroni_lsm303d = 0
        self.pimoroni_icm20948 = 0
        self.pimoroni_vl53l1x = 0
        self.pimoroni_ltr_559 = 0
        self.pimoroni_veml6075 = 0
        self.pimoroni_mics6814 = 0

        self.pimoroni_matrix_11x7 = 0
        self.pimoroni_st7735 = 0
        self.pimoroni_mono_oled_luma = 0

        self.pimoroni_rv3028 = 0
        self.pimoroni_pa1010d = 0

        self.sensirion_sps30 = 0

        self.w1_therm_sensor = 0

        self.check_for_raspberry_pi()
        self.update_configuration_settings_list()
        if load_from_file:
            self._init_config_variables()
            self._update_variables_from_settings_list()
Beispiel #16
0
    def __init__(self, load_from_file=True):
        trigger_variances_config = file_locations.trigger_variances_config
        CreateGeneralConfiguration.__init__(self,
                                            trigger_variances_config,
                                            load_from_file=load_from_file)
        self.config_file_header = "0 = Disabled and 1 = Enabled"
        self.valid_setting_count = 61
        self.config_settings_names = [
            "Enable Trigger Variances", "Enable CPU Temperature",
            "CPU Temperature variance",
            "Seconds between CPU Temperature readings",
            "Enable Environmental Temperature",
            "Environmental Temperature variance",
            "Seconds between Env Temperature readings", "Enable Pressure",
            "Pressure variance", "Seconds between Pressure readings",
            "Enable Altitude", "Altitude variance",
            "Seconds between Altitude readings", "Enable Humidity",
            "Humidity variance", "Seconds between Humidity readings",
            "Enable Distance", "Distance variance",
            "Seconds between Distance readings", "Enable Gas",
            "Gas Resistance Index variance", "Gas Oxidising variance",
            "Gas Reducing variance", "Gas NH3 variance",
            "Seconds between Gas readings", "Enable Particulate Matter (PM)",
            "Particulate Matter 1 (PM1) variance",
            "Particulate Matter 2.5 (PM2.5) variance",
            "Particulate Matter 10 (PM10) variance",
            "Seconds between PM readings", "Enable Lumen", "Lumen variance",
            "Seconds between Lumen readings", "Enable Colour", "Red variance",
            "Orange variance", "Yellow variance", "Green variance",
            "Blue variance", "Violet variance",
            "Seconds between Colour readings", "Enable Ultra Violet",
            "Ultra Violet Index variance", "Ultra Violet A variance",
            "Ultra Violet B variance", "Seconds between Ultra Violet readings",
            "Enable Accelerometer", "Accelerometer X variance",
            "Accelerometer Y variance", "Accelerometer Z variance",
            "Seconds between Accelerometer readings", "Enable Magnetometer",
            "Magnetometer X variance", "Magnetometer Y variance",
            "Magnetometer Z variance", "Seconds between Magnetometer readings",
            "Enable Gyroscope", "Gyroscope X variance", "Gyroscope Y variance",
            "Gyroscope Z variance", "Seconds between Gyroscope readings"
        ]

        self.enable_trigger_variance = 0
        self.cpu_temperature_enabled = 0
        self.env_temperature_enabled = 0
        self.pressure_enabled = 0
        self.humidity_enabled = 0
        self.altitude_enabled = 0
        self.distance_enabled = 0
        self.lumen_enabled = 0
        self.colour_enabled = 0
        self.ultra_violet_enabled = 0
        self.gas_enabled = 0
        self.particulate_matter_enabled = 0
        self.accelerometer_enabled = 0
        self.magnetometer_enabled = 0
        self.gyroscope_enabled = 0

        self.cpu_temperature_variance = 5.0
        self.cpu_temperature_wait_seconds = 60.0

        self.env_temperature_variance = 5.0
        self.env_temperature_wait_seconds = 60.0

        self.pressure_variance = 10
        self.pressure_wait_seconds = 60.0

        self.humidity_variance = 5.0
        self.humidity_wait_seconds = 60.0

        self.altitude_variance = 10
        self.altitude_wait_seconds = 60.0

        self.distance_variance = 5.0
        self.distance_wait_seconds = 2.0

        self.lumen_variance = 100.0
        self.lumen_wait_seconds = 10.0

        self.red_variance = 15.0
        self.orange_variance = 15.0
        self.yellow_variance = 15.0
        self.green_variance = 15.0
        self.blue_variance = 15.0
        self.violet_variance = 15.0
        self.colour_wait_seconds = 60.0

        self.ultra_violet_index_variance = 5.0
        self.ultra_violet_a_variance = 10.0
        self.ultra_violet_b_variance = 10.0
        self.ultra_violet_wait_seconds = 60.0

        self.gas_resistance_index_variance = 100.0
        self.gas_oxidising_variance = 100.0
        self.gas_reducing_variance = 100.0
        self.gas_nh3_variance = 100.0
        self.gas_wait_seconds = 60.0

        self.particulate_matter_1_variance = 4.0
        self.particulate_matter_2_5_variance = 4.0
        self.particulate_matter_4_variance = 4.0
        self.particulate_matter_10_variance = 4.0
        self.particulate_matter_wait_seconds = 60.0

        self.accelerometer_x_variance = 0.1
        self.accelerometer_y_variance = 0.1
        self.accelerometer_z_variance = 0.1
        self.accelerometer_wait_seconds = 0.3

        self.magnetometer_x_variance = 25.0
        self.magnetometer_y_variance = 25.0
        self.magnetometer_z_variance = 25.0
        self.magnetometer_wait_seconds = 0.3

        self.gyroscope_x_variance = 25.0
        self.gyroscope_y_variance = 25.0
        self.gyroscope_z_variance = 25.0
        self.gyroscope_wait_seconds = 0.3

        self.update_configuration_settings_list()
        if load_from_file:
            self._init_config_variables()
            self._update_variables_from_settings_list()
    def __init__(self, load_from_file=True):
        CreateGeneralConfiguration.__init__(
            self,
            file_locations.mqtt_publisher_config,
            load_from_file=load_from_file)
        self.config_file_header = "Configure MQTT Publish Settings here. Enable = 1 & Disable = 0"
        self.valid_setting_count = 73
        self.config_settings_names = [
            "Enable MQTT Publisher", "Broker Server Address", "Broker Port #",
            "Enable Authentication", "User Name (Optional)",
            "Password (Optional)", "Seconds Between Reading Posts",
            "MQTT Quality of Service Level (0-2)", "MQTT Base Topic",
            "Selected MQTT Format to Send", "Custom Date Time Format",
            "Publish System Host Name", "Publish System IP",
            "Publish System Uptime", "Publish System Date & Time",
            "Publish CPU Temperature", "Publish Environmental Temperature",
            "Publish Pressure", "Publish Altitude", "Publish Humidity",
            "Publish Distance", "Publish GAS", "Publish Particulate Matter",
            "Publish Lumen", "Publish Colors", "Publish Ultra Violet",
            "Publish Accelerometer", "Publish Magnetometer",
            "Publish Gyroscope", "System Host Name Topic", "System IP Topic",
            "System Uptime Topic", "System Date & Time Topic",
            "CPU Temperature Topic", "Environmental Temperature Topic",
            "Pressure Topic", "Altitude Topic", "Humidity Topic",
            "Distance Topic", "GAS Resistance Topic", "GAS Oxidising Topic",
            "GAS Reducing Topic", "GAS NH3 Topic",
            "Particulate Matter 1 Topic", "Particulate Matter 2.5 Topic",
            "Particulate Matter 4 Topic", "Particulate Matter 10 Topic",
            "Lumen Topic", "Color Red Topic", "Color Orange Topic",
            "Color Yellow Topic", "Color Green Topic", "Color Blue Topic",
            "Color Violet Topic", "Ultra Violet Index Topic",
            "Ultra Violet A Topic", "Ultra Violet B Topic",
            "Accelerometer X Topic", "Accelerometer Y Topic",
            "Accelerometer Z Topic", "Magnetometer X Topic",
            "Magnetometer Y Topic", "Magnetometer Z Topic",
            "Gyroscope X Topic", "Gyroscope Y Topic", "Gyroscope Z Topic",
            "Custom MQTT Send String", "Dew point", "Dew Point Topic",
            "GPS Latitude", "GPS Latitude Topic", "GPS Longitude",
            "GPS Longitude Topic"
        ]

        self.enable_mqtt_publisher = 0

        self.mqtt_send_format_kootnet = "KootnetSensors"
        self.mqtt_send_format_individual_topics = "IndividualTopics"
        self.mqtt_send_format_custom_string = "CustomString"
        self.selected_mqtt_send_format = self.mqtt_send_format_kootnet

        self.custom_str_datetime_format = "%Y-%m-%d %H:%M:%S.%f"

        self.broker_address = ""
        self.broker_server_port = 1883
        self.enable_broker_auth = 0
        self.broker_user = ""
        self.broker_password = ""
        self.seconds_to_wait = 60
        self.mqtt_publisher_qos = 0

        self.mqtt_base_topic = app_cached_variables.tmp_sensor_id + "/"

        self.mqtt_custom_data_string = str(
            self.get_mqtt_replacements_dictionary())

        self.sensor_host_name = 0
        self.sensor_ip = 0
        self.gps_latitude = 0
        self.gps_longitude = 0
        self.sensor_uptime = 0
        self.sensor_date_time = 0
        self.system_temperature = 0
        self.env_temperature = 0
        self.pressure = 0
        self.altitude = 0
        self.humidity = 0
        self.dew_point = 0
        self.distance = 0
        self.gas = 0
        self.gas_resistance_index = 0
        self.gas_oxidising = 0
        self.gas_reducing = 0
        self.gas_nh3 = 0
        self.particulate_matter = 0
        self.particulate_matter_1 = 0
        self.particulate_matter_2_5 = 0
        self.particulate_matter_4 = 0
        self.particulate_matter_10 = 0
        self.lumen = 0
        self.color = 0
        self.color_red = 0
        self.color_orange = 0
        self.color_yellow = 0
        self.color_green = 0
        self.color_blue = 0
        self.color_violet = 0
        self.ultra_violet = 0
        self.ultra_violet_a = 0
        self.ultra_violet_b = 0
        self.accelerometer = 0
        self.accelerometer_x = 0
        self.accelerometer_y = 0
        self.accelerometer_z = 0
        self.magnetometer = 0
        self.magnetometer_x = 0
        self.magnetometer_y = 0
        self.magnetometer_z = 0
        self.gyroscope = 0
        self.gyroscope_x = 0
        self.gyroscope_y = 0
        self.gyroscope_z = 0

        self.sensor_host_name_topic = database_variables.sensor_name
        self.sensor_ip_topic = database_variables.ip
        self.gps_latitude_topic = database_variables.latitude
        self.gps_longitude_topic = database_variables.longitude
        self.sensor_uptime_topic = database_variables.sensor_uptime
        self.sensor_date_time_topic = database_variables.all_tables_datetime
        self.system_temperature_topic = database_variables.system_temperature
        self.env_temperature_topic = database_variables.env_temperature
        self.pressure_topic = database_variables.pressure
        self.altitude_topic = database_variables.altitude
        self.humidity_topic = database_variables.humidity
        self.dew_point_topic = database_variables.dew_point
        self.distance_topic = database_variables.distance
        self.gas_topic = database_variables.gas_all_dic
        self.gas_resistance_index_topic = database_variables.gas_resistance_index
        self.gas_oxidising_topic = database_variables.gas_oxidising
        self.gas_reducing_topic = database_variables.gas_reducing
        self.gas_nh3_topic = database_variables.gas_nh3
        self.particulate_matter_topic = database_variables.particulate_matter_all_dic
        self.particulate_matter_1_topic = database_variables.particulate_matter_1
        self.particulate_matter_2_5_topic = database_variables.particulate_matter_2_5
        self.particulate_matter_4_topic = database_variables.particulate_matter_4
        self.particulate_matter_10_topic = database_variables.particulate_matter_10
        self.lumen_topic = database_variables.lumen
        self.color_topic = database_variables.colour_all_dic
        self.color_red_topic = database_variables.red
        self.color_orange_topic = database_variables.orange
        self.color_yellow_topic = database_variables.yellow
        self.color_green_topic = database_variables.green
        self.color_blue_topic = database_variables.blue
        self.color_violet_topic = database_variables.violet
        self.ultra_violet_topic = database_variables.ultra_violet_all_dic
        self.ultra_violet_index_topic = database_variables.ultra_violet_index
        self.ultra_violet_a_topic = database_variables.ultra_violet_a
        self.ultra_violet_b_topic = database_variables.ultra_violet_b
        self.accelerometer_topic = database_variables.acc_all_dic
        self.accelerometer_x_topic = database_variables.acc_x
        self.accelerometer_y_topic = database_variables.acc_y
        self.accelerometer_z_topic = database_variables.acc_z
        self.magnetometer_topic = database_variables.mag_all_dic
        self.magnetometer_x_topic = database_variables.mag_x
        self.magnetometer_y_topic = database_variables.mag_y
        self.magnetometer_z_topic = database_variables.mag_z
        self.gyroscope_topic = database_variables.gyro_all_dic
        self.gyroscope_x_topic = database_variables.gyro_x
        self.gyroscope_y_topic = database_variables.gyro_y
        self.gyroscope_z_topic = database_variables.gyro_z

        self.update_configuration_settings_list()
        if load_from_file:
            self._init_config_variables()
            self._update_variables_from_settings_list()
Beispiel #18
0
    def __init__(self, load_from_file=True, config_file_location=None):
        if config_file_location is None:
            config_file_location = file_locations.db_graphs_config
        CreateGeneralConfiguration.__init__(self,
                                            config_file_location,
                                            load_from_file=load_from_file)
        self.config_file_header = "Database Graphs Configuration. Enable = 1 and Disable = 0"
        self.valid_setting_count = 29
        self.config_settings_names = [
            "SQL Recording Type", "Render Engine",
            "Maximum Data Points per Graph", "Skip Data Points between Plots",
            "DateTime Offset in Hours", "Start Date", "End Date",
            "SQL Database Selection", "MQTT Database Checked",
            "MQTT Database Topic (Sensor ID)", "Plotly Graph Save Location",
            "Enable Uptime", "Enable CPU Temperature",
            "Enable Environmental Temperature", "Enable Pressure",
            "Enable Altitude", "Enable Humidity", "Enable Dew Point",
            "Enable Distance", "Enable GAS", "Enable Particulate Matter",
            "Enable Lumen", "Enable Colours", "Enable Ultra Violet",
            "Enable Accelerometer", "Enable Magnetometer", "Enable Gyroscope",
            "Database Location", "Graph Database Table Name"
        ]

        self.sql_recording_type = app_cached_variables.database_variables.table_interval
        self.render_engine = "OpenGL"  # or CPU
        self.max_graph_data_points = 100000
        self.skip_data_between_plots = 3
        self.date_time_hours_offset = 0.0

        self.graph_start_date = "2019-07-01 00:00:00"
        self.graph_end_date = "2219-07-01 00:00:00"

        self.sql_database_selection = "MainDatabase"  # or MQTTSubscriberDatabase or CheckinDatabase
        self.mqtt_database_checked = 0
        self.mqtt_database_topic = ""

        self.database_location = file_locations.sensor_database
        self.graph_db_table = app_cached_variables.database_variables.table_interval
        self.plotly_graph_saved_location = file_locations.plotly_graph_interval

        self.db_graph_uptime = 1
        self.db_graph_cpu_temp = 1
        self.db_graph_env_temp = 1
        self.db_graph_pressure = 1
        self.db_graph_altitude = 1
        self.db_graph_humidity = 1
        self.db_graph_dew_point = 1
        self.db_graph_distance = 1
        self.db_graph_gas = 1
        self.db_graph_particulate_matter = 1
        self.db_graph_lumen = 1
        self.db_graph_colours = 1
        self.db_graph_ultra_violet = 1
        self.db_graph_acc = 1
        self.db_graph_mag = 1
        self.db_graph_gyro = 1

        self.update_configuration_settings_list()
        if load_from_file:
            self._init_config_variables()
            self.update_variables_from_settings_list()
    def __init__(self, load_from_file=True):
        trigger_high_low_config = file_locations.trigger_high_low_config
        CreateGeneralConfiguration.__init__(self,
                                            trigger_high_low_config,
                                            load_from_file=load_from_file)
        self.config_file_header = "0 = Disabled and 1 = Enabled"
        self.config_settings_names = [
            "Enable High/Low Trigger Recording", "Enable CPU Temperature",
            "CPU Temperature Low Trigger", "CPU Temperature High Trigger",
            "Seconds between CPU Temperature readings",
            "Enable Environmental Temperature",
            "Environmental Temperature Low Trigger",
            "Environmental Temperature High Trigger",
            "Seconds between Env Temperature readings", "Enable Pressure",
            "Pressure Low Trigger", "Pressure High Trigger",
            "Seconds between Pressure readings", "Enable Altitude",
            "Altitude Low Trigger", "Altitude High Trigger",
            "Seconds between Altitude readings", "Enable Humidity",
            "Humidity Low Trigger", "Humidity High Trigger",
            "Seconds between Humidity readings", "Enable Distance",
            "Distance Low Trigger", "Distance High Trigger",
            "Seconds between Distance readings", "Enable Gas",
            "Gas Resistance Index Low Trigger",
            "Gas Resistance Index High Trigger", "Gas Oxidising Low Trigger",
            "Gas Oxidising High Trigger", "Gas Reducing Low Trigger",
            "Gas Reducing High Trigger", "Gas NH3 Low Trigger",
            "Gas NH3 High Trigger", "Seconds between Gas readings",
            "Enable Particulate Matter (PM)",
            "Particulate Matter 1 (PM1) Low Trigger",
            "Particulate Matter 1 (PM1) High Trigger",
            "Particulate Matter 2.5 (PM2.5) Low Trigger",
            "Particulate Matter 2.5 (PM2.5) High Trigger",
            "Particulate Matter 4 (PM4) Low Trigger",
            "Particulate Matter 4 (PM4) High Trigger",
            "Particulate Matter 10 (PM10) Low Trigger",
            "Particulate Matter 10 (PM10) High Trigger",
            "Seconds between PM readings", "Enable Lumen", "Lumen Low Trigger",
            "Lumen High Trigger", "Seconds between Lumen readings",
            "Enable Colour", "Red Low Trigger", "Red High Trigger",
            "Orange Low Trigger", "Orange High Trigger", "Yellow Low Trigger",
            "Yellow High Trigger", "Green Low Trigger", "Green High Trigger",
            "Blue Low Trigger", "Blue High Trigger", "Violet Low Trigger",
            "Violet High Trigger", "Seconds between Colour readings",
            "Enable Ultra Violet", "Ultra Violet Index Low Trigger",
            "Ultra Violet Index High Trigger", "Ultra Violet A Low Trigger",
            "Ultra Violet A High Trigger", "Ultra Violet B Low Trigger",
            "Ultra Violet B High Trigger",
            "Seconds between Ultra Violet readings", "Enable Accelerometer",
            "Accelerometer X Low Trigger", "Accelerometer X High Trigger",
            "Accelerometer Y Low Trigger", "Accelerometer Y High Trigger",
            "Accelerometer Z Low Trigger", "Accelerometer Z High Trigger",
            "Seconds between Accelerometer readings", "Enable Magnetometer",
            "Magnetometer X Low Trigger", "Magnetometer X High Trigger",
            "Magnetometer Y Low Trigger", "Magnetometer Y High Trigger",
            "Magnetometer Z Low Trigger", "Magnetometer Z High Trigger",
            "Seconds between Magnetometer readings", "Enable Gyroscope",
            "Gyroscope X Low Trigger", "Gyroscope X High Trigger",
            "Gyroscope Y Low Trigger", "Gyroscope Y High Trigger",
            "Gyroscope Z Low Trigger", "Gyroscope Z High Trigger",
            "Seconds between Gyroscope readings"
        ]
        self.valid_setting_count = len(self.config_settings_names)

        self.enable_high_low_trigger_recording = 0

        self._disable_all_triggers()

        self.cpu_temperature_low = 10.0
        self.cpu_temperature_high = 75.0
        self.cpu_temperature_wait_seconds = 60.0

        self.env_temperature_low = -5.0
        self.env_temperature_high = 35.0
        self.env_temperature_wait_seconds = 60.0

        self.pressure_low = 350
        self.pressure_high = 1200
        self.pressure_wait_seconds = 60.0

        self.humidity_low = 25.0
        self.humidity_high = 80.0
        self.humidity_wait_seconds = 60.0

        self.altitude_low = 200
        self.altitude_high = 1000
        self.altitude_wait_seconds = 60.0

        self.distance_low = 1.0
        self.distance_high = 555.0
        self.distance_wait_seconds = 2

        self.lumen_low = 25.0
        self.lumen_high = 1000.0
        self.lumen_wait_seconds = 10

        self.red_low = 15.0
        self.red_high = 215.0
        self.orange_low = 15.0
        self.orange_high = 215.0
        self.yellow_low = 15.0
        self.yellow_high = 215.0
        self.green_low = 15.0
        self.green_high = 215.0
        self.blue_low = 15.0
        self.blue_high = 215.0
        self.violet_low = 15.0
        self.violet_high = 215.0
        self.colour_wait_seconds = 60.0

        self.ultra_violet_index_low = 25.0
        self.ultra_violet_index_high = 225.0
        self.ultra_violet_a_low = 21.0
        self.ultra_violet_a_high = 210.0
        self.ultra_violet_b_low = 20.0
        self.ultra_violet_b_high = 210.0
        self.ultra_violet_wait_seconds = 60.0

        self.gas_resistance_index_low = 100.0
        self.gas_resistance_index_high = 800.0
        self.gas_oxidising_low = 100.0
        self.gas_oxidising_high = 800.0
        self.gas_reducing_low = 100.0
        self.gas_reducing_high = 800.0
        self.gas_nh3_low = 100.0
        self.gas_nh3_high = 800.0
        self.gas_wait_seconds = 60.0

        self.particulate_matter_1_low = 40.0
        self.particulate_matter_1_high = 114.0
        self.particulate_matter_2_5_low = 41.0
        self.particulate_matter_2_5_high = 114.0
        self.particulate_matter_4_low = 41.0
        self.particulate_matter_4_high = 114.0
        self.particulate_matter_10_low = 41.0
        self.particulate_matter_10_high = 114.0
        self.particulate_matter_wait_seconds = 60.0

        self.accelerometer_x_low = 0.1
        self.accelerometer_x_high = 0.9
        self.accelerometer_y_low = 0.1
        self.accelerometer_y_high = 0.9
        self.accelerometer_z_low = 0.1
        self.accelerometer_z_high = 0.9
        self.accelerometer_wait_seconds = 0.3

        self.magnetometer_x_low = 40.0
        self.magnetometer_x_high = 60.0
        self.magnetometer_y_low = 40.0
        self.magnetometer_y_high = 60.0
        self.magnetometer_z_low = 40.0
        self.magnetometer_z_high = 60.0
        self.magnetometer_wait_seconds = 0.3

        self.gyroscope_x_low = 10.0
        self.gyroscope_x_high = 70.0
        self.gyroscope_y_low = 10.0
        self.gyroscope_y_high = 70.0
        self.gyroscope_z_low = 10.0
        self.gyroscope_z_high = 70.0
        self.gyroscope_wait_seconds = 0.3

        self.update_configuration_settings_list()
        if load_from_file:
            self._init_config_variables()
            self._update_variables_from_settings_list()
Beispiel #20
0
    def __init__(self, load_from_file=True, config_file_location=None):
        if config_file_location is None:
            config_file_location = file_locations.html_sensor_control_config
        CreateGeneralConfiguration.__init__(self,
                                            config_file_location,
                                            load_from_file=load_from_file)
        self.config_file_header = "This contains saved values for HTML Sensor Control"
        self.valid_setting_count = 3
        self.config_settings_names = [
            "selected_action", "selected_send_type", "selected_ip_list"
        ]

        self.html_ip_field_names = [
            "senor_ip_1", "senor_ip_2", "senor_ip_3", "senor_ip_4",
            "senor_ip_5", "senor_ip_6", "senor_ip_7", "senor_ip_8",
            "senor_ip_9", "senor_ip_10", "senor_ip_11", "senor_ip_12",
            "senor_ip_13", "senor_ip_14", "senor_ip_15", "senor_ip_16",
            "senor_ip_17", "senor_ip_18", "senor_ip_19", "senor_ip_20"
        ]

        self.local_queue = Queue()

        # File names of all the custom IP lists used in Remote Management (Only names, no directory path)
        self.custom_ip_list_names = get_list_of_filenames_in_dir(
            file_locations.custom_ip_lists_folder)

        if len(self.custom_ip_list_names) == 0:
            CreateIPList().save_list_to_file()
            self.custom_ip_list_names = get_list_of_filenames_in_dir(
                file_locations.custom_ip_lists_folder)

        self.selected_ip_list = self.custom_ip_list_names[0]
        # ToDo: Have program use these instead of rm_cached_variables http_login & http_password
        # Save hash of user/pass to config file? send hash as auth?
        self.logon_user = "******"
        self.logon_password = "******"

        # Dictionary filled with Class instances of CreateIPList
        self.ip_list_instance = None

        self.radio_check_status = "online_status"
        self.radio_report_combo = "combo_report"
        self.radio_report_system = "systems_report"
        self.radio_report_config = "config_report"
        self.radio_report_test_sensors = "sensors_test_report"
        self.radio_report_sensors_latency = "sensors_latency_report"
        self.radio_download_reports = "sensors_download_reports"
        self.radio_download_databases = "sensors_download_databases"
        self.radio_download_logs = "sensors_download_logs"
        self.radio_create_the_big_zip = "sensors_download_everything"

        self.radio_send_type_relayed = "relayed_download"
        self.radio_send_type_direct = "direct_download"

        self.selected_action = self.radio_check_status
        self.selected_send_type = self.radio_send_type_relayed
        self.sensor_ip_dns1 = ""
        self.sensor_ip_dns2 = ""
        self.sensor_ip_dns3 = ""
        self.sensor_ip_dns4 = ""
        self.sensor_ip_dns5 = ""
        self.sensor_ip_dns6 = ""
        self.sensor_ip_dns7 = ""
        self.sensor_ip_dns8 = ""
        self.sensor_ip_dns9 = ""
        self.sensor_ip_dns10 = ""
        self.sensor_ip_dns11 = ""
        self.sensor_ip_dns12 = ""
        self.sensor_ip_dns13 = ""
        self.sensor_ip_dns14 = ""
        self.sensor_ip_dns15 = ""
        self.sensor_ip_dns16 = ""
        self.sensor_ip_dns17 = ""
        self.sensor_ip_dns18 = ""
        self.sensor_ip_dns19 = ""
        self.sensor_ip_dns20 = ""

        self.update_configuration_settings_list()
        if load_from_file:
            self._init_config_variables()
            self._update_variables_from_settings_list()