BabyCam Android App Integration using HTTP-Binding

Tags: #<Tag:0x00007f616ef62ad0> #<Tag:0x00007f616ef629e0> #<Tag:0x00007f616ef628a0>

Hello community,
I’m expacting a baby and were searching for a babyphone/babycam, which I could integrate into openHAB. I couldn’t find something out of the box, so that I had to find a solution by myself. As the most babyphones do have their own ecosystem/protocol i’ve tried some babyphone apps for Android. Unfortunately most apps do require a subscription with a monthly fee. Then i’ve found BabyCam for Android (Google Play Store) and tried it. It’s pretty cheap (only 1-2€ one time), is good rated and has a huge functionality. I’ve asked the developer to add a MQTT client, so that an alarm could be send to openHAB and trigger a rule, but he only answered that he will think about it. I’ve searched a little bit and found a solution to integrate at least some functions in openHAB using the http binding. I hope you guys find it useful to…so…please let me know.

The BabyCam has a Webinterface which shows a releading JPG snapshot of the camera and has some control buttons. These buttons are using http GET requests to trigger some actions like turning the flashlight on.

Start with installing the BabyCam App. Then make an IP address reservation in your router. You need to install the http binding first if you don’t already have. Then you need to create the items:

Number Babycam_Battery              "BabyCam Akkustand"          <battery>              (gBabycam)          { http="<[http://192.168.1.1:8080/cgi/batteryQuery:2000:REGEX((.*?)%( .*))]" }
String Babycam_Charging             "BabyCam Ladezustand"        <battery>              (gBabycam)          { http="<[http://192.168.1.1:8080/cgi/batteryQuery:2000:REGEX(\\b\\w\\w. (.*))]" }
String Babycam_Online               "BabyCam Online"                                    (gBabycam)          { http="<[http://192.168.1.1:8080/cgi/online:2000:REGEX((.*))]" }
String Babycam_Status               "BabyCam Status"                                    (gBabycam)          { http="<[http://192.168.1.1:8080/cgi/getCameraStatus:2000:REGEX((.*))]" }
Switch Babycam_Camera               "BabyCam Ein/Aus"                                   (gBabycam)          { http=">[ON:GET:http://192.168.1.1:8080/cgi/resumeCamera] >[OFF:GET:http://192.168.1.1:8080/cgi/pauseCamera]" }
Switch Babycam_switchCamera         "BabyCam Camera umschalten"                         (gBabycam)          { http=">[CHANGED:GET:http://192.168.1.1:8080/cgi/switchCamera]" }
Switch Babycam_Music                "BabyCam Musik"                                     (gBabycam)          { http=">[CHANGED:GET:http://192.168.1.1:8080/cgi/doMusic]" }
Switch Babycam_Flash                "BabyCam Licht"                                     (gBabycam)          { http=">[CHANGED:GET:http://192.168.1.1:8080/cgi/flash]" }
Switch Babycam_Resolution           "BabyCam Auflösung"                                 (gBabycam)          { http=">[ON:GET:http://192.168.1.1:8080/cgi/setup?wid=1280&hei=960:xmlhttprequest] >[OFF:GET:http://192.168.1.1:8080/cgi/setup?wid=800&hei=600:xmlhttprequest]" }

Note: The resolution item is not yet working and I don’t know if I will get it working like this.
Note 2: Don’t forget to change the IP address of the items to the IP of you BabyCam device

Now go to your sitemap-file and enter the following where you want:

    Frame label="Babycam"{
Image   icon="camera" url="http://192.168.1.1:8080/stream/live.jpg" label="Babycam" refresh=2000 visibility=[Babycam_Status ==PLAY]

    Text item=Babycam_Battery   label="Akkustand [%s %%]"   icon="battery"
    Text item=Babycam_Charging  label="Ladezustand [%s]" icon="poweroutlet_eu"
    Switch item=Babycam_Camera label="Kamera" mappings=[ON="Ein", OFF="Aus"] icon="camera"
    Switch item=Babycam_switchCamera label="Kamera wechseln" mappings=[ON="Raum", OFF="Baby"] icon="camera"
    Switch item=Babycam_Flash   label="Licht"   icon="light"
    Switch item=Babycam_Music   label="Schlaflied"  icon="crybaby"
    }

I couldn’t find a solution to set the alarm in openHAB and I don’t know how to get notified in openHAB when the alarm is getting triggered. I can only set the alarm in the app and receive the state from there. I hope somebody of you has more knowledge on this topic and can extend the functionality. Further it would be great if some other people would also write feature requests to the developer, so that he possibly integrates an interface like MQTT to set some settings and get information out of the BabyCam.

Regards,

Riza

2 Likes