[SOLVED] Advise on what this error means - 'unrecognized arguments'

Hi,

I am fairly new to AppDaemon but trying to get it to execute a simple py script that relies on a python package (Anki Vector SDK) that I have installed via configuration tab - I have also confirmed it is working: If I use Portainer to access the AppDaemon container after it has installed the package, I can run a simple py script (see below) via the console that sends Hello World to Vector.

import anki_vector


def main():
    args = anki_vector.util.parse_command_args()
    with anki_vector.Robot(args.serial) as robot:
        print("Say 'Hello World'...")
        robot.behavior.say_text("Hello World")


if __name__ == "__main__":
    main()

Now if I try to do the same via AppDaemon with a modified py script for when I fire an event called

VECTOR_EVENT

It will crash and go in a loop.

import appdaemon.plugins.hass.hassapi as hass
import anki_vector

class VectorWorld(hass.Hass):
  def initialize(self):
      self.listen_event(self.vector_event, "VECTOR_EVENT")
      
  
  def vector_event(self, event_name, data, kwargs):
      self.log("Vector SDK...")
      args = anki_vector.util.parse_command_args()
      with anki_vector.Robot(args.serial) as robot:
          robot.behavior.say_text("Hello World")

This is an extract from the logs:
2022-02-20 16:22:42.180979 INFO vector_test: Vector SDK…
usage: appdaemon [-h] [-s [SERIAL]]
appdaemon: error: unrecognized arguments: -c /config/appdaemon -D INFO
2022-02-20 16:22:42.714415 CRITICAL AppDaemon: Thread thread-0 has died
2022-02-20 16:22:42.721532 CRITICAL AppDaemon: Pinned apps were: [‘vector_test’]
2022-02-20 16:22:42.722532 CRITICAL AppDaemon: Thread will be restarted

What does the above in bold mean

I’ve been informed on the github page that AppDaemon cant handle when the SDK listens for arguments in command line.

Error message in AppDaemon · Issue #1481 · AppDaemon/appdaemon (github.com)

So removing this line which parses the serial number in util.py of the SDK python package.

args = anki_vector.util.parse_command_args()

Then manually entering the serial# like below has rectified the original error for ‘unrecognized arguments’.

import appdaemon.plugins.hass.hassapi as hass
import anki_vector

class VectorWorld(hass.Hass):
  def initialize(self):
      self.listen_event(self.vector_event, "VECTOR_EVENT")
      
  
  def vector_event(self, event_name, data, kwargs):
      self.log("Vector say Hello World...")
      serial_number = "00000000" #Your Serial Number here
      with anki_vector.Robot(serial_number) as robot:
          robot.behavior.say_text("Hello World")
1 Like