示例#1
0
def onNagTimer(zone, nagSensors):
    '''
    You should do something about the open doors!
    '''
    sdf = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss")
    logMsg = ''
    msg = ''
    for i in range(len(nagSensors)):
        sensor = nagSensors[i]
        msg += sensor.label
        logMsg += sensor.label
        logMsg += u' opened ' + sdf.print(sensor.getLastUpdate())
        if i + 2 == len(nagSensors):
            msg += ' and '
            logMsg += ' and '
        elif i + 1 == len(nagSensors):
            msg += '.'
            logMsg += '.'
        elif i + 2 < len(nagSensors):
            msg += ', '
            logMsg += ', '
    msg = u'Open sections in ' + zone.name.decode('utf-8') + '. ' + msg
    log.info(msg)
    if zone.zoneNumber in [
            1, 3, 4
    ] and itemRegistry.getItem('Z1_Block_Nag_Timer').state != ON:
        tts(msg, PRIO['HIGH'])
    elif zone.zoneNumber == 2 and itemRegistry.getItem(
            'Z2_Block_Nag').state != ON:
        tts(msg, PRIO['MODERATE'])
示例#2
0
	def __init__(self, r=None, counter=None, pool=None):
		self.r = r
		self.formatter = DateTimeFormat.forPattern("MM/dd/yyyy HH:mm:ss")
		if counter:
			self._counter = counter
		if pool:
			self._pool = pool
示例#3
0
def onZoneStatusChange(zone, newZoneStatus, oldZoneStatus, errorMessage=None):
    '''
    This function will be called when there is a change of zone status.
    oldZoneStatus is None when initializing.
    '''
    log.info('Custom function: onZoneStatusChange: ' +
             zone.name.decode('utf-8') + ' ---> ' +
             kw(ZONESTATUS, newZoneStatus))

    if newZoneStatus == ZONESTATUS['ERROR']:
        errMes = 'Error when arming zone ' + zone.name.decode(
            'utf-8') + ': ' + errorMessage
        log.error(errMes)
        Pushover.pushover(errMes, PUSHOVER_DEF_DEV, PUSHOVER_PRIO['HIGH'])

    elif newZoneStatus == ZONESTATUS['ALERT']:
        # Get all sensors that have been tripped since 2 minutes regardless of their current state
        # considering that an intruder might have closed a tripped door already when this is running
        mins = 2
        openSensors = zone.getOpenSensors(mins)
        sdf = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss")
        msg = ''
        for i in range(len(openSensors)):
            sensor = openSensors[i]
            msg += sensor.label
            msg += u' tripped ' + sdf.print(sensor.getLastUpdate())
            if i + 2 == len(openSensors):
                msg += ' and '
            elif i + 1 == len(openSensors):
                msg += '.'
            elif i + 2 < len(openSensors):
                msg += ', '
        msg = u'Alarm in zone ' + zone.name.decode('utf-8') + '. ' + msg
        log.error(msg)

        if zone.alarmTestMode:
            log.info('ideAlarm in TESTING MODE')
            tts(msg, PRIO['EMERGENCY'])
            Pushover.pushover(msg, PUSHOVER_DEF_DEV, PUSHOVER_PRIO['NORMAL'])
        else:
            tts(msg, PRIO['EMERGENCY'])
            Pushover.pushover(msg, PUSHOVER_DEF_DEV,
                              PUSHOVER_PRIO['EMERGENCY'])

    elif newZoneStatus == ZONESTATUS['TRIPPED']:
        if zone.zoneNumber == 1:
            alertText = u'Intrusion in ' + zone.name.decode('utf-8')
            tts(alertText, PRIO['EMERGENCY'])

    elif newZoneStatus == ZONESTATUS['ARMING']:
        if zone.zoneNumber == 1:
            tts('sad cat', PRIO['HIGH'])
示例#4
0
from core.triggers import CronTrigger, ItemStateChangeTrigger
from custom.helper import rule, getNow, getHistoricItemEntry, getItemState, getItemLastUpdate, sendCommand, sendCommandIfChanged, postUpdate, postUpdateIfChanged, itemLastUpdateOlderThen
from custom.model.heating import Heating
from custom.model.house import ThermalStorageType, ThermalBridgeType, Wall, Door, Window, Room

