in the Motion Notifications field, but neither of these things appear to change the state of the sensor when there’s motion, even though I can trigger the state manually by executing the exact same commands from the terminal.
I still have the same problem after adding the full path.
Shinobi looks pretty cool. Uses FFMPEG, which HA clearly supports. And that video is adorable. Not sure if it will run on a Pi though. That’s kind of my own fault. I need a grown-up computer.
OK. I had to reboot MotionEye for some reason because the MJPEG stream started messing up as well. Now the motion sensor works and I have my first working automation:
- action:
- alias: light.studio
data:
entity_id: light.studio
service: light.turn_on
alias: Turn on light when I enter studio
id: '1499546682238'
trigger:
- entity_id: binary_sensor.studio_motion
from: 'off'
platform: state
to: 'on'
so what do i need for a command or webhook to send to google homeassistant text to speech alert? i have motioneyeos on a raspberry pi 2, i might just install motioneye on top of stretch with pihole though or something, but i also run another raspberry pi 3 with hassbian.
i get an error when using requests with python to the resfulapi {"message":"invalid JSON specified"}, have you run into that issue before? i’m only asking because it appears youve been a member since 2016, where i have less time with home assistant!FIXED it was an issue with my python script not having the json values in quotes.
hey… ialready ran such a curl command but in another epoche I am actually starting from scratch with my new intel NUC as my pi and setup seems a bit let’s say : Overkilled and played-to death I will try your suggestion and will revert to you as soon as my system is running up again.
import RPi.GPIO as GPIO
import time
import requests
GPIO.setmode(GPIO.BCM)
GPIO.setup(pinnumber, GPIO.IN) #PIR
#GPIO.setup(24, GPIO.OUT) #BUzzer
url = 'http://ipaddress:8123/api/states/binary_sensor.motionsensor'
headers = {'x-ha-access': 'password', 'content-type': 'application/json'}
data = '{"state": "on", "attributes": {"friendly_name": "MotionSensor"}}'
url1 = 'http://ipaddress:8123/api/states/binary_sensor.motionsensor'
headers1 = {'x-ha-access': 'password', 'content-type': 'application/json'}
data1 = '{"state": "off", "attributes": {"friendly_name": "MotionSensor"}}'
def sensor():
try:
time.sleep(2) # to stabilize sensor
while True:
if GPIO.input(pinnumber):
#GPIO.output(24, True)
#time.sleep(0.5) #Buzzer turns on for 0.5 sec
#GPIO.output(24, False)
#print("Motion Detected...")
#localtime = time.asctime( time.localtime(time.time()) )
#print(localtime)
response = requests.post(url, headers=headers, data=data)
#print(response.text)
time.sleep(5) #to avoid multiple detection
response1 = requests.post(url1, headers=headers1, data=data1)
#print(response1.text)
time.sleep(0.1) #loop delay, should be less than detection delay
except:
GPIO.cleanup()
sensor()
sensor()
chmod +x script.py
i do a an autostart using sudo nano ~/.config/lxsession/LXDE-pi/autostart
then add @sudo python script.py at the bottom of the file.
i myself havent used zoneminder, but adding other components to motioneye rather than only cameras would be fantastic. im still trying to work on my script for my pir sensor so that it has a schedule too.
I must admit, I’ve tried Zoneminder, and the only thing I can say that I like over Motioneye was the ability to create zoned areas so that motion detection wasn’t even applied to certain parts of the images (property that you don’t own etc). There were, however more disadvantages than advantages in my option and so I switched back to Motioneye but obviously I am stuck with the same restriction of viewing cameras the same as everyone else.