hi all, I’ve been going around in circles for days with MQTT / MotionEye / Motion Binary Sensor. I think I have missed something with the documentation which I’m finding difficult to follow. my use case is that I want to send a moquito publish command to mqtt on home assistant when motion is detected in motioneye. I am using the following command:
Do I have to send a config for that topic to mqtt at first before sending the state commands? I’m really not clear from the mqtt docs how I do that? I have set the discovery topic to cameras instead of homeassistant to try and force the discovery of this topic.
When I set the payload to ON manually on this topic using the MQTT integration Publish a packet feature, my binary sensor updates it’s state to motion detected, but when I test the mqtt publish command from motioneye, I am never able to get the binary sensor to change its state. This makes me think that my command above is wrong somehow, or I do not have the configuration of MQTT set in a way that allows this published command to be received by the broker.
Please can anyone help? Unfortunately many of the community forum posts are from before the change to mqtt config which is making things even more confusing.
Thanks for this. I tried these payload_on and off entries already, but unfortunately they didn’t make a difference. The sensor remained in an unavailable state.
Thanks for this suggestion. I’ve definitely found webhooks easier for the notifcation automation which I’ve created. But I haven’t been able to get the webhook trigger working with the binary sensor. What is the difference between using Post Query and Post JSON, I had mainly been testing with Post JSON. But I’m not sure how to read that json or query for debugging.
Working automation for notification
- id: 'xxxxxxx'
alias: MotionEye webhook motion notification
description: ''
trigger:
- platform: webhook
allowed_methods:
- POST
- PUT
local_only: true
webhook_id: motioneyeonXX
condition: []
action:
- service: notify.mobile_app_iphone
data:
message: Motion detected on Front Porch
data:
entity_id: camera.camera_name
actions:
- action: URI
title: Open Camera
uri: /lovelace/cameras
Ideally I’d like a binary sensor which triggers a binary sensor state change based on both the motioneyeonXX and motioneyeoffYY webhooks. But my templating isn’t good enough to figure this out.