ISpy is an open source video surveillance and security software.(https://www.ispyconnect.com) iSpy works with most cameras and devices on the market. ISpy is full of features that go beyond simple DVR functions and is easily integrated into your HASS installation. ISpy is deployed in a windows environment so that you can take advantage of all the available USB web cameras on the market to build an expensiveness video security system. ISpyConnect is a cloud based system used by ISpy to access your ISpy server remotely. While ISpy software is free, ISpyConnect is a subscription service. If you want to pay for the cloud service you can have full access to your ISpy DVR and live cameras outside your network. But if ISpy and HASS are on the same LAN ISpy can serve all of its cameras via MJPEG to HASS allowing for viewing via the HASS without using the ISpyConnect cloud service.
Ispy runs its own internal HTTP server. You can connect to this server from the LAN without authentication as long as you enter the IP address in ISpy settings. Ispy has many features beyond just streaming video via mjpeg and can controlled via HTTP requests (https://www.ispyconnect.com/userguide-http.aspx). This can be useful to create automation with HASS and has many possibility for accessing ISpy’s features.
Now to access this camera’s mjpeg feed we need to know the CAM ID. To find this out you simply right click on your camera image in ISpy and then select edit from the drop-down menu. When the edit option opens your cam id will be shown in the window title as ID# followed by a number.(https://www.ispyconnect.com/userguide-live-feeds.aspx) Once we have the camera ID we can access the stream via the following url:
http://IPADDRESS:8080/mjpegfeed?oid=CAM_ID&full
Now a mjpeg camera cam be added to your HASS configuration as followed:
camera :
platform: mjpeg
mjpeg_url: http://IPADDRESS:8080/mjpegfeed?oid=CAM_ID&full
name: Camera 1
This is only the start of how you can have HASS and ISpy work together to expand video security automation. ISpy can be utilized in many different ways to send triggers and also receive triggers via HTTP and command line curl to connect with Home assistant.
So I installed iSpy and completely configured it with video and sound, now I’m looking forward to use Home Assistant to:
send a command to iSpy when I’m home to record any motion inside the house (this can be done by visiting a particular URL from your browser, not sure how to “automate it” with HASS)
send a command to iSpy when I’m NOT at home to record any motion outside/inside the house (same principle as before)
if someone has some examples…links…etc… feel free to post
In case you are still trying to figure this out: this list of HTTP API commands that can be called on the iSpy server will help you out. https://www.ispyconnect.com/userguide-http.aspx. Note: I haven’t actually done this, but it does look possible.
I imagine your problems could be solved with something like this. Note: this is pseudo-code.
Automation:
if HOME/AWAY then
turn CLI switch on/off.
Note to self and others trying this You need to whitelist HASS’ IP in iSpy to be able to get the stream without auth, otherwise you get:
{
“server”: “iSpy”,
“error”: “Authentication failed”,
“errorType”: “authentication”
}
I installed iSpy on my Win10, along with HomeAssistant… iSpy its built-in with HTTP commands to control cameras and do recording, recording on motion, etc…curl for windows installed from here and copy to windows directory as per this
Goal is to automate the recording when “home” its empty, alone, sip…through HA.
BUT… First I need to be able to learn or understand how to control the commands from within HA.
Im using (doesnt means correctly) the following command_line script (see below), and TURNING ON the device the problem:
-I cant use the command_state to read the initial setting (ON/OFF)… or value_template (mainly because I dont know how to) I tried to decrypt the secrets under the example from here …but couldnt figure it out…
curl command for ON (http://10.0.0.5:8081/allon?ot=2&oid=0)
[format for the URL is: http://camera_IP:PORT/command to control(on this case “allon”) ?ot=(type of device controlling, this case “2” for the camera, but could be 1 for microphone) &oid=(its the group ID assigned by iSpy software)]
I double check this command by inputting within chrome, service was ON and I get a response “ok”…plain text… within the chrome page.
If I use the command_state and Value_template as outline… Im able to actuate…but only to turn ON the system, and if I try to turn it OFF, it keeps coming back on (with the GUI turning into the yellow lighting icon as well) I tried with and without the “#” just to make sure I wasnt omitting something.
I guess once I figure this part out (or someone throws me a bone and helps me) I’ll jump into the automation oto record when home is empty (probably another post with a lot of questions about curl and grep and POST and GET…lol)
You cannot use curl "http://10.0.0.5:8081/allon?ot=2&oid=0" as a state command. This command turnOn the service. So every time HASS will ask for the state, it will actually turn the service on.
I think that there isn’t any command to check the state of the object. Or maybe the getobjectlist, but it won’t be so easy to extract the desired value.
You could try the Scrape Sensor to pull out the “OK” value and then do an automation based on that?
The other option is to use the iSpy alert to execute a file. Create a batch/powershell file with the required calls to update the HomeAssistant API.
I’ve created a powershell script that iSpy calls when it detects motion, and another when it stops detecting motion. The powershell does an HTTP call to the HomeAssistant API to toggle a sensor on and off. Poor mans motion detection camera within HomeAssistant haha.
I’ll try the scrape sensor later on (brain its fried today), thanks @Pawny
In the meantime, I got iSpy to work with HASS through a switch (shown at the end) - bear in mind I have an independent file for “script”, “automation”, etc…
now onto phase 2: automate the recording when motion is detected and nobody is home…
I found this - same as code below but I edited with my values:
Question: where does the “motion comes from”? I know its a stupid question, but I have a motion sensor installed which uses 433 and node red. Im able to get the value from motion sensor through node red and MQTT into HASS (I dont have everything install under one machine-reason for the double wamy crap), however, not sure how to integrate into this code:
automation:
alias: Turn on recording when there is movement
trigger:
- platform: state
entity_id: group.family
to: 'not home'
action:
service: homeassistant.turn_on
entity_id: script.recording
script:
recording:
alias: "Turn on recording and set timer"
sequence:
# Cancel ev. old timers
- service: script.turn_off
data:
entity_id: script.timer_off
- service: switch.recording_living_room_on
data:
entity_id: switch.recording_living_room
# Set new timer
- service: script.turn_on
data:
entity_id: script.timer_off
timer_off:
alias: "Turn off recording after 5 minutes"
sequence:
- delay:
minutes: 5
- service: switch.recording_living_room_off
data:
entity_id: switch.recording_living_room
(the switch comes from the command line shown before:
Sorry to bump, thanks for posting you helped me out. I hope this helps someone else: I was able to get the state working with the following. You will notice that http://ip:port/getobjectlist returns the camera state in column 5, delimited by comma.
2,1,true,Patio,Online,,,-1,false,-1
OK
I simply grep’d for the camera name (Patio) and then cut on comma field 5
“this site can not be reached” sounds like a different kind of problem. If whitelisting was your problem, you should be getting an error as I described above.
That’s how I have it configured in my HASS:
camera foo:
- platform: mjpeg
mjpeg_url: http://ispy.address:8080/mjpegfeed?oid=25&size=640x480
name: Foo
I’m not sure if HASS is rebroadcasting the MJPEG feed (probably not), or if your browser is directly fetching it. Try whitelisting the IP of your HASS instance as well as the IP of the machine where you access HASS from.
I was using iSpy for a while but found it to be really unreliable… I woud suggestr tryin out either Netcam studio on windows or Zoneminder on linux…
Hey guys. I am not able to integrate Agent DVR with my Home assistant via LAN. I released the ports on the windows 10 firewall, the ISPY server IP is the same as my computer and when I go to integrate the connection it fails. Is there something I’m missing?