Foscam app V2 (Appdaemon and HAdashboard)

2017-11-21 23:08:29.534877 INFO Connected to Home Assistant 0.58.0
2017-11-21 23:08:47.825060 INFO New dashboard connected: Lighteffects
2017-11-21 23:12:14.691434 INFO Dashboard disconnected
2017-11-21 23:12:14.836526 INFO Compiling dashboard ‘Lights’
2017-11-21 23:12:15.874916 INFO New dashboard connected: Lighteffects
2017-11-21 23:12:23.299071 INFO Dashboard disconnected
2017-11-21 23:12:30.696542 INFO function [get_dashboard] finished in 15860 ms
2017-11-21 23:12:42.659001 INFO Compiling dashboard ‘foscam’
2017-11-21 23:12:45.889444 INFO function [get_dashboard] finished in 3231 ms
2017-11-21 23:12:47.620548 INFO New dashboard connected: HADashboard

-rwxrwxrwx 1 root root 567 Mar 7 2017 downstairs_middle_panel.yaml
-rw-r–r-- 1 root root 0 Nov 21 23:08 foscam.dash
-rw-r–r-- 1 root root 0 Nov 21 23:08 foscam_alarm.dash
-rwxrwxrwx 1 root root 396 Aug 27 23:31 graphs.dash
-rwxrwxrwx 1 root root 5110 Jul 7 17:34 info_middle_panel.yaml
-rwxrwxrwx 1 root root 2438 Aug 31 21:39 light_top_panel.yaml
-rwxrwxrwx 1 root root 4899 Aug 16 21:38 lights_middle_panel.yaml
-rwxrwxrwx 1 root root 4364 Aug 8 22:50 main_middle_panel.yaml
-rwxrwxrwx 1 root root 749 Mar 15 2017 mode_panel.yaml
-rwxrwxrwx 1 root root 675 Aug 15 12:48 multimedia_middle_panel.yaml
-rwxrwxrwx 1 root root 128 Mar 7 2017 sensor.side_humidity_corrected.yaml
-rwxrwxrwx 1 root root 3335 Aug 31 21:02 top_panel.yaml

you have a wrong setting in your apps.yaml

forget it aggain ! I did not set camera name :stuck_out_tongue: sorry for my noobish errors here :stuck_out_tongue:

1 Like

you should really rename the folders of the colorpicker as they are still calles : colo… without r :slight_smile: this broke my neck again :stuck_out_tongue:

thx for the reminder. i completely forgot it.

u also did not mention that hash_dir is mandatory :slight_smile:

1 Like

thx again. both are changed.

Hello Mr. Rene Tode

Can you help with other camera which is not foscam? The command from my ip camera are different from foscam camera. The camera is use as generic ip camera in home assistant.

Thank you in advance.

i am sorry but its very hard to help someone with a camera i dont own.
but if you have appdaemon installed and have knowledge of python you could try to change the code to use it with your camera, but only if the camera also uses CGI commands.

The camera use cgi commands. I don’t know about python. Already installed appdaemon. Regarding to your foscom.py. there are different commands from my ip camera. Currently, I use as generic ip camera in Home Assistant. Can the foscom.py use with generic ip camera? And if I have any question about the foscom.py can I ask you in here?

here is the list of command for my camera.
https://wikiold.instar.de/index.php/Complete_CGI_Command_List_(HD)

here is the mostly use command that ip camera provide.
https://www.instar.com/faq_cgi_hd

To read from aboved website is very difficult because they are in german language so I have tried most of the command and they work ok with my camera.

  • my camera is not Instar brand. However, it uses same cgi commands.

the foscam.py uses a cam that is configurated in HA, so it should also be able to use a generic camera.
but as i set it up it is completely for specific foscam cameras.

off course if you have questions about the app you can ask them here.

i did set it up quite general, and i just looked at the code and at your commands.
the commands are easy to replace.
but the response from the camera is quite different. so the functions need to be completely rewritten. and because i have no way to test it, it would be quite hard to do for me.

so yeah, in theory it is possible, but because you dont know any python it will be quite hard.

from your foscam.py
self.url = “http://”+ self.camhost + “:” + str(self.portnr) + “/cgi-bin/CGIProxy.fcgi?&usr=” + self.user + “&pwd=” + self.password + “&cmd=”

  1. my camera has to put username and password first
  2. the “cgi-bin/CGIProxy.fcgi?usr=” my is “cgi-bin/hi3510/param.cgi?”

