Foscam app V2 (Appdaemon and HAdashboard)

I figured out the problem with the presets lmao. Somehow I forgot to add the input_select’s :man_facepalming::man_facepalming::man_facepalming:
I honestly don’t know how I forgot that haha.
Still haven’t figured out how to use them but they’re showing now at least.

I was able to get the picture to save by adding the directory too.
Only thing not working is the mirror but honestly isn’t a big deal at all for me.

1 Like

Hi Rene
I just installed the app but have some problems getting the dashboard created.
In Home Assistant I can see the camera and control it (PTZ at least), but the dashboard does not work. I’ve several dashboards already working, so I dont know whats wrong with my configuration.

Any advice will be highly appreciated.

This is my log file:

2018-05-27 21:21:38.570380 INFO AppDaemon Version 2.1.12 starting
2018-05-27 21:21:38.571107 INFO Configuration read from: /home/homeassistant/.homeassistant/conf/appdaemon.yaml
2018-05-27 21:21:38.590580 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2018-05-27 21:21:43.604035 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2018-05-27 21:21:48.616833 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2018-05-27 21:21:53.625652 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2018-05-27 21:21:58.635661 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2018-05-27 21:22:10.460681 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2018-05-27 21:22:15.473416 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2018-05-27 21:22:21.282256 INFO Starting Apps
2018-05-27 21:22:21.576811 INFO Got initial state
2018-05-27 21:22:21.578552 INFO Loading Module: /home/homeassistant/.homeassistant/conf/apps/foscam.py
2018-05-27 21:22:21.596434 INFO Loading Object foscam using class foscam from module foscam
2018-05-27 21:22:22.546961 WARNING foscam: I cant read motion detect settings, motion detect switch disabled
2018-05-27 21:22:22.547752 WARNING foscam: Entity sensor.foscam_last_error not found in Home Assistant
2018-05-27 21:22:22.645053 WARNING foscam: Entity sensor.foscam_motion not found in Home Assistant
2018-05-27 21:22:22.649111 ERROR foscam: unexpected error: dashboard couldnt be written
2018-05-27 21:22:22.652648 WARNING Logged an error to /home/homeassistant/.homeassistant/conf/log/error.log
2018-05-27 21:22:22.653014 INFO App initialization complete
2018-05-27 21:22:22.653737 INFO Starting dashboard
2018-05-27 21:22:22.677582 INFO API is disabled
2018-05-27 21:22:22.761880 INFO Connected to Home Assistant 0.64.3
2018-05-27 21:22:26.224067 WARNING foscam: Entity sensor.foscam_motion not found in Home Assistant
2018-05-27 21:22:26.274931 WARNING foscam: Entity sensor.foscam_sound_alarm not found in Home Assistant
2018-05-27 21:22:26.326131 WARNING foscam: Entity sensor.foscam_recording not found in Home Assistant
2018-05-27 21:22:53.513740 INFO function [get_dashboard] finished in 145 ms
2018-05-27 21:22:53.838751 INFO New dashboard connected: Inicio
2018-05-27 21:22:55.729791 INFO function [get_dashboard] finished in 133 ms
2018-05-27 21:22:55.746473 INFO Dashboard disconnected
2018-05-27 21:22:55.908205 INFO New dashboard connected: Inicio
2018-05-27 21:22:58.411598 INFO function [get_dashboard] finished in 125 ms
2018-05-27 21:22:58.425131 INFO Dashboard disconnected
2018-05-27 21:22:58.693222 INFO New dashboard connected: Inicio
2018-05-27 21:23:58.684400 INFO function [get_dashboard] finished in 137 ms
2018-05-27 21:23:58.722975 INFO Dashboard disconnected
2018-05-27 21:23:58.978754 INFO New dashboard connected: Inicio
2018-05-27 21:36:46.318294 WARNING foscam: Changing motion detect is disabled
2018-05-27 21:37:29.902022 INFO AppDaemon Version 2.1.12 starting
2018-05-27 21:37:29.903240 INFO Configuration read from: /home/homeassistant/.homeassistant/conf/appdaemon.yaml
2018-05-27 21:37:29.922728 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2018-05-27 21:37:34.935801 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2018-05-27 21:37:39.947403 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2018-05-27 21:37:44.960364 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2018-05-27 21:37:49.973470 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2018-05-27 21:37:54.987406 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2018-05-27 21:38:00.005851 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2018-05-27 21:38:12.212222 INFO Starting Apps
2018-05-27 21:38:12.583365 INFO Got initial state
2018-05-27 21:38:12.585040 INFO Loading Module: /home/homeassistant/.homeassistant/conf/apps/foscam.py
2018-05-27 21:38:12.600525 INFO Loading Object foscam using class foscam from module foscam
2018-05-27 21:38:13.696246 WARNING foscam: Entity sensor.foscam_motion not found in Home Assistant
2018-05-27 21:38:13.918993 ERROR foscam: unexpected error: dashboard couldnt be written
2018-05-27 21:38:13.923939 WARNING Logged an error to /home/homeassistant/.homeassistant/conf/log/error.log
2018-05-27 21:38:13.924301 INFO App initialization complete
2018-05-27 21:38:13.925035 INFO Starting dashboard
2018-05-27 21:38:13.943959 INFO API is disabled
2018-05-27 21:38:13.979081 INFO Connected to Home Assistant 0.64.3
2018-05-27 21:38:15.001730 WARNING Scheduler clock skew detected - delta = 1.0016579627990723 - resetting
2018-05-27 21:38:17.128925 WARNING foscam: Entity sensor.foscam_motion not found in Home Assistant
2018-05-27 21:38:17.156367 WARNING foscam: Entity sensor.foscam_sound_alarm not found in Home Assistant
2018-05-27 21:38:17.179469 WARNING foscam: Entity sensor.foscam_recording not found in Home Assistant
2018-05-27 21:38:20.883496 INFO New dashboard connected: Inicio

