Skip to content

manzari/message-hass-motioneyeos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Motioneye Homeassistant MQTT Sensor

A simple script to update motion state in Homeassistant via MQTT

Its meant to be used by motioneye

Install

Install on a Raspberry Pi running motioneyeos

Pre build binary

curl https://github.com/manzari/message-hass-motioneyeos/releases/latest/download/message-hass --output /data/message-hass \
    && chmod +x /data/message-hass

Build from source

env GOOS=linux GOARCH=arm GOARM=5 \
go build -o ./build/message-hass
  • copy over the binary from the host./build/updatemqttmotion to motioneyeos /data/updatemqttmotion
  • make it executable chmod +x /data/updatemqttmotion
  • run it once to generate the default config /data/updatemqttmotion

Configure

Config File

Edit the file /data/etc/hass.json to suit your needs

{
  "Host": "192.168.178.33:1883",
  "User": "user",
  "Pass": "70p53cr37",
  "Dump": false,
  "Retain": false,
  "BaseTopic": "homeassistant",
  "Cameras": [
    {
      "DeviceName": "entrance_camera_motion",
      "DeiceFriendlyName": "Entrance Motion",
      "DeviceClass": "motion"
    }
  ],
  "AutoConfig": true
}

MotionEye UI

  • Go the hamburger menu to the left after logging in as admin
  • Open the Motion Notifications tab
  • Enter bash -c "/data/updatemqttmotion ON" into the field Run A Command
  • Enter bash -c "/data/updatemqttmotion OFF" into the field Run An End Command

For additional cameras

  • Enter bash -c "/data/updatemqttmotion -cam=1 ON" into the field Run A Command
  • Enter bash -c "/data/updatemqttmotion -cam=1 OFF" into the field Run An End Command