Page 1 of 1

Help With Conversion

PostPosted: Tue Jul 03, 2018 10:40 pm
by ckeyes888
Hoping it may be possible using the Device Extentions plugin to convert a device state like 100.00%, or less, to a simple integer, 100, 90, 5 etc? I'm trying to trigger from a luminance sensor value.
The state always includes the .00% at the end.

Thanks,

Carl

Re: Help With Conversion

PostPosted: Wed Jul 04, 2018 2:44 am
by howartp
Are you sure the value actually includes the %?

Indigo supports readings having two values. The raw value (eg 100) and the UI value (eg 100% or 100’c).

The figure you see will generally be the UI one, but try creating a trigger and you’ll often find it allows <100, >85 etc.


Sent from my iPhone using Tapatalk Pro

Re: Help With Conversion

PostPosted: Wed Jul 04, 2018 6:59 am
by Colorado4Wheeler
As Howard says, the % is generally a UI value, but you can still do this with DE by using the 'Convert to String' option and chopping off the last character. You can also use the String to Number conversion to get what you are looking for - which could be better since it will allow you to convert to an integer (no decimals) or a float (decimals) and you can decide how many decimal places you want it to have.

Screen Shot 2018-07-04 at 6.58.36 AM.png
Screen Shot 2018-07-04 at 6.58.36 AM.png (66.25 KiB) Viewed 673 times

Re: Help With Conversion

PostPosted: Wed Jul 04, 2018 10:03 am
by ckeyes888
The device state shows the % sign when using the sensorValue (UI Value), but not when just using sensorValue.
Seems to be working fine.

Thanks,

Carl

Re: Help With Conversion

PostPosted: Wed Jul 04, 2018 10:22 am
by Colorado4Wheeler
ckeyes888 wrote:
The device state shows the % sign when using the sensorValue (UI Value), but not when just using sensorValue.
Seems to be working fine.

Thanks,

Carl

Yup, that's exactly what you should be seeing.