Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help with updating location data #28

Open
Marshimellostu opened this issue Nov 4, 2020 · 4 comments
Open

Help with updating location data #28

Marshimellostu opened this issue Nov 4, 2020 · 4 comments

Comments

@Marshimellostu
Copy link

Hi thanks for creating this module. I wanted to use this module for my magic mirror car HUD and i wanted to get the coordinates (lat, lng) for my current location to be updated every few seconds. I have a txt file that has the coordinates to my current location in (lat, lng) numbers that updates every 5 seconds. Is there any way for me to read this data as input for the current location on the google-route module?

Sorry if I am asking a dumb question, I am regrettably not the best at coding. Thanks for any help and suggestion

@mrdis
Copy link
Owner

mrdis commented Nov 4, 2020

Hi, do you mean that the route should also be re-calculated every 5 seconds?
Because that would make you hit the api limits in a short time...

@Marshimellostu
Copy link
Author

Hi ok that true i will change the timing to every 10 minutes. The main question that I had was whether it would be possible for me to have the values of the origin lat and lng to be taken from a txt file?

directionsRequest:{
origin: '',
destination: ''

@mrdis
Copy link
Owner

mrdis commented Nov 5, 2020

If you use a js file instead of a txt file, you could write it for example as:

module.exports={
    origin: '<ROUTE START>',
    destination: '<ROUTE FINISH>'
}

and in your config.js you could have

        {
            module: 'MMM-google-route',
            position: 'top_left',
            config: {
                key: '<YOUR_KEY>',
                directionsRequest: require("<THE PATH TO THE JS FILE ABOVE>")
            }
        }

Anyway, you would still need to find a way to reload the module every ten minutes.

@Marshimellostu
Copy link
Author

Marshimellostu commented Nov 6, 2020

Oh that sounds promising! Yes i will try that. Thank you for the help and for making this module :)

I just wanted to clarify where I should place the module.export chunk?
And also to get it to reload the module could I use setInterval() in config.js?

Much appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants