Cannot assign sensor variables

Hi, I’ve asked my question before but I’ve investigated more and the question changed a bit. Hopefully someone can help me!

To boil it down:

  • I can add a paragraph to a page, and bind it to the gps latitude.
  • I CANNOT use logic on a button that copies the gps latitude to a page variable.

The result is always 0 when I try to do anything else than directly binding is to a paragraph.

I need the latitude and longitude to query a database for nearby restaurants. But if I use the sensor variables directly in the data variable, it does not work (data variable stops polling every 5 seconds). If I first try to copy it to a page variable and the use it, it does not work (returns 0).

Anyone ever experienced the same?

Regards,
Michiel

Are you using the Start Geolocation Poller flow function? Have you tried setting the Latitude, Longitude variables to the output from the GPS Location flow function and see what they return?

Hi,

Thanks for your answer. Yes, I had used the geolocation poller but found out that it works completely different from what I’d expect. I’ve not been able to find it out.

What I do now, which works, is use Get Location, repeat that every second, and from there I can assign these values to page variables and use those in a data variable. Shortcutting from gps sensor information directly to data variable does not work unfortunately.

Anyway, it works now, and if someone can explain what the poller is doing differently, I’d be much obliged :slight_smile:

1 Like

Yes, what I do is a loop as well and check the GPS Location output every iteration.

The idea behind the Start Geolocation Poller function is it automatically updates the sensor.geolocation variables at every interval you set, so when you go to check sensorVars.geolocation.latestValue.latitude or sensorVars.geolocation.latestValue.longitude, then you would get your latest values from there.

I think there had been an issue a while back where the GPS Location flow function wouldnt work unless you first ran the Start Geolocation Poller function, so I always got in the habit of running them both together. But I dont think that is case anymore.

Anyway, good to hear you got it working!

1 Like