GPS point for static object

#1

Hi
I would like to display a map on the dashboard with all my static objects and change the color of the pin based on the state of an attribute.
The issue is that the map dashboard seems really adapted to tracking and besides doing plenty of work around I don’t see how I can do that.
Thanks for your feedback - I might have missed something here!

0 Likes

#2

The best workaround for now is to use a workflow to add the device’s GPS location on an attribute each time state is reported.

You can set the device’s location on a tag. The device tags are provided on the Device State trigger. You can then use a Device State node to record the GPS location. You’ll need to add a new GPS attribute on your device for this to work. This will then allow you to use the GPS block as intended.

This is the high-level concept of how it could work. If you have trouble implementing this I’d be happy to provide an example workflow that shows it in more detail.

0 Likes

#3

Thanks - I was actually implementing this :wink: and bumped into an issue:
1/ I tried to do a simple stuff - putting the value of the tag in the attribute of the Device state
07 PM
But it doesn’t seem to work… I guessed it was a story about the type of data array vs string expected

2/ I did a function that would get the value from the tag, “string-it”
payload.data.values.gps=[];
payload.data.values.gps=payload.data.currentDevice.tags.gps.toString();
And then put this stringed value in the attribute.
21 PM
09 PM
It still doesn’t work.

I guess it s about a wrong type but for some reason I can’t find the issue here.
Thanks for your help!

0 Likes

#4

You need to use a string template in that field; currently you’re using a payload path.

Assuming you’re using a Device Get Node and you’ve checked the “Return tags as an object map instead of an array” box, and your tag key is “gps”, you’d reference that value as follows:

{{data.currentDevice.tags.gps.[0]}}

The .[0] on the end is because the tag’s values are returned as an array (since you can set multiple values for the same key) and we want the first one. This is assuming you’ve only set one “gps” tag on the device.

0 Likes