def initializeSGSPart1(): print("###############################################") print("SGS2 Version "+SGSVERSION+" - SwitchDoc Labs") print("###############################################") print("") print("Program Started at:"+ time.strftime("%Y-%m-%d %H:%M:%S")) print("") # read in JSON # read in JSON if (readJSON.readJSON("") == False): print("#############################") print("No SGS.JSON file present - configure with 'sudo python3 SGSConfigure.py'") print("#############################") exit() readJSON.readJSONSGSConfiguration("") #init blynk app state if (config.USEBLYNK): updateBlynk.blynkInit() message = "SGS Version "+SGSVERSION+" Started" pclogging.systemlog(config.INFO,message) pclogging.systemlog(config.JSON,"SGS.JSON Loaded: "+json.dumps(config.JSONData )) pclogging.systemlog(config.JSON,"SGSConfigurationJSON.JSON Loaded: "+json.dumps(config.SGSConfigurationJSON )) pclogging.systemlog(config.CRITICAL,"No Alarm") if (config.GardenCam_Present): pclogging.systemlog(config.INFO,"Garden Cam Present") else: pclogging.systemlog(config.INFO,"Garden Cam NOT Present") # scan and check for resources # get if weather is being used config.Weather_Present = readJSON.getJSONValue("weather") pass
updateBlynk.blynkTerminalUpdate("SW Startup Version " + config.SWVERSION) subjectText = "The " + config.STATIONKEY + " SkyWeather2 Raspberry Pi has #rebooted." ipAddress = subprocess.check_output(['hostname', '-I']) bodyText = "SkyWeather2 Version " + config.SWVERSION + " Startup \n" + ipAddress.decode( ) + "\n" if (config.SunAirPlus_Present): sampleSunAirPlus() bodyText = bodyText + "\n" + "BV=%0.2fV/BC=%0.2fmA/SV=%0.2fV/SC=%0.2fmA" % ( batteryVoltage, batteryCurrent, solarVoltage, solarCurrent) sendemail.sendEmail("test", bodyText, subjectText, config.notifyAddress, config.fromAddress, "") if (config.USEBLYNK): updateBlynk.blynkInit() import paho.mqtt.client as mqtt # set up MQTT if (config.MQTT_Enable): state.mqtt_client = mqtt.Client(client_id="SkyWeather2") state.mqtt_client.connect(config.MQTT_Server_URL, port=config.MQTT_Port_Number) import publishMQTT # Set up scheduler scheduler = BackgroundScheduler()
import time import requests import json import updateBlynk print updateBlynk.blynkSGSAppOnline() print updateBlynk.blynkInit() print updateBlynk.blynkStatusUpdate()