Foscam app V2 (Appdaemon and HAdashboard)

i did want to integrate older type foscam cameras also, but because i lost my testing person, i didnt want to wait any longer and released it only for newer type cameras.

the pics to make you want it:

V1 already had:
control functions for

  • zoom
  • movement left, right, up, down
  • picsettings like sharpness, hue, brightness
  • motion sensor
  • snap picture button
  • mirror and flip
  • goto preset
  • start cruise

the new app has also:

  • latest error in dashboard and HA group
  • automatic generated dashboards
  • alarm dashboard (big screen view on motion)
  • better error detection
  • possibility to use it for none PTZ cams
  • dashboard creation based on tablet width and height

you can find all information about it on
https://github.com/ReneTode/My-AppDaemon/tree/master/apps/foscam_app_v2

do you have another type of cam and you tried the CGI command and it works, please let me know!

5 Likes

pi@chilipie-kiosk:~/conf/logs$ tail -f appdaemon_error.log
2017-10-11 00:51:48.830596 WARNING Traceback (most recent call last):
File “/usr/local/lib/python3.5/dist-packages/appdaemon/appdaemon.py”, line 911, in read_app
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 37, in initialize
self.logsettings = self.args[“logsettings”]
KeyError: ‘logsettings’

And i cannot find the dashboard… it is not created

its not created because of the error.

what do you have in apps.yaml?
seems that you miss the section logsettings:

o! did not save it :stuck_out_tongue:

but now i get:

2017-10-11 01:17:14.822061 INFO Loading Object foscam using class foscam from module foscam
2017-10-11 01:17:14.824500 WARNING foscam: Entity input_slider.foscam_brightness not found in Home Assistant
2017-10-11 01:17:14.825382 WARNING foscam: Entity input_slider.foscam_contrast not found in Home Assistant
2017-10-11 01:17:14.826165 WARNING foscam: Entity input_slider.foscam_hue not found in Home Assistant
2017-10-11 01:17:14.826938 WARNING foscam: Entity input_slider.foscam_saturation not found in Home Assistant
2017-10-11 01:17:14.827710 WARNING foscam: Entity input_slider.foscam_sharpness not found in Home Assistant

i took version 0.55 but it seems i have to rename again?=

2017-10-11 01:18:05.647740 ERROR foscam: dashboard couldnt be written
2017-10-11 01:18:05.651474 ERROR foscam: alarm dashboard couldnt be written
2017-10-11 01:18:05.654810 INFO foscam:  App started without errors
2017-10-11 01:18:05.655530 WARNING foscam: Entity sensor.foscam_last_error not found in Home Assistant
2017-10-11 01:18:05.744292 INFO App initialization complete
2017-10-11 01:18:05.745314 INFO Starting dashboard
2017-10-11 01:18:05.757444 INFO API is disabled
2017-10-11 01:18:05.829628 INFO Connected to Home Assistant 0.55.0
2017-10-11 01:18:12.425154 INFO New dashboard connected: IP Cams
2017-10-11 01:18:44.712723 INFO Dashboard disconnected
2017-10-11 01:19:18.461296 INFO function [get_dashboard] finished in 135 ms
2017-10-11 01:19:20.003359 INFO New dashboard connected: IP Cams

you took the wrong one.
0.55 has already renamed settings

it could be that appdaemon has no writing acces to your dashboard dir.

i start appdaemon with sudo and i took indeed version 0.55 :frowning:

strange because in 0.55 i really have input_number and not input_slider.

but the app is working now except for the dashboard.
it seems like you have chosen a name with a space in it? dashboardnames cant have spaces.

nope… i took YOUR settings 1 to 1

please post your part from apps.yaml
i dont have any dashboard name set in it so you must have chosen that or it is empty.

