AppDaemon does not see new entities till module is reloaded

Yes I did see the errors earlier but then it stopped. so I thought I fixed it. : |

2018-07-14 14:48:56.919257 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 590, in worker
    self.sanitize_state_kwargs(app, args["kwargs"]))
TypeError: AutoGenGroup() takes 1 positional argument but 6 were given




2018-07-17 12:11:48.864366 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 1575, in init_object
    init()
  File "/config/appdaemon/apps/groups.py", line 34, in initialize
    time = datetime.time(0, 0, 0)
TypeError: descriptor 'time' requires a 'datetime.datetime' object but received a 'int'

those errors are from your initialise.
in that case the app stops and never runs at all.

every time you edit an app and save it you should look at your errorlog.
if there is an error you need to repair that, until it starts without creating an error.
untill that the app wont run at all, or not like you want.

Thanks Rene.
Just to clarify a few things, I recorded this:
https://traviswu.tinytake.com/sf/Mjc4NDMwNV84MzU1MjA1

The tmux windows on the right are: tail -f appdaemon.log (top) and tail -f appdaemonError.log(bottom). You should be able to see there was no error in my existing code till later when I purposely making one.

sorry, but your way of working is unfamiliar to me.
and its going to fast to see what you are actually doing.

the things you try to do wont work for the reasons i explained.
you cant use the same callback for a listen_state and a run_hourly. thats just impossible and the error you got showed that.

so you need to create 2 callbacks for that. and they (if needed) can point to another function.

i am not familiar with the commands vi or touch. but the error

TypeError: AutoGenGroup() takes 1 positional argument but 6 were given

should appear every time unless another error stops the app before the run_hourly line. (for instance when you got the time typeerror)

place this line:

self.log("the app is initialised correctly")

at the end of the initialise function and when that message appears in your “normal” log, you will now that the app is initialsed and running.

thanks for the pointer. It seems to be running fine without errors with my current code. So I guess everything should be ok now?

code:

  def initialize(self):                                            
      runtime = datetime.now()                                     
      self.run_hourly(self.AutoGenGroup, runtime.time())    
      self.AutoGenGroup()                                                                              │
      self.log("the app is initialized correctly")

Log:

2018-07-23 19:14:17.877969 INFO a_group: AutoGenGroup ran
2018-07-23 19:14:17.884202 WARNING AppDaemon: a_group: Entity group.Tracking not found in AppDaemon
2018-07-23 19:14:17.974979 INFO a_group: the app is initialized correctly
2018-07-23 19:14:17.978174 INFO AppDaemon: App initialization complete

yeah that should be oke.

Rene,
just wanna say thank you again for all the help. Love the learning process and now I have my project finished! .

Cheers.

1 Like