Foscam app V2 (Appdaemon and HAdashboard)

i have the feeling the error is here:

def create_dashboard(self):
    try:
      dashboard = open(self.config["HADashboard"]["dash_dir"] + "/" + self.dashboardsettings["dashboard_file_name"] + ".dash", 'w')
      screenwidth = self.dashboardsettings["screen_width"]

HADashboard ???

seems like it wont fint the path to the dasboard folder

you get an indent error, so with editing you must have placed a space somewhere where it doesnt belong.

it should look like this:

  def create_dashboard(self):
    #try:
      dashboard = open(self.config["HADashboard"]["dash_dir"] + "/" + self.dashboardsettings["dashboard_file_name"] + ".dash", 'w')
      ....
      dashboard.close()
    #except:
      #self.log("dashboard couldnt be written", "ERROR")

i uploaded a new foscam.py
it has better error detection.

please download the new file.

Exactly what I sais:

pi@chilipie-kiosk:~/conf/logs$ tail -f /home/pi/conf/logs/appdaemon_error.log                                            
    init_object(name, class_name, module_name, conf.app_config[name])                                                    
  File "/usr/local/lib/python3.5/dist-packages/appdaemon/appdaemon.py", line 582, in init_object                         
    conf.objects[name]["object"].initialize()                                                                            
  File "/home/pi/conf/apps/foscam.py", line 146, in initialize                                                           
    self.create_dashboard()                                                                                              
  File "/home/pi/conf/apps/foscam.py", line 460, in create_dashboard                                                     
    self.log("tried to write: " + self.config["HADashboard"]["dash_dir"] + "/" + self.dashboardsettings["dashboard_file_n
ame"] + ".dash","ERROR")                                                                                                 
KeyError: 'dash_dir'                                                                                                     
                                                                                                                         
2017-10-11 09:51:24.296624 WARNING ------------------------------------------------------------                         

Do i precise the dashdir in appdaemon.yaml?

FIXED! it created the dashboards after adding dash_dir to appdaemon.yaml! GREAT!!! U might add this to docs as hash_dir is optional.

pi@chilipie-kiosk:~/conf/logs$ tail -f appdaemon.log                                                                     
2017-10-11 10:00:03.794174 INFO Starting dashboard                                                                       
2017-10-11 10:00:03.806304 INFO API is disabled                                                                          
2017-10-11 10:00:03.854460 INFO Connected to Home Assistant 0.55.0                                                       
2017-10-11 11:02:53.244943 INFO AppDaemon Version 2.1.9 starting                                                         
2017-10-11 11:02:53.245572 INFO Configuration read from: /home/pi/conf/appdaemon.yaml                                    
2017-10-11 10:02:53.396398 INFO Starting Apps                                                                            
2017-10-11 10:02:54.209828 INFO Got initial state                                                                        
2017-10-11 10:02:54.213652 INFO Loading Module: /home/pi/conf/apps/hello.py                                              
2017-10-11 10:02:54.216621 INFO Loading Module: /home/pi/conf/apps/foscam.py                                             
2017-10-11 10:02:54.238410 INFO Loading Object foscam using class foscam from module foscam                              
2017-10-11 10:03:45.028015 INFO foscam:  App started without errors                                                      
2017-10-11 10:03:45.098751 INFO App initialization complete                                                              
2017-10-11 10:03:45.100663 INFO Starting dashboard                                                                       
2017-10-11 10:03:45.124451 INFO API is disabled                                                                          
2017-10-11 10:03:45.187972 INFO Connected to Home Assistant 0.55.0 

great!
thanks i didnt know it was optional. i am now checking if there is another way to get that dir.
untill then ill make a note that that dir has to be set.
the small update i made last night should reveal more about the problem though.

Yeah! I didn’t get the chance to test it as I am not home. So I will see tonight :slight_smile: Will let you know! But anyway… Thanks a lot for your amazing work!

1 Like

One question… how can i realize tis :

http://appdaemon.readthedocs.io/en/latest/APIREFERENCE.html#id229

Wanna have some events showing certain dasboards

motion from cam sets off that the full screen dashboard is shown, when you have set that in the app.

if you want other events showing certain dashboards you need to use that command in an app.

that app could be like:

def initialize(bla bla):
  self.listen_state(self.activate_dash,"sensor.motion_outside")

def activate_dash(self ....):
  self.dash_navigate("full_screen_camera")

can i just add those codes in foscam.py?

could you give me an example please ? this snipped of code does not really help me :frowning:

no you cannot add that to foscam.py

you need to create a complete new app and use something like i wrote in there. (its just an not working example)

you can read the parts in the docs about how to create an app and you could read my

but remember that that was written for the old cfg style AD version.
oke updated those parts for the latest appdaemon version also.

hey Rene.

I got everysting setup but input sliders wont work and i cannot figure out why :frowning:

input selsct works fine so far . no error in hass log or appdaemon logs

did you use the newest version?

yes sir! I did. foscam.py with input:_number

please set loglevel to INFO and see what you get when you try to use the input_sliders.

INFO or more DEBUG?