Globals in app

In the AppDaemon examples there lists an Alexa app with the following

import appdaemon.appapi as appapi
import random
import globals

class Alexa(appapi.AppDaemon):

...
...
...

    def Wendy(self):
        location = self.get_state(globals.wendy_tracker)
        if location == "home":
            status = "Wendy is home,"
        else:
            status = "Wendy is away,"

        return status

Can anyone explain the use of get_state(globals.wendy_tracker)? How does this differ from get_state(device_tracker.wendy_tracker)?

I have a module called global that I store global values in so I only need to change them in one place.

1 Like