I have a 4-in-1 temperature/humidity/motion/illuminance sensor, and I want to get the past few temperature events in a smart app. When I do the following I get events for all attributes:
preferences {
section("Oil heater control:") {
input "tempSensor", "capability.temperatureMeasurement", required: true, title: "What temperature sensor?"
}
}
def initialize() {
subscribe(tempSensor, "temperature", temperatureHandler)
}
def temperatureHandler(evt) {
def temperatures = tempSensor.events(max: 4)
}
Is there a way I can pass in the name of the event (temperature) into the tempSensor.events()
call? Or do I have to manually track the history of the events (in a global variable or similar) I receive in the handler?