foscam:
  class: foscam
  module: foscam                           # the name of the py file you added to your apps
  camsettings:
    camera_type: F19828P V2                # give 1 of the known camera types
    camera_name: yourcam                   # the name you gave it in home assistant
    host: 192.168.1.201                    # the ip address from your cam
    port: '88'                             # the port from your cam (default is 88)
    password: hass                         # password set for the cam (no strange symbols allowed)
    user: hass                             # the username you use for the cam
  logsettings:
    loglevel: WARNING                      # setting this to INFO gets more info in the log
    logsensorlevel: WARNING                # the app creates a sensor with the last info. level can be changed
    last_error_sensor: sensor.foscam_last_error # the sensor is created automaticly
  picsettings:                             # these settings need to be created in home assistant (see below)
    brightness_slider: input_slider.foscam_brightness 
    contrast_slider: input_slider.foscam_contrast
    hue_slider: input_slider.foscam_hue
    saturation_slider: input_slider.foscam_saturation
    sharpness_slider: input_slider.foscam_sharpness
    default_pic_settings_switch: input_boolean.foscam_default_picture_settings
    flip_switch: input_boolean.foscam_flip
    mirror_switch: input_boolean.foscam_mirror
    auto_infrared_switch: input_boolean.foscam_auto_infrared
    infrared_switch: input_boolean.foscam_infrared
  ptzsettings:                             # these settings need to be created in home assistant (see below)
    left_right_slider: input_slider.foscam_left_right
    up_down_slider: input_slider.foscam_up_down
    start_cruise_select: input_select.foscam_preset_cruise
    stop_cruise_switch: input_boolean.foscam_stop_cruise
    zoom_slider: input_slider.foscam_zoom
    preset_points_select: input_select.foscam_preset_points
  alarmsettings:
    motion_sensor: sensor.foscam_motion    # the sensor is created automaticly
    motion_switch: input_boolean.foscam_motion_detect # also needs to be created in home assistant
    soundalarm_sensor: sensor.foscam_sound_alarm  # the sensor is created automaticly
    sensor_update_time: '10'               # the amount of time in seconds between checks from the cam
  recordsettings:
    snap_picture_switch: input_boolean.foscam_snap_picture_now  # also needs to be created in home assistant
    recording_sensor: sensor.foscam_recording  # the sensor is created automaticly
    save_snap_dir: /home/pi/foscam_snap/   # the dir where you want manual snapshots to be saved
  dashboardsettings: 
    use_dashboard: True                    # if this is set to False no dashboards will be created or used
    create_dashboard: True                 # creates a dashboard in your dashboard directory on initialize from the app
    create_alarm_dashboard: True           # creates an alarm dashboard
    dashboard_file_name: foscam            # the name that your dashboard gets
    alarm_dashboard_file_name: foscam_fullscreen # the name that the alarm dashboard gets
    screen_width: 1024                     # the screenwidth you want to use for your dashboard
    screen_height: 600                     # the screenheight you want to use for your dashboard
    show_full_screen_dashboard: True       # if you dont want to use the alarm dashboard set it to False
    full_screen_alarm_switch: input_boolean.foscam_toon_alarm_dash # a boolean to silence the alarmdashboard temperary
    time_between_shows: 60                 # minimum time in seconds between showing alarm dashboards
    show_time: 30                          # the amount of seconds the alarm keeps active

and as u can see… there are SLIDERS in it :frowning:

OK! I dunno what happened but i re copied the apps.yaml but dashboard cannot be created :frowning:

  dashboardsettings: 
    use_dashboard: True
    create_dashboard: True
    create_alarm_dashboard: True
    dashboard_file_name: foscam
    alarm_dashboard_file_name: foscam_alarm
    screen_width: 1024
    screen_height: 600
    show_full_screen_dashboard: True
    full_screen_alarm_switch: input_boolean.foscam_toon_alarm_dash
    time_between_shows: 60
    show_time: 30

you didnt read everything :wink:

in your apps.yaml create a new section with these arguments: (can be found in add_to_apps.yaml)

but oke :wink:

then you need to change the sliders to numbers.
there should be a file foscam.dash in your dashboard dir created.

if after all changes the dashboard still doesnt get created edit out these lines in the app in def create_dashboard:

    try:

    except:
      self.log("dashboard couldnt be written", "ERROR")

just put an # before it.
then restart and see whats in the errorlog.

in which file exactly?
foscam.dash has not been created indeed

in foscam.py
you find those lines on line 371, 452 and 453

pi@chilipie-kiosk:~/conf/logs$ tail -f /home/pi/conf/logs/appdaemon_error.log
  File "<frozen importlib._bootstrap_external>", line 661, in exec_module
  File "<frozen importlib._bootstrap_external>", line 767, in get_code
  File "<frozen importlib._bootstrap_external>", line 727, in source_to_code
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/pi/conf/apps/foscam.py", line 456
    def create_alarm_dashboard(self):
    ^
IndentationError: unexpected unindent