Help With Conversion

Posted on
Tue Jul 03, 2018 10:40 pm
ckeyes888 offline
Posts: 2101
Joined: Nov 26, 2009
Location: Kalispell, MT

Help With Conversion

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

Posted on
Wed Jul 04, 2018 2:44 am
howartp offline
Posts: 3636
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Help With Conversion

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

Posted on
Wed Jul 04, 2018 6:59 am
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Help With Conversion

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 423 times

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Wed Jul 04, 2018 10:03 am
ckeyes888 offline
Posts: 2101
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Help With Conversion

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

Posted on
Wed Jul 04, 2018 10:22 am
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Help With Conversion

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.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest