Fraction of Unit in "Distance Above/BeloW" condition in Scene's Creation

Hi everybody and thanks for sharing your knowledge here…
For a beginner like me it is INVALUABLE…

Did a search, but I’m not able to find any reference to my problem… hope you can help…

Just trying to set a scene that announces my arrival at home location… a very basic one…

Problem is, as far as I keep my “Distance goes below:” at an integer value (i.e. setting at “1”…) the scene seems to work fine…

But, without changing anything else, if I set that value to “0.5” or “0,5” or “.5” (For instance…) the scene stops firing altogether…

For the sake of me, can’t understand the reason why…

BTW I’m using Km, if that matters…

Any hint would be greatly appreciated…
Thanks in advance, guys, and sorry for posing such a trivial question… Do I have already said I’m a beginner? :wink:
Ciao!
Joe

I a doing exactly the same thing and in km as well and my scene is working fine. Are you doing this on a Vera? How is your trigger set?

Hi Rafale77, and thanks for your comments…

Actually, I already replied here yesterday but, for some reasons, my comment doesn’t appear and I’m re-writing…

Ok…

Yes, Rafale, I’m doing this in Vera… If I remember well, you recently migrated to openLuup and using your Vera as a simple Z_Wave Bridge now…

As I’m just getting my feet wet with Scene Creation, I’m keeping it simple…
This is a Cut-And-Paste from the Scene’s Trigger part:

Step 1: Select a Trigger
1 Device Trigger
XXXXXXX distance goes below 1 unit
Step 2: Device Actions
Immediately
Hue Iris 1 Level 75%… (1 more)

And, as the Distance is set at “1”, it is firing correctly…

This doesn’t happen if I select a decimal to have the scene fire at less than 1 Km…

Still scratching my head…

TU for any Further comment…
Joe

I am suspecting an issue with the formating of the variable in the scene editor. Unfortunately, as you noticed, I migrated this plugin to OpenLuup which uses a variable watch instead of a trigger and enables me to write the logic in lua. I thought your formatting issue was within the plugin itself which I use as well and accepts the decimal. I could offer a workaround by adding a variable watch in your startup lua to trigger this scene if the condition is met…

Thanks Again Rafale77…

Any simple way I can check the variable manually, after I have set it in the Scene Editor, so I can see what’s actually written by the Editor?

And, BTW, I’m interested in the workaround… Not sure I’ll understand fully what to do at this beginner stage, but I’m going to try…

I have no immediate plans to abandon Vera, as I just started, so…

Thanks a lot!
Joe

Here is the code To add to your startup lua:

Note first the scene number you want to execute and the device number of your iPhone locator. You will need to place them in the code below.

function distscene()
local lim = ## your limit##
local distance = luup.variable_get("urn:upnp-org:serviceId:IPhoneLocator1","Distance",##iphonelocator device number##)
local scn = ##your scene number##
If tonumber(distance) > lim then
luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1", "RunScene", {SceneNum = scn})
end
end

luup.variable_watch("distscene","urn:upnp-org:serviceId:IPhoneLocator1","Distance",##iphonelocator device number##)

This should work but I am travelling and typing from an iPad so I couldn?t test it

Thank you again Rafale 77…

I’m travelling myself these days, but I’ll try the code in the weekend…

Help very appreciated!

Ciao!
Joe