And my error file as well

2018-05-27 21:22:22.649719 WARNING ------------------------------------------------------------
2018-05-27 21:22:22.650239 WARNING Unexpected error during loading of foscam:
2018-05-27 21:22:22.650628 WARNING ------------------------------------------------------------
2018-05-27 21:22:22.651739 WARNING Traceback (most recent call last):
File “/home/homeassistant/.homeassistant/conf/apps/foscam.py”, line 416, in create_dashboard
with open(self.config[“HADashboard”][“dash_dir”] + “/” + self.dashboardsettings[“dashboard_file_name”] + “.dash”, ‘w’) as dashboard:
KeyError: ‘dash_dir’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.5/dist-packages/appdaemon/appdaemon.py”, line 912, 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 583, in init_object
conf.objects[name][“object”].initialize()
File “/home/homeassistant/.homeassistant/conf/apps/foscam.py”, line 154, in initialize
self.create_dashboard()
File “/home/homeassistant/.homeassistant/conf/apps/foscam.py”, line 622, in create_dashboard
self.log("tried to write: " + self.config[“HADashboard”][“dash_dir”] + “/” + self.dashboardsettings[“dashboard_file_name”] + “.dash”,“ERROR”)
KeyError: ‘dash_dir’

2018-05-27 21:22:22.652247 WARNING ------------------------------------------------------------
2018-05-27 21:38:13.919665 WARNING ------------------------------------------------------------
2018-05-27 21:38:13.921422 WARNING Unexpected error during loading of foscam:
2018-05-27 21:38:13.921934 WARNING ------------------------------------------------------------
2018-05-27 21:38:13.923079 WARNING Traceback (most recent call last):
File “/home/homeassistant/.homeassistant/conf/apps/foscam.py”, line 416, in create_dashboard
with open(self.config[“HADashboard”][“dash_dir”] + “/” + self.dashboardsettings[“dashboard_file_name”] + “.dash”, ‘w’) as dashboard:
KeyError: ‘dash_dir’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.5/dist-packages/appdaemon/appdaemon.py”, line 912, 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 583, in init_object
conf.objects[name][“object”].initialize()
File “/home/homeassistant/.homeassistant/conf/apps/foscam.py”, line 154, in initialize
self.create_dashboard()
File “/home/homeassistant/.homeassistant/conf/apps/foscam.py”, line 622, in create_dashboard
self.log("tried to write: " + self.config[“HADashboard”][“dash_dir”] + “/” + self.dashboardsettings[“dashboard_file_name”] + “.dash”,“ERROR”)
KeyError: ‘dash_dir’