Please correct me if I am right or wrong… I am confusing with " so I hope you can double check for me.
self.url = “http://”+ usr=" + self.user + “:” + “&pwd=” + self.password + “@” + self.camhost + “:” + str(self.portnr) + “/cgi-bin/hi3510/param.cgi?” + “&cmd=”

The value I want to get is http://username:password@camipaddress:port/cgi-bin/hi3510/param.cgi?cmd=

if i look at the site it says:
/cgi-bin/hi3510/cleanlog.cgi?usr=admin&pwd=instar as cgi type, so you dont need to put it in front.

but if you would like it that way you are editing wrong.

self.url = “http://”+ usr=" + self.user + “:” + “&pwd=” + self.password + “@” + self.camhost + “:” + str(self.portnr) + “/cgi-bin/hi3510/param.cgi?” + “&cmd=”

should be:

self.url = “http://” + self.user + “:” + self.password + “@” + self.camhost + “:” + str(self.portnr) + “/cgi-bin/hi3510/param.cgi?cmd=”

but by just replacing the url and even the commands you would still have nothing that works.
and because you dont know python, you cant rewrite the functions that give the data to HA.

i can help you in the chat or pm (would be to much to do it here) but then you probably need to start from zero (to start understanding what you do), and not try to edit the foscam.py.

Thank you very much. After finish editing all the command I will try in HA.

Do I have to just change like this:
self.listen_state(self.input_boolean_changed, self.mirror_switch, on_command=“setimageattr&-mirror=on”, off_command=“setimageattr&-mirror=off”, reset=False)
self.listen_state(self.input_boolean_changed, self.flip_switch, on_command=“setimageattr&-flip=on”, off_command=“setimageattr&-flip=off”, reset=False)
self.listen_state(self.pic_setting_input_slider_changed,self.brightness_slider,settingstype = “setimageattr&-brightness=”)
self.listen_state(self.pic_setting_input_slider_changed,self.contrast_slider,settingstype = “setimageattr&-Contrast=”)
self.listen_state(self.pic_setting_input_slider_changed,self.hue_slider,settingstype = “setimageattr&-Hue=”)
self.listen_state(self.pic_setting_input_slider_changed,self.saturation_slider,settingstype = “setimageattr&-Saturation=”)
self.listen_state(self.pic_setting_input_slider_changed,self.sharpness_slider,settingstype = “setimageattr&-Sharpness=”)
self.listen_state(self.pic_setting_input_slider_changed,self.default_pic_settings_switch,settingstype = “setimageattr&=default”)
self.pic_setting_input_slider_changed("","","","",{“settingstype”:“JustCheck”})

or example change
self.listen_state(self.pic_setting_input_slider_changed,self.sharpness_slider,setimageattr&- = “Sharpness”)
self.pic_setting_input_slider_changed("","","","",{“setimageattr&-”:“JustCheck”})

setimageattr&- = “Sharpness” is completely wrong.
but it doesnt matter because IT WONT WORK!

So you mean, I just change them like this
self.listen_state(self.pic_setting_input_slider_changed,self.sharpness_slider,settingstype = “setimageattr&-Sharpness=”)

not this one
self.listen_state(self.pic_setting_input_slider_changed,self.sharpness_slider,setimageattr&- = “Sharpness”)

Here is the full command of setimageattr
https://wikiold.instar.de/index.php/HD_CGI_Commands_-_Set_Image_Attribute

this command would be right if shapness had a value. but sharpness has none.
the app is written for foscam responses.

foscam gives back values like:

<brightness>50</brightness>
<flip>1</flip>

your cam gives responses like

var brightness="150";
var flip="on";

this app CANNOT read that data. it doesnt know what to do with the data and it will do NOTHING. it will only generate errors.
your cam has contrast from 0-7, foscam has contrast from 0 to 100
your cam has brightness from 0-255 foscam has brightness from 0 to 100

you would have to change the sliders in HA for that (but thats the easy part) but the functions in the app wont change the sliders, because it cant read the data! and if you change the sliders yourselve the command will be send but it will break the app by creating errors.

please believe me this app is USELESS for YOURE CAM and you wont be able to adapt it without good knowledge from python!

Thank you very much for your advice. The website of instar show the command that works with my camera. however, if you see from the picture attached show the http ui of my camera which have like foscam, mostly differences are the command. I use the instar cgi command to guide me so I can know what the cgi command are. The specification of the camera is not the same from instar website. The same is the cgi command ^^