elfege
July 30, 2019, 5:34pm
1
Has anyone successfully used the getUnit() method? If so, how? My way (learned from ST's doc) doesn't work, while this very same code with the same device returned "lux" in ST, at least as far as I can remember...
def latest = sensor.currentState("illuminance")
log.debug "unit: ${latest.unit}"
On my my sensors (Aeon Multisensor 6), this returns "null"...
1 Like
Sorry can't help, but switched your post to developers and tagged methods. Should get a response.
May I ask why you need the unit? Illuminance is in Lux in HE. That is the unit that shows up on a dashboard if you pick the Illuminance Tile.
1 Like
Seems like a bug in Hubitat. currentState(...).unit
or latestState(...).unit
returns null
for all of my devices. I wonder if it is going to be fixed.
elfege
January 25, 2020, 5:04pm
5
Some devices return it in %, in ST at least and at the time of that post I was still porting my code from ST to HE.
Weird.. Illuminance % doesnβt make sense .. 0% would obviously mean no light.. But 100% would be an arbitrary value
elfege
January 25, 2020, 5:16pm
7
It actually makes sense so the device handler reevaluates its maxima so the app doesn't have to it (as my app does it now).