roleoroleo / sonoff-hack

Custom firmware for Sonoff GK-200MP2B camera
GNU General Public License v3.0
200 stars 45 forks source link

MQTT issues - motion, birth will messages #76

Closed eugeene closed 2 years ago

eugeene commented 2 years ago

I have the 'C' cam revision. Everything is fine. But I have two issues:

  1. on boot the cam briefly sends MQTT 'online' status and then sends and stays on 'offline' Is it possible, the message settings are backwards?

  2. the MQTT motion_detection is never sent - seems it is not working? Should i try some different setting?

Thank you!

roleoroleo commented 2 years ago

Maybe there is a conflict between different mqtt connections. Are you using mqtt advertise? How many cams do you have?

eugeene commented 2 years ago

I have only single camera. But many other tasmota devices (with completely MQTT different topics, so this should be irelevant.)

roleoroleo commented 2 years ago

Please, send me your mqtt.conf file.

eugeene commented 2 years ago

Hello, It is basically the vanilla config, just changed the server ip and credentials.

###############################################################################
#                       Configuration file for mqtt-sonoff                    #
###############################################################################

# -----------------------------------------------------------------------------
# Basic MQTT settings
# -----------------------------------------------------------------------------

MQTT_IP=192.168.50.1
MQTT_PORT=1883

MQTT_CLIENT_ID=sonoff-cam

MQTT_USER=mqtt
MQTT_PASSWORD=********

MQTT_PREFIX=sonoffcam

# -----------------------------------------------------------------------------
# Set the topics where the messages will be published
# The final topic will be MQTT_PREFIX/TOPIC_MOTION
# -----------------------------------------------------------------------------

TOPIC_BIRTH_WILL=status
TOPIC_MOTION=motion_detection
TOPIC_MOTION_IMAGE=motion_detection_image

# -----------------------------------------------------------------------------
# Set the topics messages
# -----------------------------------------------------------------------------

BIRTH_MSG=online
WILL_MSG=offline
MOTION_START_MSG=motion_start
MOTION_STOP_MSG=motion_stop

# -----------------------------------------------------------------------------
# Other settings
# -----------------------------------------------------------------------------

MQTT_KEEPALIVE=120
MQTT_QOS=1
MQTT_RETAIN_BIRTH_WILL=1
MQTT_RETAIN_MOTION=1
MQTT_RETAIN_MOTION_IMAGE=1
roleoroleo commented 2 years ago

Ok, the config is ok. Try to kill the process mqtt-sonoff and restart it manually. And post the output.

eugeene commented 2 years ago

I changed literally nothing and the birth/will messages are working (for now) I guess there were retained messages on the server or something. But the motion sensing is still not working. Should I enable it in the native eWlink app or is enabling it via web administration enough?

Also with your hack, the camera appears online in the eWelink app, but I cant 'connect' to it - the stream is not visible (connecting to device, please wait), can't change any settings. I dont care about the native eWelink app, just sayin'

Thanks for your time

eugeene commented 2 years ago

Ok, so I took the SD card out, enabled motion in the native app (had it enabled via the web interface only), put the SD card back and now the MQTT motion sensing seems to be working. No idea if this is supposed to be like that, but it's working!

So thank you for your time again ;)

roleoroleo commented 2 years ago

I will check both the motion enable/disable and app connection. Thank you.