from org.joda.time import DateTime
from org.joda.time.format import DateTimeFormat
from core.actions import Transformation
import math

OFFSET_FORMATTER = DateTimeFormat.forPattern("HH:mm")

Heating.cloudCoverFC8Item = "Cloud_Cover_Forecast8"
Heating.cloudCoverFC4Item = "Cloud_Cover_Forecast4"
Heating.cloudCoverItem = "Cloud_Cover_Current"

Heating.temperatureGardenFC8Item = "Temperature_Garden_Forecast8"
Heating.temperatureGardenFC4Item = "Temperature_Garden_Forecast4"
Heating.temperatureGardenItem = "Heating_Temperature_Outdoor" # Temperature_Garden

Heating.ventilationFilterRuntimeItem = "Ventilation_Filter_Runtime"

Heating.ventilationLevelItem = "Ventilation_Outgoing"
Heating.ventilationOutgoingTemperatureItem = "Ventilation_Outdoor_Outgoing_Temperature"
Heating.ventilationIncommingTemperatureItem = "Ventilation_Outdoor_Incoming_Temperature"

Heating.heatingPower = "Heating_Power"
Heating.heatingCircuitPumpSpeedItem = "Heating_Circuit_Pump_Speed"
Heating.heatingTemperaturePipeOutItem = "Heating_Temperature_Pipe_Out"
Heating.heatingTemperaturePipeInItem = "Heating_Temperature_Pipe_In"
def weatherStationUploader(event):
    weatherStationUploader.log.setLevel(weatherStationUploader_configuration['logLevel'])
    global wu_second_count
    if (not weatherStationUploader_configuration['stationdata']['weather_upload']) \
    or (weatherStationUploader_configuration['stationdata']['weather_upload'] and wu_second_count%weatherStationUploader_configuration['stationdata']['upload_frequency_seconds'] == 0):
        if weatherStationUploader_configuration['stationdata']['weather_upload']:
            weatherStationUploader.log.debug('Uploading data to Weather Underground')
        else:
            weatherStationUploader.log.debug('No data to will be upladed to Weather Underground')

        sdf = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss")
        dateutc = sdf.print(DateTime.now((DateTimeZone.UTC)))

        tempf = None
        temp = None
        sensorName = getTheSensor('tempc', getLowest=True)
        if sensorName is not None:
            temp = Temp(getItemValue(sensorName, 0.0), 'c') # Outdoor temp, c - celsius, f - fahrenheit, k - kelvin
            tempf = str(round(temp.f, 1))

        soiltempf = None
        sensorName = getTheSensor('soiltempc')
        if sensorName is not None:
            _temp = Temp(getItemValue(sensorName, 0.0), 'c') # Soil temp, c - celsius, f - fahrenheit, k - kelvin
            soiltempf = str(round(_temp.f, 1))

        humidity = None
        sensorName = getTheSensor('humidity')
        if sensorName is not None:
            humidity = getItemValue(sensorName, 0.0)

        dewptf = None
        heatidxf = None
        if humidity is not None and temp is not None:
            dewptf = str(round(dew_point(temperature=temp, humidity=humidity).f, 1)) # calculate Dew Point
            heatidxf = str(round(heat_index(temperature=temp, humidity=humidity).f, 1)) # calculate Heat Index

        pressure = None
        sensorName = getTheSensor('pressurembar')
        if sensorName is not None:
            _mbar = getItemValue(sensorName, 0)
            if ((_mbar < 1070) and (_mbar > 920)): 
                pressure = str(mbar_to_inches_mercury(_mbar))

        rainin = None
        sensorName = getTheSensor('rainhour', never_assume_dead=True)
        if sensorName is not None:
            rainin = str(mm_to_inch(getItemValue(sensorName, 0.0)))

        dailyrainin = None
        sensorName = getTheSensor('raintoday', never_assume_dead=True)
        if sensorName is not None:
            dailyrainin = str(mm_to_inch(getItemValue(sensorName, 0.0)))

        soilmoisture = None
        sensorName = getTheSensor('soilmoisture')
        if sensorName is not None:
            soilmoisture = str(int(round(getItemValue(sensorName, 0.0) * 100 / 1023)))

        winddir = None
        sensorName = getTheSensor('winddir')
        if sensorName is not None:
            winddir = str(getItemValue(sensorName, 0))

        windspeedmph = None
        sensorName = getTheSensor('windspeedms')
        if sensorName is not None:
            windspeedmph = str(ms_to_mph(getItemValue(sensorName, 0.0)))

        windgustmph = None
        sensorName = getTheSensor('windgustms')
        if sensorName is not None:
            windgustmph = str(ms_to_mph(getItemValue(sensorName, 0.0)))

        windgustdir = None
        sensorName = getTheSensor('windgustdir')
        if sensorName is not None:
            windgustdir = str(getItemValue(sensorName, 0))

        windspdmph_avg2m = None
        sensorName = getTheSensor('windspeedms_avg2m')
        if sensorName is not None:
            windspdmph_avg2m = str(ms_to_mph(getItemValue(sensorName, 0.0)))

        winddir_avg2m = None
        sensorName = getTheSensor('winddir_avg2m')
        if sensorName is not None:
            winddir_avg2m = str(getItemValue(sensorName, 0))

        windgustmph_10m = None
        sensorName = getTheSensor('windgustms_10m')
        if sensorName is not None:
            windgustmph_10m = str(ms_to_mph(getItemValue(sensorName, 0.0)))

        windgustdir_10m = None
        sensorName = getTheSensor('windgustdir_10m')
        if sensorName is not None:
            windgustdir_10m = str(getItemValue(sensorName, 0))

        solarradiation = None
        sensorName = getTheSensor('solarradiation', getHighest=True)
        if sensorName is not None:
            solarradiation = str(lux_to_watts_m2(getItemValue(sensorName, 0)))

        # From http://wiki.wunderground.com/index.php/PWS_-_Upload_Protocol

        cmd = 'curl -s -G "' + WU_URL + '" ' \
            + '--data-urlencode "action=updateraw" ' \
            + ('--data-urlencode "realtime=1" ' if weatherStationUploader_configuration['stationdata']['rapid_fire_mode'] else '') \
            + ('--data-urlencode "rtfreq='+str(weatherStationUploader_configuration['stationdata']['upload_frequency_seconds'])+'" ' if weatherStationUploader_configuration['stationdata']['rapid_fire_mode'] else '') \
            + '--data-urlencode "ID='+weatherStationUploader_configuration['stationdata']['station_id']+'" ' \
            + '--data-urlencode "PASSWORD='******'stationdata']['station_key']+'" ' \
            + '--data-urlencode "dateutc='+dateutc+'" ' \
            + '--data-urlencode "softwaretype=openHAB" '
        weatherStationUploader.log.debug("")

        if weatherStationUploader_configuration['stationdata']['weather_upload']:
            weatherStationUploader.log.debug("Below is the weather data that we will send:")
        else:
            weatherStationUploader.log.debug("Below is the weather data that we would send (if weather_upload was enabled):")

        if tempf is not None:
            cmd += '--data-urlencode "tempf='+tempf+'" '
            weatherStationUploader.log.debug("tempf: "+tempf)
        if humidity is not None:
            cmd += '--data-urlencode "humidity='+str(humidity)+'" '
            weatherStationUploader.log.debug("humidity: "+str(humidity))
        if dewptf is not None:
            cmd += '--data-urlencode "dewptf='+dewptf+'" '
            weatherStationUploader.log.debug("dewptf: "+dewptf)
        if heatidxf is not None:
            cmd += '--data-urlencode "heatidxf='+heatidxf+'" '
            weatherStationUploader.log.debug("heatidxf: "+heatidxf)
        if soiltempf is not None:
            cmd += '--data-urlencode "soiltempf='+soiltempf+'" '
            weatherStationUploader.log.debug("soiltempf: "+soiltempf)
        if soilmoisture is not None:
            cmd += '--data-urlencode "soilmoisture='+soilmoisture+'" '
            weatherStationUploader.log.debug("soilmoisture: "+soilmoisture)
        if pressure is not None:
            cmd += '--data-urlencode "baromin='+pressure+'" '
            weatherStationUploader.log.debug("baromin: "+pressure)
        if rainin is not None:
            cmd += '--data-urlencode "rainin='+rainin+'" '
            weatherStationUploader.log.debug("rainin: "+rainin)
        if dailyrainin is not None:
            cmd += '--data-urlencode "dailyrainin='+dailyrainin+'" '
            weatherStationUploader.log.debug("dailyrainin: "+dailyrainin)
        if winddir is not None:
            cmd += '--data-urlencode "winddir='+winddir+'" '
            weatherStationUploader.log.debug("winddir: "+winddir)
        if windspeedmph is not None:
            cmd += '--data-urlencode "windspeedmph='+windspeedmph+'" '
            weatherStationUploader.log.debug("windspeedmph: "+windspeedmph)
        if windgustmph is not None:
            cmd += '--data-urlencode "windgustmph='+windgustmph+'" '
            weatherStationUploader.log.debug("windgustmph: "+windgustmph)
        if windgustdir is not None:
            cmd += '--data-urlencode "windgustdir='+windgustdir+'" '
            weatherStationUploader.log.debug("windgustdir: "+windgustdir)
        if windspdmph_avg2m is not None:
            cmd += '--data-urlencode "windspdmph_avg2m='+windspdmph_avg2m+'" '
            weatherStationUploader.log.debug("windspdmph_avg2m: "+windspdmph_avg2m)
        if winddir_avg2m is not None:
            cmd += '--data-urlencode "winddir_avg2m='+winddir_avg2m+'" '
            weatherStationUploader.log.debug("winddir_avg2m: "+winddir_avg2m)
        if windgustmph_10m is not None:
            cmd += '--data-urlencode "windgustmph_10m='+windgustmph_10m+'" '
            weatherStationUploader.log.debug("windgustmph_10m: "+windgustmph_10m)
        if windgustdir_10m is not None:
            cmd += '--data-urlencode "windgustdir_10m='+windgustdir_10m+'" '
            weatherStationUploader.log.debug("windgustdir_10m: "+windgustdir_10m)
        if solarradiation is not None:
            cmd += '--data-urlencode "solarradiation='+solarradiation+'" '
            weatherStationUploader.log.debug("solarradiation: "+solarradiation)
        cmd += ' 1>/dev/null 2>&1 &'
        weatherStationUploader.log.debug("")

        if weatherStationUploader_configuration['stationdata']['weather_upload']:
            weatherStationUploader.log.debug("WeatherUpload version {}, performing an upload. (second count is: {})".format(__version__, wu_second_count))
            weatherStationUploader.log.debug("cmd: {}".format(cmd))
            os.system(cmd)
    else:
        weatherStationUploader.log.debug("WeatherUpload version {}, skipping upload. (second count is: {})".format(__version__, wu_second_count))

    if (wu_second_count%weatherStationUploader_configuration['stationdata']['upload_frequency_seconds'] == 0):
        wu_second_count = 0
    wu_second_count = wu_second_count + 10 # Corresponding to CronTrigger(EVERY_10_SECONDS)