2018-05-27 21:38:13.923552 WARNING ------------------------------------------------------------

Thanks in advance for your support. I always try to read and search deeply before asking, but now I dont know whats wrong.

you are running an old version from appdaemon.
this app is rewritten for appdaemon 3 and you are running the deprecated version appdaemon 2

Hi Rene
I used your App V2, not the last one.

ah oke, it deprecated but i just looked again and saw the problem.
from the raeadme:

it also expects that you have set the setting dash_dir in appdaemon.yaml Default this is pointing to the dir /path/to/conf/dashboards if you didnt set it. But if you want this app to create dashboards it needs that setting. for more info about setting the dash_dir see the appdaemon documentation.

I added the dash_dir to my appdaemon.yaml already. Even that, no dashboard is being created at all.
Any idea?

please show me your appdaemon.yaml, because the error says that you didnt add it.
and obviously when the app hass no clue where to save the dashboards, it cant create it.

did you restart appdaemon after you added the dash_dir, and did you place dash_dir on the right place(in the hadashboardsection)?

Hi, sorry for what could be a noob question.

I have 3 foscam C1 v3 cameras all working in Home-Assistant and 1 correctly working with Foscam App.

How can I add the remaining 2 changing the name from generic “foscam” to custom name?

Thank you
Flavio

you can add a new yaml file that has the same yaml as the foscam.yaml

then you change every place you see foscam to the new name.
except for module and class!

and in HA you add the entities that you need also with the new name.

Wow: Superfast answer!

Thank you

1 Like

Hi,

I want to use camera Appdaemon 3 Dashboards with Foscam-app.
Can someone help me to solve an issue with generation of a dashboard?
Error message in logs is:
ERROR foscam: unexpected error: dashboard couldnt be written

Dashboard file is created but it’s empty.
-rwxrwxrwx 1 root root 0 Nov 14 18:58 /config/appdaemon/dashboards/dash_cam01.dash

Permissions are 777 on:
/config/appdaemon/
/config/appdaemon/dashboards/
/config/appdaemon/dashboards/dash_cam01.dash

My HA version:
“version”: “0.82.0”,
“last_version”: “0.82.0”,
“machine”: “raspberrypi3”,
“image”: “homeassistant/raspberrypi3-homeassistant”,
“custom”: false,
“boot”: true,
“port”: 8123,
“ssl”: false,
“watchdog”: true,
“wait_boot”: 600

AppDaemon 3 version: 1.6.0

AppDeamon logs:

[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing…
Log level is set to INFO
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] 02-updates.sh: executing…
INFO: You are running the latest version of this add-on
[cont-init.d] 02-updates.sh: exited 0.
[cont-init.d] 20-init-configuration.sh: executing…
[cont-init.d] 20-init-configuration.sh: exited 0.
[cont-init.d] 21-compiled-dir.sh: executing…
[cont-init.d] 21-compiled-dir.sh: exited 0.
[cont-init.d] 30-auto-token.sh: executing…
[cont-init.d] 30-auto-token.sh: exited 0.
[cont-init.d] 31-ha-url.sh: executing…
WARNING: You are using an non-recommended Home Assistant URL!
WARNING: Setting the “ha_url” option in your AppDaemon config to
WARNING: “http://hassio/homeassistant” is recommended!
[cont-init.d] 31-ha-url.sh: exited 0.
[cont-init.d] 50-compiled-symlink.sh: executing…
[cont-init.d] 50-compiled-symlink.sh: exited 0.
[cont-init.d] 80-system-packages.sh: executing…
[cont-init.d] 80-system-packages.sh: exited 0.
[cont-init.d] 81-python-packages.sh: executing…
[cont-init.d] 81-python-packages.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
2018-11-14 18:58:05.562229 INFO AppDaemon Version 3.0.2 starting
2018-11-14 18:58:05.563032 INFO Configuration read from: /config/appdaemon/appdaemon.yaml
2018-11-14 18:58:05.567615 INFO AppDaemon: Starting Apps
2018-11-14 18:58:05.576981 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2018-11-14 18:58:05.856092 INFO AppDaemon: HASS: HASS Plugin Initializing
2018-11-14 18:58:05.857658 INFO AppDaemon: HASS: HASS Plugin initialization complete
2018-11-14 18:58:05.859011 INFO Starting Dashboards
2018-11-14 18:58:05.881887 INFO API is disabled
2018-11-14 18:58:05.902251 INFO AppDaemon: HASS: Connected to Home Assistant 0.82.0
2018-11-14 18:58:05.957564 INFO AppDaemon: Got initial state from namespace default
2018-11-14 18:58:08.156928 INFO AppDaemon: Reading config
2018-11-14 18:58:08.265096 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified
2018-11-14 18:58:08.265970 INFO AppDaemon: /config/appdaemon/apps/foscam.yaml added or modified
2018-11-14 18:58:08.267248 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified
2018-11-14 18:58:08.268443 INFO AppDaemon: /config/appdaemon/apps/foscam.yaml added or modified
2018-11-14 18:58:08.269616 INFO AppDaemon: App ‘hello_world’ added
2018-11-14 18:58:08.270837 INFO AppDaemon: App ‘foscam’ added
2018-11-14 18:58:08.272887 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2018-11-14 18:58:08.275402 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/hello.py
2018-11-14 18:58:08.312414 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/foscam.py
2018-11-14 18:58:08.332780 INFO AppDaemon: Initializing app hello_world using class HelloWorld from module hello
2018-11-14 18:58:08.640617 INFO hello_world: Hello from AppDaemon
2018-11-14 18:58:08.645491 INFO hello_world: You are now ready to run Apps!
2018-11-14 18:58:08.646316 INFO AppDaemon: Initializing app foscam using class foscam from module foscam
2018-11-14 18:58:08.726073 INFO foscam: Camera state ok
2018-11-14 18:58:09.052829 INFO foscam: Camera state ok
2018-11-14 18:58:09.269722 INFO foscam: Camera state ok
2018-11-14 18:58:09.321334 WARNING foscam: I cant read motion detect settings, motion detect switch disabled
**2018-11-14 18:58:09.382905 ERROR foscam: unexpected error: dashboard couldnt be written**
2018-11-14 18:58:09.389006 ERROR foscam: tried to write: /config/appdaemon/dashboards/dash_cam01.dash
2018-11-14 18:58:09.395125 ERROR foscam: unexpected error: dashboard couldnt be written
2018-11-14 18:58:09.400741 INFO foscam: tried to write: /config/appdaemon/dashboards/dash_cam01_fullscreen.dash
2018-11-14 18:58:09.406081 INFO foscam: App started without errors
2018-11-14 18:58:09.463660 INFO AppDaemon: App initialization complete

Thanks for your help.

first of all please present logs, code and yaml only as codeblock, because without that it isnt readable.

but what i noticed is this:

-rwxrwxrwx 1 root root 0 Nov 14 18:58 /config/appdaemon/dashboards/dash_cam01.dash

the file is owned by root.
that can have 2 causes:

  1. appdaemon is run as root but with hassio that is unlikely
  2. the most probable cause is that the dashboards dir is owned by root and files below it inherit that ownership.
    and because AD is not run as root it has no permission to write there.

