The purpose of this post is to illustrate an interesting capability of the Fibaro HC2 in managing some very specific devices that are not originally made to be manage by the HC2 ! An IP camera like the Foscam FI8910W presented in my previous post (Improving home security with video monitoring) is a good example for the usage of “virtual device”. The objective is to activate the camera motion detector and the automatic send email function through a script and make available the building blocks for an alarm system.
Here are the constraints when using the HC2 with version 1.046:
– Using the graphical script builder, there is NO specific IP camera command for motion detector & email. The only available command is take a picture !
– Virtual device is therefore a good solution to communicate/send orders to the IP camera through “virtual buttons”.
Let’s consider our IP camera “foscam2” located in the kitchen. The “V-foscam2” is the virtual device associated to this camera. This V-foscam2 has 3 buttons or functionalities:
(i) Arm the motion detector (armer)
(ii) Activate the automatic send email function of the camera (mail)
(iii) Disarm the motion detector (disarmer)
The first & second button will be used to activate the alarm mode.
The V-foscam2 characteristics (general parameters tab) are:
– Controled device: Other device (autre peripherique)
– Location: Kitchen (cuisine)
– IP address of the camera
– Port: TCP port of the camera
In the advanced parameters tab, the script for each button is defined. Basically, the communication with the Foscam will be done through an HTTP query that integrates a CGI command. It may sounds very technical (and it is!) but just follow this tutorial and it will work like a charm!
Arm/disarm the camera motion detector
The key CGI command is “set_alarm.cgi” with a list of parameters:
– motion_armed=1 (1=Arm, 0=Disarm)
– mail=1 (1=Arm, 0=Disarm)
– user=camera-login (this is the camera login with no quotation mark)
– pwd=camera-pass (and the camera password with no quotation mark)
The full script for the button “Arm the motion detector” is:
GET /set_alarm.cgi?motion_armed=1&user=admin&pwd=1234 HTTP/1.10x0D0x0A0x0D0x0A
The “HTTP/1.10x0D0x0A0x0D0x0A” is a string to indicate that you are sending an HTTP query. Don’t ask why or how, this is all I know but most important is that it works nice !
For more information on CGI commands, have a look at this IP Camera CGI manual.
Virtual device management
We have defined a virtual device v-foscam2 with 3 buttons (arm, activate email and disarm). The iPhone HC2 client has some limitation: the current version can NOT manage virtual devices. A turn around solution is to use some script and then launch the scripts from the iPhone. The virtual buttons will be called within a regular script.
Here is the script to arm the camera:
(i) If the camera is not already armed (use of a local variable/parameter: 1=armed), 0=disarmed)
(ii) Then
a. Arm the camera using the virtual button “V-foscam2 armer”
b. Activate the email using “V-foscam2 mail”
c. Set the local variable “#foscam2 armer” to 1, meaning the camera is armed.
More details in a new post (part 2) coming next week !
Pingback: Alarm activation - IP camera control & Virtual device with Fibaro HC2 – PART 2Dominium – Domotic experience
Hi
Thanks for posting this up. I have followed your steps and got my fibaro arming and disarming using virtual devices but when i try and add the scene i do the first part and create the i cannot see my virtual devices? Not sure how to get them to show up in the scene?
Hi,
Thanks for reading the blog. Can you provide some details about your set up so that I can help you:
– did you save your virtual device definition properly (press the save button)?
– if yes then when using the script generator you need to go to “Module/Device”, select the location and then the device and its button.
– you can also send me some screen capture by email if needed.
Regards,
YG
Hi
Thanks for your response i hadn’;t changed to THEN! working now many thanks for you work on this and for sharing.
Welcome !
New stuff to be posted soon – Keep visiting the blog and subscribe to the email notification !
hi i will do everything as described here but I have neither of which did not work, please help me to configure
Hello Damir,
Thanks for visiting my blog.
I need some details in order to help: did you go through my posts part A and part B?
You may need to be careful at the following:
1- Make sure you have a local variable
2- Your IP camera login/password should be included the virtual device panem with NO quotation mark and NO space.
Please confirm this is fine and provide some more details.
Reagrds,
YG
That’s how I was and do not work
GET 192.168.1.108:7773/set_alarm.cgi?motion_armed=1&user=admin&pwd=admin HTTP/1.10x0D0x0A0x0D0x0A
GET 192.168.1.108:7773/set_alarm.cgi?mail_armed=1&user=admin&pwd=admin HTTP/1.10x0D0x0A0x0D0x0A
the IP address and port number should be defined in the virtual device panel general tab only.
Try this in the virtual device button field:
GET /set_alarm.cgi?motion_armed=1&user=admin&pwd=admin HTTP/1.10x0D0x0A0x0D0x0A
I still can not, can be configured remotely
Hello Damir,
Please give some details on your configuration, error message, etc, so That I can help you.
hi, no error shows just does not work. I can not understand what is the reason
Need more détails to help you !
Can you test separately each virtual object, button, etc and confirm that They work (separately one by one)
Good luck !
Hello Yama Ghafoor
thank you for your replies
Like in the Don’s case we have configured a virtual device with the 3 buttons but while creating a new scene we can’t see the virtual device in the list.
Could you please describe possible reasons of this?
In previous comments Don wrote “i hadn’;t changed to THEN! ” – could you please explain where this parameter must be changed?
Thank you
actually we have 4 virtual devices in our system. But none of these are displayed in the menu (+) -> “virtual devices” on the Scene creation field
Hello,
Did you define à local variable and Then try to insert the virtual device?
yes, we have defined the local variales for the 3 buttons in the GET query:
GET/set_alarm.cgi?motion_armed=1&user=admin&pwd=admin HTTP/1.10x0D0x0A0x0D0x0A
GET/set_alarm.cgi?motion_armed=0&user=admin&pwd=admin HTTP/1.10x0D0x0A0x0D0x0A
GET/set_alarm.cgi?mail=1&user=admin&pwd=admin HTTP/1.10x0D0x0A0x0D0x0A
Hi,
Difficult to make a diagnostic. It should be working. What is your version of HC2 firmware? I use v1.47.
Regards,
YG
can u please guide me on how to set up cgi command to set up users. thank u please give very specific examples so that i can replace it with my params.
thank u
Hi,
The user set-up should be done directly at the GUI camera level – this is where you define the user category and password. Please check your camera manual for more details. The CGI commands are used for managing the camera behaviour.
Regards,
YG
Hello Yama,
did you have ever use the motion detection as a motion sensor in Fibaro?
Like if someone breanch the motion detection the fibaro will activate the external alarm…
Thank you.
Everything working, when camera is in local network 192.168.x.x.. If the camera is in other ip network, same commands in script doesn’t work. Have you tried it or may be you know how to solve it?