How to get currentValue


(Billmans) #1

Hello,

I have been working on my first app, and its working pretty good.

I have modified “It’s Too Cold” so I can have a temp range and get notified it we go above/below this range…works well.

My simple question as I try to see what else I can do is, how do I get the currentValue of the other sensors…? Do I need to subscribe, or when there is a temperature change, could I not just check the current value of the multi sensor to see the battery status, or the contact, or lqi etc? Just thinking if I am getting notified about the temp, why not add the battery status etc?

If I try this…

log.trace temperatureSensor1.currentValue(“battery”)

I get Null

If I try

log.trace temperatureSensor1.currentValue(“temperature”)

I get the temp…but only the temp works, none of the other sensors!?

Thoughts?


(Im Brian) #2

“battery” is not a registered property for a standard thermostat. You may have to create a custom device type based off the thermostat example, enhanced to have this additional property. I’ve been referencing this work to understand how custom device types are created: https://github.com/smartthings-users/device-type.nest/blob/master/nest.devicetype.groovy


(Billmans) #3

Thanks ImBrian,

I am actually trying to pull this from a Smartsense Multi sensor.

Within the sensor I can see these items under states.

Current States
acceleration: inactive
battery: 75 %
threeAxis: -7,9,1032
temperature: 72 F
lqi: 100 %
rssi: -26 dBm
contact: closed


(Im Brian) #4

https://smartthings.zendesk.com/entries/21603009-Device-Types-Capabilities-Attributes

Attributes represent the various properties or characteristics of a device. Generally speaking device attributes represent a current device state of some kind. For a temperature sensor, for example, ‘temperature’ might be an attribute. For a door lock, an attribute such as ‘status’ with values of ‘open’ and ‘closed’ might be a typical.

This works for me:

log.info(multi.latestValue("temperature"))

Where “multi” is defined as “device.SmartSenseMulti”