you need to make sure that all dirs and files inside the appdaemon directory are owned by the user that runs appdaemon.

Funny.im getting same error with appdaemon and foscam v3

hass@home-assistant:~$ ls -l appdaemon/conf/dashboards/
insgesamt 20
-rwxrwxrwx 1 hass hass 0 nov. 16 20:50 cam_alert.dash
-rwxrwxrwx 1 hass hass 2598 nov. 14 21:50 front_cam.dash
-rwxrwxrwx 1 hass hass 1479 nov. 15 00:11 home.dash
-rwxrwxrwx 1 hass hass 3236 nov. 15 00:07 vacuum.dash
-rwxrwxrwx 1 hass hass 1161 nov. 15 00:13 weather.dash
hass@home-assistant:~$

Running appdaemon with Hass user

Many thanks for your very quick reply!

I’m using Hass.io image for Raspberry Pi 3 with add-on AppDaemon3 and I do not have the possibility to choose the user that runs appdaemon.
I think it’s due that HA is embeded in docker.
All I see with a “ps -ef” command is:

core-ssh:~# ps -ef
PID USER TIME COMMAND
1 root 0:00 /dev/init – /run.sh
8 root 0:00 /usr/sbin/sshd -D -e
177 root 0:00 sshd: root@pts/0
179 root 0:00 -bash
184 root 0:00 ps -ef

I don’t know witch user that runs appdaemon I think it’s root.

i just checked my code, and i think the unexpected error could also be when 1 of the options doesnt exist.
do you have all lines in the yaml as provided and all entities created in HA?

Hi,
I installed a new Hass.io image with only Appdaemon add-on and now I get this error message in Appdaemon logs:

2018-11-18 15:02:07.145057 INFO AppDaemon: Initializing app foscam using class foscam from module foscam
2018-11-18 15:02:07.146333 WARNING AppDaemon: ------------------------------------------------------------
2018-11-18 15:02:07.146998 WARNING AppDaemon: Unexpected error running initialize() for foscam
2018-11-18 15:02:07.147667 WARNING AppDaemon: ------------------------------------------------------------
2018-11-18 15:02:07.156278 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 1581, in init_object
    init()
  File "/config/appdaemon/apps/foscam.py", line 70, in initialize
    self.alarmsettings = self.args["alarmsettings"]
KeyError: 'alarmsettings'

Here my configuration.yaml file:

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: 0
  longitude: 0
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 0
  # metric for Metric, imperial for Imperial
  unit_system: metric
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: UTC
  # Customization file
  customize: !include customize.yaml

# Show links to resources in log and frontend
introduction:

# Enables the frontend
frontend:

# Enables configuration UI
config:

# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
#   base_url: example.duckdns.org:8123

# Checks for available updates
# Note: This component will send some information about your system to
# the developers to assist with development of Home Assistant.
# For more information, please see:
# https://home-assistant.io/blog/2016/10/25/explaining-the-updater/
updater:
  # Optional, allows Home Assistant developers to focus on popular components.
  # include_used_components: true

# Discover some devices automatically
discovery:

# Allows you to issue voice commands from the frontend in enabled browsers
conversation:

# Enables support for tracking state changes over time
history:

# View all events in a logbook
logbook:

# Enables a map showing the location of tracked devices
map:

# Track the sun
sun:

# Sensors
sensor:
  # Weather prediction
  - platform: yr

# Text to speech
tts:
  - platform: google

# Cloud
cloud:

# Cameras
camera:
# Foscam Camera
  - platform: foscam
    ip: 192.168.1.40
    port: '88'
    username: 'MY CAMERA USER'
    password: 'MY CAMERA PASSWORD'
    name: cam01

