Custom code and use GPS core functions with __salt__

Hi,
I just bought my AutoPi Gen 2 and i am starting, more or less, to know & understand how its working.
I ve connected it well to the cloud and can get some data throught the my.autopi.io website.
I ve started to build my own custom code. So i upload my code throught the cloud and it goes to my autopi dongle.
The code is bellow :

def get_location():
    args = []
    kwargs = {}
    return __salt__["ec2x.gnss_location"](2)

def help():
    return __salt__["sys.doc"]("rpi")

def printlocation():
    pprint(get_location())

If I ve tryed the cmd my_deux.help with the AutoPi.io Cloud Terminal it works well, it display the rpi doc.
But, if I lunch printlocation function throught ssh it replies that :

python my_deux.py
Traceback (most recent call last):
  File "my_deux.py", line 61, in <module>
    printlocation()
  File "my_deux.py", line 55, in printlocation
    pprint(get_location())
  File "my_deux.py", line 44, in get_location
    return __salt__["ec2x.gnss_location"](2)
NameError: global name '__salt__' is not defined

If i try to execute the function directly :

flood@308 $ ec2x.cell_location

'ERROR: {''reason'': ''731'', ''type'': ''CME''}'

flood@308 $ ec2x.cell_location

'ERROR: {''reason'': ''731'', ''type'': ''CME''}'

flood@308 $  ec2x.gnss_location

'ERROR: {''reason'': ''505'', ''type'': ''CME''}'

That’s not working too. What am i missing?
Thx

1 Like

I have same issue when I want to get position of my device I’m getting error:
β€˜{β€™β€˜reason’’: β€˜β€˜505’’, β€˜β€˜type’’: β€˜β€˜CME’’}’