No commit activity in last 3 years
No release in over 3 years
Fetches the motion and sound event data from the IP Webcam webserver API #Android #JSON #ipwebcam #ipcam
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

Introducing the IPWebcam_sensor2020 gem

require 'ipwebcam_sensor2020'


url = 'http://192.168.4.175:8080/sensors.json?from=1595594259140&sense=motion_active,sound'      
iws = IPWebcamSensor2020.new(url, sound_threshold: 30)

#iws.onmotion_enter { puts 'hello there!' }
#iws.onmotion_leave { puts 'goodbye!' }

#iws.onsound_start { puts 'hey, keep it down!'}
#iws.onsound_end { puts 'thank you!'}

iws.onmotionsound_start { puts 'I feel your presence'}
iws.onmotionsound_end { puts 'come back again soon'}

iws.start

In the above example the JSON data is read every 4 seconds from the IP Webcam app's webserver running on an Android phone. If motion and sound is detected, the message I feel your presence is displayed. When there is no longer motion continuously detected, the message come back again soon is displayed.

Initially I had planned on using the onmotion_enter event, however motion is easily triggered if there is a sudden change in natural light. The onsound_start event does work, but it can be easily triggered from a noise source in any direction, not just the specific physical area you are interest in.

The default quit sound level is set to 150dB. The sound threshold by default is set to 30dB, therefore any noise above 180dB triggers the sound event.

Resources

ipwebcam gem ipwebcamsensor2020 sensor motion sound trigger detection ipcam