############################################################
# edit this file and move it to /system/sdcard/config/mqtt.conf #
############################################################
export LD_LIBRARY_PATH='/thirdlib:/system/lib:/system/sdcard/lib'
# Options for mosquitto_sub & mosquitto_pub
USER=
PASS=
HOST=192.168.0.106
PORT=1883
# Define a location
LOCATION="Downstairs"
# Define device name
DEVICE_NAME="HomeCamera2"
# Define the base topic used by the camera
# send a message to myhome/dafang/set with the payload help for help.
# Results will be placed in myhome/dafang/${command} or topic/dafang/error - so please subscribe topic/dafang/# for testing purposes
TOPIC="$LOCATION/$DEVICE_NAME"
# Define an autodiscovery prefix, if autodiscovery is desired:
AUTODISCOVERY_PREFIX="homeassistant"
MOSQUITTOOPTS=""
# add Options for Mosquitto here. For example --cafile /system/sdcard/config/DST_Root_CA_X3.pem --tls-version tlsv1
# or using a special id to connect to brokers like azure
MOSQUITTOPUBOPTS=""
# add options for mosquitto_pub like -r for retaining messages
CURLOPTS="–-user root:ismart12"
FIFO=/var/run/mqtt-sub
# the FIFO used. Change it if you like to
STATUSINTERVAL=30
# Send a mqtt statusupdate every 30 seconds
STATUSFORMAT=json
# Configure format of status. Standard is text, uncomment this line for json
I’m stuck here as well. I can switch on both LEDs and RTSP just fine, but it does not switch off (HA flips the switch slider back after a few seconds). Also LEDs go back yellow/off after a while.
@jmtatsch Is there any chance you can share your HA config for Dafang switches esp. template values? Thanks a lot!
The slider goes back if there has happened an internal state update after the update interval (usually 30s). Especially the yellow led per default lights up as long as motion is detected.
The best thing, there is no more templates needed (at least for the main functionality:
LEDs
IR-CUT
Motion Detection/Tracking/Sensor
(Auto) Night Mode
Light sensor
Thus I would strongly recommend to use only the autodiscovered entities.
Only if you want the Uptime, Wireless link details you will need to parse them out of the json via templates.
You only need to reset mqtt-control to resend the discovery information. We could also resend the discovery information at a certain interval although I am not sure what a reasonable interval would be.
Hello
I have just start using the Hacks for Dafang and its works perfect.
The only thing i missing is the possibility to go to same saved positions.
Is this possible right now ?
Or is it the best to calibrate H and V and then send some mqtt to the position i want to monitor ?
I know that motion detection overrides the current state But when i flip the switch, the yellow/blue led turns on or the rtsp server starts. So far, so good. But the HA switch immediately goes back in same state as before. In that way I cannot turn off either led or stop the rtsp server.
Besides I am using template values, because even though HA gets mqtt information without problems, I don’t have any autodiscovered entities in my entity list. Besides that, everything works just fine, except switches turning off (or staying on), which you can see on the screenshot below (blue/rtsp are on but their respective switches off)
Sure, I could create two switches (or use optimistic: true) for on and off, but that’s not the way it was intended.
The HA switch immediately going back to the same state as before means that HA never got the acknowledgement of the state change. This probably means your state topic is wrong.
Please use autodiscovery, it is so much easier. And the dafang mqtt api is still changing, so if you do it everything manually things will eventually break.
Not possible right now. I am currently reworking the motor control api to sneak it in as two ‘cover’ devices via mqtt autodiscovery. That has an internal state with ticks and endstops. Also I am not sure calibration works as it should. I would expect that after calibration the camera should be exactly in the middle of its possible movement range, but its not by far.
Hello I’ve used the hack to enable the xiaofang to be added into my HA just like in the first post. The snapshots in the overview are working great, but when I click the image it doesn’t show the stream, just a laggy/static image that get refreshed in a minute or two
I’ve been looking for a solution but I can’t find anything, anyone have solved this issue???
Id is a unique id the HomeAssistant automation tool uses to track & manage automations. If you use the tool, HA will create one automatically for you. If not you will need to make one up in order to be able to use the tool again.
So how can I get “You should now be getting messages on topic myhome/mycamera/motion and images on myhome/mycamera/motion/snapshot while myhome/mycamera/motion/detection is set to ON” to work? Because Pushbullet is working if I trigger it manually but not automatically.
oh what do i do if mqtt-status shows me : NOK
reinstall all or is there something simpler?
everything else seems to work.
i want to create a motion detected automation which sends me a notify with pushbullet…
In the Xiaomi Mi Home app the camera is 100% stable. However if I load the custom firmware and I try to view the rtsp feed in full screen from HA the feed will crash and only a restart of rtsp feed will fix it. The video feed can last any where between 5 to 30 seconds before it crashes.
HA is a Docker running on Synology NAS. I guess that I should try using a raspberry pi build of Hassio.
I use Hassio on Pi and get same result, did many tests
When video in high resolution it freeze, stutter and eventually hang
When edit rtsp script file to output video 640x360@15FPS it works good, I get stable video stream in Home Assistant but very low quality
I think the problem is FFMPEG in HA, it is not using HW acceleration
When using Zoneminder Docker or Shinobi Docker I can view stream in high resolution on my Pi but with FFMPEG camera it works good only on very low quality