How can I send a variable derived from an Appdaemon app into a custom_component?
I want to do the following:
Create a custom_component
Use the users setting from config.yml and add them in the Appdaemon code (user_key and name_override should come from config.yaml of the custom_component)
Send the variable that I got in Appdaemon back to my custom_component state. (ATTR_BALANCE should show in the custom_components state)
Not sure if you were able to get this but it’s going to need a lot of work. I would move all of the scraping work into its own method and probably multiple methods for your case.
It is recommended against using time.sleep() in AppDaemon, it will tie up the thread, probably cause thread starvation and prevent other apps from running. If you need to wait some time before performing the next step, you’ll want to use the run_in() method or re-write the app as asynchronous, which isn’t recommended unless you’re experienced with AD.
You have run_hourly() but there is nothing within initialize() (or any other method besides the scheduler callback itself) calling the run_hourly() method and the signature for scheduler calls should be scheduled_callback(self, kwargs). Also, a scheduler callback wont return a handle but the scheduler method will, such as self.handle = self.run_hourly(self.scheduled_callback, 5)