# Foscam-app
input_boolean:
  foscam_mirror:
    name: Mirror picture
    initial: off
    icon: mdi:swap-horizontal
  foscam_flip:
    name: Flip picture
    initial: off
    icon: mdi:swap-vertical
  foscam_motion_detect:
    name: Motion detect on
    initial: off
    icon: mdi:radar
  foscam_stop_cruise:
    name: Stop cruise 
    initial: off
    icon: mdi:square
  foscam_default_picture_settings:
    name: Set default picture settings
    initial: off
    icon: mdi:settings
  foscam_infrared:
    name: Infrared
    initial: off
    icon: mdi:weather-night
  foscam_auto_infrared:
    name: Infrared automated
    initial: off
    icon: mdi:weather-night
  foscam_snap_picture_now:
    name: Take picture
    initial: off
    icon: mdi:record-rec
  foscam_toon_alarm_dash:
    name: Show alarm dashboard
    initial: off
    icon: mdi:alarm-light

input_number:
  foscam_zoom:
    name: Zoom
    initial: 0
    min: -3
    max: 3
    step: 1
    icon: mdi:binoculars
  foscam_up_down:
    name: Move vertical
    initial: 0
    min: -5
    max: 5
    step: 1
    icon: mdi:swap-vertical
  foscam_left_right:
    name: Move horizontal
    initial: 0
    min: -5
    max: 5
    step: 1
    icon: mdi:swap-horizontal
  foscam_hue:
    name: Hue
    initial: 50
    min: 0
    max: 100
    step: 1
    icon: mdi:atom
  foscam_brightness:
    name: Brightness
    initial: 50
    min: 0
    max: 100
    step: 1
    icon: mdi:brightness-6
  foscam_contrast:
    name: Contrast
    initial: 50
    min: 0
    max: 100
    step: 1
    icon: mdi:contrast-circle
  foscam_saturation:
    name: Saturation
    initial: 50
    min: 0
    max: 100
    step: 1
    icon: mdi:brightness-7
  foscam_sharpness:
    name: Scharpness
    initial: 50
    min: 0
    max: 100
    step: 1
    icon: mdi:image-filter

input_select:
  foscam_preset_points:
    name: Preset points
    options:
     - top
     - bottom
     - most left
     - most right
    initial: top
  foscam_preset_cruise:
    name: Preset cruises
    options:
     - horizontal
     - vertical
    initial: horizontal

groups:
  foscamsettings:
    name: Foscam
    entities:
      - input_boolean.foscam_snap_picture_now
      - input_select.foscam_preset_points
      - input_select.foscam_preset_cruise
      - input_boolean.foscam_stop_cruise
      - input_number.foscam_up_down
      - input_number.foscam_left_right
      - input_number.foscam_zoom
      - input_boolean.foscam_motion_detect
      - sensor.foscam_motion
      - sensor.foscam_sound_alarm
      - sensor.foscam_recording
      - input_boolean.foscam_toon_alarm_dash
      - sensor.foscam_last_error

  foscampicturesettings:
    name: Foscam picture settings
    entities:
      - input_boolean.foscam_mirror
      - input_boolean.foscam_flip
      - input_number.foscam_hue
      - input_number.foscam_brightness
      - input_number.foscam_contrast
      - input_number.foscam_saturation
      - input_number.foscam_sharpness
      - input_boolean.foscam_default_picture_settings
      - input_boolean.foscam_auto_infrared
      - input_boolean.foscam_infrared

  cam:
    name: Camera
    view: yes
    entities:
      - group.foscamsettings
      - group.foscampicturesettings
      - camera.foscam

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

