Foscam app V2 (Appdaemon and HAdashboard)

Thank you very much for your advice ^^

Hi Rene,

first at all - very nice job -
I have a Foscam C1 V3 and it works in group mode 1 with infrared too.

But I’m not able to switch “motion detect” on or off. I have tried every cam type you had listed.

HA: v0.60.0
AppDaemon: v2.1.1
Foscam: C1 V3

HA log:
2017-12-31 10:54:15 WARNING (MainThread) [homeassistant.core] Unable to find service input_number/select_value

AppDaemon log:
clear

greetz from Germany and a happy new year!

sorry thats a mistake from me.
because they had the breaking change in input slider and i didnt have home assistant updated i made the changes for other people without testing.
now i know that the service uses set_value and not select_value.

i just changed the code.
i also did splitt up the cams in 3 groups (ptz + infrared, just infrared, no ptz + no infrared)
so your cam is now in group 2

greetz back from germany and gute rutch.

I’ve set camera_type to C1 V3 but I get infrared error messages.
Also i tried to replace foscam.py with the new one, but I can’t enable Motion Detection ;(

what are the error messages.
sorry to hear that its not working, but i cant test it myself so if you have patience with me ill try to get it working for you.

OK. C1 V3 type works now.

Several times i’ve tried to put motion detection on but it flips back to off without any message in logs.
With loglevel INFO i get this:

Dez 31 12:52:26 xxx appdaemon[14039]: 2017-12-31 12:52:26.455946 INFO foscam: Camera state ok

With this tutorial it is possible to switch motion detection on/off: Foscam - easily add motion sensor and other control.

So it should work :wink:

Do you have any ideas to debug this?

i never set my motion deteciiiiin , so i didnt test that right.
i just tried it with my own cams and they have the same problem.
so i have a bug in my app.

ill try to find out what i have done wrong and let you know.

found the problem.
with the complete rewrite i have left out 1 line of code, making that the input_boolean never had any effect.
i added it in the code and tested and it works now.
somehow it did genereate a string error, allthough i have checked and checked, but the command should be correct and it works like it is supposed to.
so i did another small change to suppres the error for that command.

code in the github is up to date again.

for those who read this, i didnt change it in the older versions. so they are not up to date anymore.

thx it works! great and fast work!

is it also possible to enable/disable “foscam sound alarm” ?
and every setting is lost when I activate motion detection via HA.
thanks in advance

I have a second problem with auto creating dashboards…

Dez 31 16:18:21 xxx appdaemon[26999]: 2017-12-31 16:18:21.537614 ERROR foscam: unexpected error: dashboard couldnt be written
Dez 31 16:18:21 xxx appdaemon[26999]: 2017-12-31 16:18:21.538448 ERROR foscam: tried to write: /home/xxx/.homeassistant/conf/dashboards/foscam.dash
Dez 31 16:18:21 xxx appdaemon[26999]: 2017-12-31 16:18:21.539270 ERROR foscam: unexpected error: dashboard couldnt be written
Dez 31 16:18:21 xxx appdaemon[26999]: 2017-12-31 16:18:21.541224 INFO foscam: tried to write: /home/xxx/.homeassistant/conf/dashboards/foscam_fullscreen.dash

those files are created with 0 bytes. this shouldn’t be a write problem…

% ls -lah dashboards/foscam*
-rw-r--r-- 1 xxx users 0 31. Dez 16:18 dashboards/foscam.dash
-rw-r--r-- 1 xxx users 0 31. Dez 16:18 dashboards/foscam_fullscreen.dash

greetz

lets look at this next year :wink:

i dont know about your cam, but if i set motion off, and then to on again, all settings from before are lost.
so i have to find a way to retrieve and save them, but that can only be done if motion detection is on.

so i will have to rewrite that part completely.

creating the dashboards is another thing.
i never thought about the fact that when i set some settings to optional (like PTZ) that i also have to check for that when building the dashboard. so i need to update that part also.

the option to disable/enable sound alarm can be implemented, but it will have to wait a little.

how to install untangle in hassio?

quote:
second requirement is untangle. to install untangle: pip3 install untangle

sorry i have no idea.
i dont know anything about hassio

i know i can check and install deps from an app, but i didnt come to implement such a thing.
its on my to do list.

now I am on HASSIO, not moving back because of its easiness.

Is your app/dashboard working without untangle (although limited in functionality)?

lots of things wont work and there will be errors.
i have no idea which part will work.

just putting the custom_widgets in my appdaemon confing makes crash appdaemon/hadashboard

\UBUNTU\config\appdaemon\custom_widgets

if that is the config directory where your apps.yaml and appdaemon.yaml are,
and you did put in all the needed files (the sub_dirs starting with base + the yaml files) it should just work fine.
and you need to make sure that appdaemon has the right filerights to that dir.

my fault I put custom_widget inside custom_widget (wrong unzipping), now it works

I found some useful information at page 104 to take on/off motion and sound detection without losing settings.

setOneKeyAlarmConfig

would be nice if that would work but its for the camtype fosbaby only :wink: