Anyone have the Aeotec AerQ?

My pleasure, I'm honored someone would be using my small App :slight_smile:

It's been a while but I don't think I went back and "fixed" a startup issue where the Dew point is 50 until the first actual reading is made.

To report Dew Point I created a Virtual Dew Point device. No inputs are needed it is only used to display the results.

/*
Dew Point App V003

2020-07-05
    Think we don't need to store the lastTEMP and lastHUMID.  We can just read them when we need to make a calc.
2020-07-20 (open) added Virtual DewPoint Calc device to display the below results.

*/

definition(
    name: "DEW Point Calculator",
    namespace: "hubitat",
    author: "JohnRob",
    description: "DEW Point Calculator",
    category: "Convenience",
    iconUrl: "",
    iconX2Url: "")

preferences {
    page(name: "mainPage")
}

def mainPage() {
    dynamicPage(name: "mainPage", title: " ", install: true, uninstall: true) {
        section {
            //log.debug ("   25   beginning of section")
            input "thisName", "text", title: "Name this DEW Point Calculator", submitOnChange: true
            if(thisName) app.updateLabel("$thisName")
            input "tempSensor", "capability.temperatureMeasurement", title: "Select Temperature Sensor", submitOnChange: true, required: true,     multiple: false
            input "humidSensor", "capability.relativeHumidityMeasurement", title: "Select Humidity Sensor", submitOnChange: true, required:     true, multiple: false
            //log.debug ("  30   end of section")
        } // section
    }   // dymanicPage
}   // mainPage

def installed() {
    initialize()
}

def updated() {
    unsubscribe()
    initialize()
}

def initialize() {
    //log.debug ("  45   begin initialize")

    def dewpointDev = getChildDevice("DEWPoint_${app.id}")
    if(!dewpointDev) dewpointDev = addChildDevice("hubitat", "Virtual DewPoint", "DEWPoint_${app.id}", null, [label: thisName, name: thisName])
    dewpointDev.setDewPoint(0)
    subscribe(tempSensor, "temperature", handlerTEMP)
    subscribe(humidSensor, "humidity", handlerHUMID)

    state.lastHUMID = 50        // these are in the app and will not display in the child
    state.lastTEMP = 50     //  50/50 DEWPoint = 32
}

def calcDEW() {
    def dewpointDev = getChildDevice("DEWPoint_${app.id}")
    //log.debug "  56 state.lastTEMP ${state.lastTEMP}"
    //log.debug "  57 state.lastHUMID ${state.lastHUMID}"
    operandHUMID = state.lastHUMID.toDouble()
    operandTEMP = state.lastTEMP.toDouble()
    
    def dewPoint = (operandTEMP - (9 / 25) * (100 - operandHUMID))
    //log.debug "   62  dewPoint =     ${dewPoint}"
    dewpointDev.setDewPoint(dewPoint.toInteger())
    //return
}

def handlerHUMID(evt) {
    state.lastHUMID = evt.value
    //log.debug " 65 last Humidity = ${evt.value}"
   calcDEW()
}

def handlerTEMP(evt) {
    state.lastTEMP = evt.value
    //log.debug " 71 last Temperature = ${evt.value}"
   calcDEW()
}

//  --- eof ---


//tempSensor.currentTemperature
//humidSensor.currentHumidity
5 Likes