SmartThings Community

Is there a way to force a sensor to respond even if the value hasn’t changed?


#1

Have a few temp/humidity sensors dont report change unless there is an actual change. So in other words in my humidor there is a very stable humidity level. Graphing that value versus temperature causes me to loose the humidity since it didnt report a value due to no change. How do I make these devices report the value even if it has not changed?

I have tried pollster but for some reason it did not push those values out. It would refresh the sensor and the sensor was up to date in the app. But it would not post those values under its recent activity tab for them to then be exported by my simple event logger.

ps, sensors in question specifically are these units --> https://www.amazon.com/gp/product/B07BSXX5TD/ref=ppx_yo_dt_b_asin_title_o04__o00_s00?ie=UTF8&psc=1

Sorry if this is the wrong section to post this question btw.


#2

I’ve moved this to the webcore section of the forum because I’m pretty sure Webcore is the only way you’ll be able to do this.

There are many battery operated sensors which only report when there is a change in the value because that helps lengthen the battery life. And you don’t really want to change that because it will kill the batteries.

Instead, if it were me I would create a virtual sensor to mirror the physical sensor, do the reporting off of the virtual sensor, and keep the virtual sensor updated with the prior value if there has been no change.

That’s still pretty complicated, but I imagine the webcore experts could figure out how to do it. :sunglasses:

If you’re unfamiliar with webcore, it’s a community created rules engine for smartthings which is very powerful. And also very popular. You don’t have to be a programmer yourself: there are lots of community members who will be glad to help you set up the necessary rules. They even have their own forum.

The other alternative would be to make some modification to whatever you are using to graph it to pick up the previous value if the current value is null, but you didn’t mention what you are using for the graphing step.


#3

Thanks for the quick reply and proper section!

Understood on the battery life point, ideally I would like to report once every 6 hours or so which I imagine would not impact battery life that drastically.

I like the suggestion on the virtual sensor, is that a device I can find a published list already? Do not recall coming across one of those in my readings across the boards and in the app.

Webcore I think eventually is something that will solve this (and a number of other speedbumps) I currently have so will have to start reading up on it! Thanks for the link.


#4

This can definitely be done with webcore, for each temp change the humidity value can be polled from the device.


(Jimmy) #5

Which sensor and device handler are you using? There’s a good chance it is reporting the value, just not updating it since its the same. You can open live logging in the ide and see if it is communicating the reading every x minutes.


#6

Just starting with webcore, any tips or links I should look at to get my feet wet at writing one of these pistons?


#7

Using the centralite units and the basic device handlers that popped up when adding them in through the mobile app.


#8

EDIT, seeing this work now in the ST side but with a “refresh” off the piston the sensor does not actually restate its unchanged value. What other method might I use to get its unchanged value expressed again to show in its recent activity tab?

The way my graphing works is that the simple event logger smartapp reads the data off sensors and pushes that to an excel sheet from where I graph that data.


#9

You can edit the device handler to add displayed=true to have it post an event even if nothing changed. Is it using the SmartSense Temp/Humidity Sensor device handler?


#10

It is, where would I add that line in the device handler?

EDIT: poking around the device list a bit to see its handler and not seeing an edit function to its device handler info


#11

See below for some options depending on whether you want it for just temp, just humidity, or both

EDIT: Placing the map.display outside of the if is probably a bad idea, since the if is trapping for a null map. If you want both temp and humidity to post each time, just use both places that are still in the code below.

def parse(String description) {
	log.debug "description: $description"

	// getEvent will handle temperature and humidity
	Map map = zigbee.getEvent(description)
	if (!map) {
		Map descMap = zigbee.parseDescriptionAsMap(description)
		if (descMap.clusterInt == 0x0001 && descMap.commandInt != 0x07 && descMap?.value) {
			map = getBatteryResult(Integer.parseInt(descMap.value, 16))
		} else if (descMap?.clusterInt == zigbee.TEMPERATURE_MEASUREMENT_CLUSTER && descMap.commandInt == 0x07) {
			if (descMap.data[0] == "00") {
				log.debug "TEMP REPORTING CONFIG RESPONSE: $descMap"
				sendEvent(name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
			} else {
				log.warn "TEMP REPORTING CONFIG FAILED- error code: ${descMap.data[0]}"
			}
		}
	} else if (map.name == "temperature") {
//Add here for temp
map.displayed=true
		if (tempOffset) {
			map.value = (int) map.value + (int) tempOffset
		}
		map.descriptionText = temperatureScale == 'C' ? '{{ device.displayName }} was {{ value }}°C' : '{{ device.displayName }} was {{ value }}°F'
		map.translatable = true
	} else if (map.name == "humidity") {
//Add here for humidity
map.displayed=true
		if (humidityOffset) {
			map.value = (int) map.value + (int) humidityOffset
		}
	}

	log.debug "Parse returned $map"
	return map ? createEvent(map) : [:]
}

#12

You can grab the full code for the stock DH from the ST GitHub, and paste it in as a new device handler, or it might show up in the list if you create one from an example.


#13

Thank you very much for all of this! Trying to read this to understand exactly the changes this implicates and my question is what the interval of that value reported would be at this point? With this script would it report its value constantly or is there some sort of trigger?


(Jimmy) #14

It would report the value the same amount, but would now log that value every time, even if it’s the same.


#15

It currently only reports it if there has been a change as opposed to a set interval it seems. So in this new scenario what would be the trigger to initiate the report?


(Jimmy) #16

The sensor does report currently. It is set in the configuration when pairing to check in the temperature every 5 minutes max and humidity every 60 minutes max. Create and new device handler by model and make the changes outlined above.


#17

Getting this error when trying to create a new device handler, any idea what I might be doing wrong?

“Org.springframework.security.access.AccessDeniedException: Run Locally Permission not allowed for DeviceType: 9074708a-f348-48e8-9407-f819d48f597f”

Also I am still intrigued by possibly using webcore for this, anyone have any insight into how a piston might accomplish a similar task? Looking for a data report every 6 hours or so even.


(Jimmy) #18

Change run locally to false in the metadata at the beginning.


#19

I don’t think webcore is a way to solve this. ST by default only posts the event to recent activity if there was a change. Getting webcore to query more will still hit that issue.


#20

Thanks all for the help in my first foray of code editing! This is what I ended up with, does this look correct?

// getEvent will handle temperature and humidity
Map map = zigbee.getEvent(description)
if (!map) {
	Map descMap = zigbee.parseDescriptionAsMap(description)
	if (descMap.clusterInt == 0x0001 && descMap.commandInt != 0x07 && descMap?.value) {
		map = getBatteryResult(Integer.parseInt(descMap.value, 16))
	} else if (descMap?.clusterInt == zigbee.TEMPERATURE_MEASUREMENT_CLUSTER && descMap.commandInt == 0x07) {
		if (descMap.data[0] == "00") {
			log.debug "TEMP REPORTING CONFIG RESPONSE: $descMap"
			sendEvent(name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
		} else {
			log.warn "TEMP REPORTING CONFIG FAILED- error code: ${descMap.data[0]}"
		}
	}
} else if (map.name == "temperature") {
map.displayed=true
	if (tempOffset) {
		map.value = (int) map.value + (int) tempOffset
	}
	map.descriptionText = temperatureScale == 'C' ? '{{ device.displayName }} was {{ value }}°C' : '{{ device.displayName }} was {{ value }}°F'
	map.translatable = true
} else if (map.name == "humidity") {
map.displayed=true
	if (humidityOffset) {
    			map.value = (int) map.value + (int) humidityOffset
	}
}