示例#6
0
def curDateText():
    '''Get the current date and time as text'''
    return str(
        DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss").print(DateTime.now()))
示例#7
0
energyTotalDemandCorrectureFactor = 1.045
energyTotalSupplyCorrectureFactor = 1.00

# offset values for total energy demand and supply (total values at the time when knx based energy meter was installed)
startEnergyTotalDemandValue = 21158.037
startEnergyTotalSupplyValue = -90.636

# offset values for electricity meter demand and supply (total values at the time when new electricity meter was changed)
startElectricityMeterDemandValue = 21911.164
startElectricityMeterSupplyValue = 0

# offset values for gas meter (total value at the time when knx based impulse counter was resettet)
startGasMeterValue = 8573.39
startGasImpulseCounter = 0

dateTimeFormatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss.SSS")


def getHistoricReference(log, itemName, valueTime, outdatetTime, messureTime,
                         intervalTime):
    endTime = getItemLastUpdate(itemName)
    endTimestampInMillis = endTime.getMillis()

    nowInMillis = getNow().getMillis()

    if endTimestampInMillis < nowInMillis - (outdatetTime * 1000):
        log.info(u"No consumption. Last value is too old.")
        return 0

    minMessuredTimestampInMillis = nowInMillis - (messureTime * 1000)
    def execute(self, modules, inputs):

        SCRIPT_VERSION = '2.3.1'
        WU_URL = "http://weatherstation.wunderground.com/weatherstation/updateweatherstation.php"

        def ms_to_mph(input_speed):
            # convert input_speed from meter per second to miles per hour
            return round(input_speed / 0.44704, 2)

        def mm_to_inch(mm):
            # convert mm to inches
            return round(mm / 25.4, 2)

        def mbar_to_inches_mercury(input_pressure):
            # convert mbar to inches mercury
            return round(input_pressure * 0.02953, 2)

        def lux_to_watts_m2(lux):
            # Convert lux [lx] to watt/m² (at 555 nm)
            # Should typically be around 800-900 watt/m² at mid summer full sun diation at 13.00 h
            # return int(round(float(lux) * 0.01464128843))
            return int(round(float(lux) * 0.015454545))

        def getTheSensor(lbl,
                         never_assume_dead=False,
                         getHighest=False,
                         getLowest=False):
            # Each sensor entry in the configuration file can be a a single item name or a python list where you can
            # define multiple sensor names. The first sensor in that list that has reported within the value set in
            # sensor_dead_after_mins will be used. (Unless never_assume_dead is set to True)
            # When "getHighest" argument is set to True, the sensor name with the highest value is picked.
            # When "getlowest" argument is set to True, the sensor name with the lowest value is picked.

            def isSensorAlive(sName):
                if getLastUpdate(PersistenceExtensions,
                                 ir.getItem(sName)).isAfter(
                                     DateTime.now().minusMinutes(
                                         sensor_dead_after_mins)):
                    return True
                else:
                    self.log.warning('Sensor device ' + unicode(sName) +
                                     ' has not reported since: ' + str(
                                         getLastUpdate(PersistenceExtensions,
                                                       ir.getItem(sName))))
                    return False

            sensorName = None
            if lbl in self.config.wunderground[
                    'sensors'] and self.config.wunderground['sensors'][
                        lbl] is not None:
                tSens = self.config.wunderground['sensors'][lbl]
                if isinstance(tSens, list):
                    _highestValue = 0
                    _lowestValue = 999999999
                    for s in tSens:
                        if s is None:
                            break
                        # Get the first sensor that is not dead and find the sensor with the highest or the lowest value if requested
                        if never_assume_dead or isSensorAlive(s):
                            if getHighest:
                                _itemValue = getItemValue(s, 0)
                                if _itemValue > _highestValue:
                                    _highestValue = _itemValue
                                    sensorName = s
                            elif getLowest:
                                _itemValue = getItemValue(s, 0)
                                if _itemValue < _lowestValue:
                                    _lowestValue = _itemValue
                                    sensorName = s
                            else:
                                sensorName = s
                                break
                else:
                    if never_assume_dead or isSensorAlive(tSens):
                        sensorName = tSens

            if sensorName is not None:
                self.log.debug("Device used for " + unicode(lbl) + ": " +
                               sensorName)
            return sensorName

        self.log.setLevel(self.config.wunderground['logLevel'])

        global wu_loop_count
        sensor_dead_after_mins = self.config.wunderground[
            'sensor_dead_after_mins']  # The time after which a sensor is presumed to be dead
        if (not self.config.wunderground['stationdata']['weather_upload']) \
        or (self.config.wunderground['stationdata']['weather_upload'] and wu_loop_count%self.config.wunderground['stationdata']['upload_frequency'] == 0):
            if self.config.wunderground['stationdata']['weather_upload']:
                self.log.debug('Uploading data to Weather Underground')
            else:
                self.log.debug(
                    'No data to will be upladed to Weather Underground')

            sdf = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss")
            dateutc = sdf.print(DateTime.now((DateTimeZone.UTC)))

            tempf = None
            temp = None
            sensorName = getTheSensor('tempc', getLowest=True)
            if sensorName is not None:
                temp = Temp(
                    getItemValue(sensorName, 0.0), 'c'
                )  # Outdoor temp, c - celsius, f - fahrenheit, k - kelvin
                tempf = str(round(temp.f, 1))

            soiltempf = None
            sensorName = getTheSensor('soiltempc')
            if sensorName is not None:
                _temp = Temp(
                    getItemValue(sensorName, 0.0),
                    'c')  # Soil temp, c - celsius, f - fahrenheit, k - kelvin
                soiltempf = str(round(_temp.f, 1))

            humidity = None
            sensorName = getTheSensor('humidity')
            if sensorName is not None:
                humidity = getItemValue(sensorName, 0.0)

            dewptf = None
            heatidxf = None
            if humidity is not None and temp is not None:
                dewptf = str(
                    round(dew_point(temperature=temp, humidity=humidity).f,
                          1))  # calculate Dew Point
                heatidxf = str(
                    round(
                        heat_index(temperature=temp, humidity=humidity).f,
                        1))  # calculate Heat Index

            pressure = None
            sensorName = getTheSensor('pressurembar')
            if sensorName is not None:
                _mbar = getItemValue(sensorName, 0)
                if ((_mbar < 1070) and (_mbar > 920)):
                    pressure = str(mbar_to_inches_mercury(_mbar))

            rainin = None
            sensorName = getTheSensor('rainhour', never_assume_dead=True)
            if sensorName is not None:
                rainin = str(mm_to_inch(getItemValue(sensorName, 0.0)))

            dailyrainin = None
            sensorName = getTheSensor('raintoday', never_assume_dead=True)
            if sensorName is not None:
                dailyrainin = str(mm_to_inch(getItemValue(sensorName, 0.0)))

            soilmoisture = None
            sensorName = getTheSensor('soilmoisture')
            if sensorName is not None:
                soilmoisture = str(
                    int(round(getItemValue(sensorName, 0.0) * 100 / 1023)))

            winddir = None
            sensorName = getTheSensor('winddir')
            if sensorName is not None:
                winddir = str(getItemValue(sensorName, 0))

            windspeedmph = None
            sensorName = getTheSensor('windspeedms')
            if sensorName is not None:
                windspeedmph = str(ms_to_mph(getItemValue(sensorName, 0.0)))

            windgustmph = None
            sensorName = getTheSensor('windgustms')
            if sensorName is not None:
                windgustmph = str(ms_to_mph(getItemValue(sensorName, 0.0)))

            windgustdir = None
            sensorName = getTheSensor('windgustdir')
            if sensorName is not None:
                windgustdir = str(getItemValue(sensorName, 0))

            windspdmph_avg2m = None
            sensorName = getTheSensor('windspeedms_avg2m')
            if sensorName is not None:
                windspdmph_avg2m = str(ms_to_mph(getItemValue(sensorName,
                                                              0.0)))

            winddir_avg2m = None
            sensorName = getTheSensor('winddir_avg2m')
            if sensorName is not None:
                winddir_avg2m = str(getItemValue(sensorName, 0))

            windgustmph_10m = None
            sensorName = getTheSensor('windgustms_10m')
            if sensorName is not None:
                windgustmph_10m = str(ms_to_mph(getItemValue(sensorName, 0.0)))

            windgustdir_10m = None
            sensorName = getTheSensor('windgustdir_10m')
            if sensorName is not None:
                windgustdir_10m = str(getItemValue(sensorName, 0))

            solarradiation = None
            sensorName = getTheSensor('solarradiation', getHighest=True)
            if sensorName is not None:
                solarradiation = str(
                    lux_to_watts_m2(getItemValue(sensorName, 0)))

            # From http://wiki.wunderground.com/index.php/PWS_-_Upload_Protocol

            cmd = 'curl -s -G "' + WU_URL + '" ' \
                + '--data-urlencode "action=updateraw" ' \
                + '--data-urlencode "ID='+self.config.wunderground['stationdata']['station_id']+'" ' \
                + '--data-urlencode "PASSWORD='******'stationdata']['station_key']+'" ' \
                + '--data-urlencode "dateutc='+dateutc+'" ' \
                + '--data-urlencode "softwaretype=openHAB" '
            self.log.debug("")

            if self.config.wunderground['stationdata']['weather_upload']:
                self.log.debug("Below is the weather data that we will send:")
            else:
                self.log.debug(
                    "Below is the weather data that we would send (if weather_upload was enabled):"
                )

            if tempf is not None:
                cmd += '--data-urlencode "tempf=' + tempf + '" '
                self.log.debug("tempf: " + tempf)
            if humidity is not None:
                cmd += '--data-urlencode "humidity=' + str(humidity) + '" '
                self.log.debug("humidity: " + str(humidity))
            if dewptf is not None:
                cmd += '--data-urlencode "dewptf=' + dewptf + '" '
                self.log.debug("dewptf: " + dewptf)
            if heatidxf is not None:
                cmd += '--data-urlencode "heatidxf=' + heatidxf + '" '
                self.log.debug("heatidxf: " + heatidxf)
            if soiltempf is not None:
                cmd += '--data-urlencode "soiltempf=' + soiltempf + '" '
                self.log.debug("soiltempf: " + soiltempf)
            if soilmoisture is not None:
                cmd += '--data-urlencode "soilmoisture=' + soilmoisture + '" '
                self.log.debug("soilmoisture: " + soilmoisture)
            if pressure is not None:
                cmd += '--data-urlencode "baromin=' + pressure + '" '
                self.log.debug("baromin: " + pressure)
            if rainin is not None:
                cmd += '--data-urlencode "rainin=' + rainin + '" '
                self.log.debug("rainin: " + rainin)
            if dailyrainin is not None:
                cmd += '--data-urlencode "dailyrainin=' + dailyrainin + '" '
                self.log.debug("dailyrainin: " + dailyrainin)
            if winddir is not None:
                cmd += '--data-urlencode "winddir=' + winddir + '" '
                self.log.debug("winddir: " + winddir)
            if windspeedmph is not None:
                cmd += '--data-urlencode "windspeedmph=' + windspeedmph + '" '
                self.log.debug("windspeedmph: " + windspeedmph)
            if windgustmph is not None:
                cmd += '--data-urlencode "windgustmph=' + windgustmph + '" '
                self.log.debug("windgustmph: " + windgustmph)
            if windgustdir is not None:
                cmd += '--data-urlencode "windgustdir=' + windgustdir + '" '
                self.log.debug("windgustdir: " + windgustdir)
            if windspdmph_avg2m is not None:
                cmd += '--data-urlencode "windspdmph_avg2m=' + windspdmph_avg2m + '" '
                self.log.debug("windspdmph_avg2m: " + windspdmph_avg2m)
            if winddir_avg2m is not None:
                cmd += '--data-urlencode "winddir_avg2m=' + winddir_avg2m + '" '
                self.log.debug("winddir_avg2m: " + winddir_avg2m)
            if windgustmph_10m is not None:
                cmd += '--data-urlencode "windgustmph_10m=' + windgustmph_10m + '" '
                self.log.debug("windgustmph_10m: " + windgustmph_10m)
            if windgustdir_10m is not None:
                cmd += '--data-urlencode "windgustdir_10m=' + windgustdir_10m + '" '
                self.log.debug("windgustdir_10m: " + windgustdir_10m)
            if solarradiation is not None:
                cmd += '--data-urlencode "solarradiation=' + solarradiation + '" '
                self.log.debug("solarradiation: " + solarradiation)
            cmd += ' 1>/dev/null 2>&1 &'
            self.log.debug("")

            if self.config.wunderground['stationdata']['weather_upload']:
                self.log.debug('WeatherUpload version ' + SCRIPT_VERSION +
                               ', performing an upload. (loop count is: ' +
                               str(wu_loop_count) + ')')
                self.log.debug('cmd: ' + cmd)
                os.system(cmd)
        else:
            self.log.debug('WeatherUpload version ' + SCRIPT_VERSION +
                           ', skipping upload. (loop count is: ' +
                           str(wu_loop_count) + ')')

        if (wu_loop_count %
                self.config.wunderground['stationdata']['upload_frequency'] ==
                0):
            wu_loop_count = 0
        wu_loop_count = wu_loop_count + 1