My foscam.yaml file:
foscam:
  class: foscam
  module: foscam
  camsettings:
    camera_type: R2
    camera_name: cam01
    host: 192.168.1.40
    port: '88'
    user: MY CAMERA USERNAME
    password: CAMERA USERNAME PASSWORD
  logsettings:
    loglevel: DEBUG
    logsensorlevel: DEBUG
    last_error_sensor: sensor.foscam_last_error
  picsettings:
    brightness_slider: input_number.foscam_brightness
    contrast_slider: input_number.foscam_contrast
    hue_slider: input_number.foscam_hue
    saturation_slider: input_number.foscam_saturation
    sharpness_slider: input_number.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:
    left_right_slider: input_number.foscam_left_right
    up_down_slider: input_number.foscam_up_down
    start_cruise_select: input_select.foscam_preset_cruise
    stop_cruise_switch: input_boolean.foscam_stop_cruise
    zoom_slider: input_number.foscam_zoom
    preset_points_select: input_select.foscam_preset_points
  alarmsettings:
    motion_sensor: sensor.foscam_motion
    motion_switch: input_boolean.foscam_motion_detect
    soundalarm_sensor: sensor.foscam_sound_alarm
    sensor_update_time: '10'
  recordsettings:
    snap_picture_switch: input_boolean.foscam_snap_picture_now
    recording_sensor: sensor.foscam_recording
    save_snap_dir: /share/foscam_snap/ #/complete/path/to/where/to/save/
  dashboardsettings: 
    DashboardDir: /config/appdaemon/dashboards/
    use_dashboard: True
    create_dashboard: True
    create_alarm_dashboard: True
    dashboard_file_name: dash_cam01 #add dashboardname
    alarm_dashboard_file_name: dash_cam01_fullscreen #add alarm dashboardname
    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

My appdaemon.yaml file:

log:
  logfile: STDOUT
  errorfile: STDERR
appdaemon:
  threads: 10
  app_dir: /config/appdaemon/apps
  plugins:
    HASS:
      type: hass
      ha_url: http://192.168.1.59:8123
      token: MY TOKEN
hadashboard:
  dash_url: http://192.168.1.59:5050
  dash_dir: /config/appdaemon/dashboards
  dash_force_compile: 1

My foscam.py file is the original file with only the modifications for Foscam R2 camera.

Bests regards

first of all, you really need to show yaml, code and logfiles as codeblock because what you have given here is absolute not readable.

i hope you noticed
there is foscam v3 https://github.com/ReneTode/Foscam-app
i hope you installed all needed entities in homeassistant

and from the error it shows that you dont have the alarmssettings section in the yaml.
it is possible that you did mess up the yaml when you edited it, but i cant see that when its not presented right.

Sorry for the incorrectly formatted code.
I select the text and click on ‘</>’ icon but that seems not always working properly .
I hope that now the code is well formatted.
Yes, I use files for foscam v3.
I’m newbie in HA and I did that:

  • In my configuration.yaml file,I added the text “add_to_ha_configuration”,
  • In /config/appdaemon/apps/foscam.yaml I setted camera setting for my camera

Can you explain to me what you mean when you say “it shows that you dont have the alarmssettings section in the yaml”?
I suppose it’s in configuration.yaml file?
Thank you for your help and patience with me.

oke, now that i can read it, i see that you just copied everything to the configuration.yaml from homeassistant and that wont work.

you really need to know what you are doing when you add something there or you just end up with trouble.
using the foscam app expects at least the basic knowledge from home assistant yaml.

for instance you add groups: to the yaml and do the settings below that or you add
group: !include groups.yaml
to the configuration and then you need to do all settings from group in the groups.yaml file
you cant have it both.

im not sure why it struggles with the alarmsettings because they are there.
could be because the entities are not setup correct in HA and you got other errors (you show only a small part from your log)

first make sure you got all entities right in the configuration.yaml from home assistant, then restart appdaemon and look at the complete log.

Hi,

The error message:
“ERROR foscam: unexpected error: dashboard couldnt be written”
is du to the statement [“ha_key”] in the setting of the 'entity_picture: ’ in the file foscam.py.
May be because of the new Authentification system of HA?
ha_keys is no longer defined in appdaemon.yaml, replaced by a token.

'my_camera:',
'    widget_type: camera',
'    entity_picture: ' + self.config["plugins"]["HASS"]["ha_url"] + '/api/camera_proxy_stream/camera.' + self.camera_name + '?api_password=' + self.config["plugins"]["HASS"]["ha_key"],
'    title: ' + self.camera_name,
'    refresh: 120',

Best regards