Closed osh123 closed 2 months ago
Please, try this new beta firmware: y501gc_0.3.6.tar.gz
Also, this camera has temperature and humidity sensors, any chance I can read them and expose them to Home Assistant integration?
At the moment it's not possible, and without a cam under my hands it's very difficult to develop this feature.
The camera also has night vision support, will it also work? will it be possible to control it?
You can control the enable/disable, but when you enable it the cam will switch on/off automatically.
Hi,
Thank you for the firmware! I've managed to load it into the camera, but I'm unable to view the rtsp stream or take a snapshot.
Adding the I was able to see the temperature and humidity value with dmesg
:
[ 133.684747] ----sht3x temperature(26833), humidity(56146)----
root@yi-d203:~/bin#
Hi,
I Wrote a small script that fetches the temp data from dmesg and publishes it in MQTT:
#!/bin/sh
YI_HACK_PREFIX="/home/yi-hack"
CAMERA_CONF_FILE="$YI_HACK_PREFIX/etc/camera.conf"
MQTT_CONF_FILE="$YI_HACK_PREFIX/etc/mqttv4.conf"
. $MQTT_CONF_FILE
if [ -z "$MQTT_IP" ]; then
exit
fi
if [ -z "$MQTT_PORT" ]; then
exit
fi
if [ ! -z "$MQTT_USER" ]; then
MQTT_USER="-u $MQTT_USER"
fi
if [ ! -z "$MQTT_PASSWORD" ]; then
MQTT_PASSWORD="-P $MQTT_PASSWORD"
fi
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$YI_HACK_PREFIX/lib
TEMPERTURE=$(dmesg | tail -n 1 | grep -Eo '[0-9][0-9]+' | sed -n '3,3p')
TEMPERTURE=$(echo "scale=2; $TEMPERTURE/1000"| bc -l)
HUMIDITY=$(dmesg | tail -n 1 | grep -Eo '[0-9][0-9]+' | sed -n '4,4p')
HUMIDITY=$(echo "scale=2; $HUMIDITY/1000"| bc -l)
$YI_HACK_PREFIX/bin/mosquitto_pub -h "$MQTT_IP" -p "$MQTT_PORT" $MQTT_USER $MQTT_PASSWORD -t $MQTT_PREFIX/temperature -m "{\"temperature\": $TEMPERTURE, \"humidity\": $HUMIDITY}" -r
More than that, the camera also has a light that i would really like to control from HA, I've ran ipc_read
while toggling the light switch in app, the strange thing is that I'm getting the same message for both on and off, does it make sense to you? If so, I'll try to compile ip_cmd
with it and try to run it, can it cause damage to the camera?
This is the ipc_read
output:
IPC message. Len: 16. Status: No error information!
Parsing message
40 00 00 00 01 00 00 00 ff 00 ff 00 00 00 00 00
@
I Wrote a small script that fetches the temp data from dmesg and publishes it in MQTT:
Ok, I will try to add to the hack.
More than that, the camera also has a light that i would really like to control from HA, I've ran
ipc_read
while toggling the light switch in app, the strange thing is that I'm getting the same message for both on and off, does it make sense to you?
Probably the message you sniffed is not related to this function but you can try.
If so, I'll try to compile
ip_cmd
with it and try to run it
It's not necessary, you can load a message from file with ipc_cmd.
Save the file in binary mode with:
echo -ne '\x40\x00 ....' > /tmp/sd/message.bin
can it cause damage to the camera?
I can't be sure but it's never happened to me. And I have executed many commands...
About the stream, please send me a copy of your buffer /dev/shm/fshare_frame_buf
About the stream, please send me a copy of your buffer /dev/shm/fshare_frame_buf
https://drive.google.com/file/d/1-K7e7LzqW91J6t0hKw_Dx4UXc3wZGa-z/view?usp=sharing
It's not necessary, you can load a message from file with ipc_cmd. Save the file in binary mode with:
echo -ne '\x40\x00 ....' > /tmp/sd/message.bin
That's great! Thanks! I didn't work with that message, but now it will be easier to research.
Another update:
The correct message for light on is:
\x01\x00\x00\x00\x08\x00\x00\x00\x22\x40\x01\x00\x01\x00\x00\x00\x01
For light off its:
\x01\x00\x00\x00\x08\x00\x00\x00\x22\x40\x01\x00\x01\x00\x00\x00\x00
The light also has an option to control the brightness and it has a physical button as well.
I'll try to compile the code and implement it as a light entity in HA.
Thanks for all the help.
Another update: The correct message for light on is:
\x01\x00\x00\x00\x08\x00\x00\x00\x22\x40\x01\x00\x01\x00\x00\x00\x01
For light off its:\x01\x00\x00\x00\x08\x00\x00\x00\x22\x40\x01\x00\x01\x00\x00\x00\x00
The light also has an option to control the brightness and it has a physical button as well. I'll try to compile the code and implement it as a light entity in HA.
Thanks for all the help.
Great! Keep me updated. About the stream, try to overwrite the standard binaries with the content of this archive. It should work, both rtsp and snapshot. kami_stream_prg.tar.gz
Great! Keep me updated. About the stream, try to overwrite the standard binaries with the content of this archive. It should work, both rtsp and snapshot. kami_stream_prg.tar.gz
Still, doesn't stream either RTSP or snapshot.
Running the RTSP (and h264grabber_h) server with -d 3
gives the following error:
root@kami-baby:~/bin# rRTSPServer -m y501gc -r high -d 3
1695465909804: the size of the buffer is 1786224
1695465909805: mapping file fshare_frame_buf, size 1786224, to b6c11000
1695465909806: closing the file fshare_frame_buf
1695465909806: starting capture main loop
1695466018218: warning - -1 frame(s) lost
h264grabber is not needed anymore to run rRTSPServer.
It seems that rRTSPServer is not able to detect the type of stream. Please try low res stream.
h264grabber is not needed anymore to run rRTSPServer.
It seems that rRTSPServer is not able to detect the type of stream. Please try low res stream.
Same result with the low res stream. It doesn't seem to even listen to 554. Any other logs that could be useful for you?
https://drive.google.com/file/d/1BDX-IPlz9tgViZYksVgZZOIKqz1OoO2E/view?usp=sharing
This is another stream i captured (last one was with nc
, maybe it was incorrect?)
Any other way you recommend to capture it?
Thanks!
Ok, try this one: kami_stream_prg_2.tar.gz
Ok, try this one: kami_stream_prg_2.tar.gz
Seems to be working! low res is working smoothly (both stream and snapshot). high res stream is showing a gray screen every 10 secs or so, and high res snapshot is not working. But that's good for me :) Could it be that the high res stream is heavy on the camera resources?
Thank you!
Could it be that the high res stream is heavy on the camera resources?
Maybe but I will check again. High res snapshot should work. Did you enable swap space?
Oh, I found a problem in the ffmpeg compilation flags. Try this: imggrabber.gz
Oh, I found a problem in the ffmpeg compilation flags. Try this: imggrabber.gz
Worked :) Thank you!
I will add Kami Baby to the next release.
Can you wait for my light control implementation? 🙃
Yes, no problem. Could you check if temperature and humidity values are available in any ipc message?
Will do 😃
Another small issue with the snapshot service: calling snapshot.sh with watermark=no
causes the snapshot to fail.
This is strange. Did you try 2 or 3 times? It may happen that the cam is busy and returns error.
Tried multiple times, didn't work. Also, the high res stream seems very unstable, I'm getting a gray screen every few seconds. VLC is reporting about a lot of lost frames: around 57 frame for 20 seconds of running.
I will release a new versione of RTSP server. If you want, I can share a beta.
But it's a common problem with all cam that use hevc. Maybe a performance issue.
Sure, I can test it. It will be compatible with my model?
Yes it is. rRTSPServer.gz
Hi,
Installed the new version, still seeing some hangs. Any logs i can supply to help you understand the problem?
Thanks!
Yes, try to run this version with -d 15. Connect the client and post the output.
Apart from a few lost frames at the beginning there are no errors in the log. All frames are properly processed. Please try:
ffmpeg -i rtsp://IP/ch0_0.h264 test.mp4
ffmpeg
is also having gray screens even more frequently. tried to run with ffplay
also had gray screens and saw this in the log:
[hevc @ 0x7ff0fc7b89c0] Error parsing NAL unit #0.
[rtsp @ 0x7ff0fd816ac0] max delay reached. need to consume packet
[rtsp @ 0x7ff0fd816ac0] RTP: missed 3 packets
[hevc @ 0x7ff0fc7dd380] Could not find ref with POC 2
[hevc @ 0x7ff0fc79d940] Duplicate POC in a sequence: 3. 0B f=0/0
[hevc @ 0x7ff0fc79d940] Error parsing NAL unit #0.
[rtsp @ 0x7ff0fd816ac0] max delay reached. need to consume packet
[rtsp @ 0x7ff0fd816ac0] RTP: missed 1 packets
[hevc @ 0x7ff0fc768ac0] Could not find ref with POC 23 0B f=0/0
[rtsp @ 0x7ff0fd816ac0] max delay reached. need to consume packet
[rtsp @ 0x7ff0fd816ac0] RTP: missed 7 packets
[hevc @ 0x7ff0fc768ac0] Could not find ref with POC 38
[rtsp @ 0x7ff0fd816ac0] max delay reached. need to consume packet
[rtsp @ 0x7ff0fd816ac0] RTP: missed 5 packets
[rtsp @ 0x7ff0fd816ac0] max delay reached. need to consume packet
[rtsp @ 0x7ff0fd816ac0] RTP: missed 2 packets
[hevc @ 0x7ff0fc79d940] Could not find ref with POC 24
[rtsp @ 0x7ff0fd816ac0] max delay reached. need to consume packet
[rtsp @ 0x7ff0fd816ac0] RTP: missed 1 packets
Any chance its a network problem? the Wifi signal is 66%.
I will check the code.
Is low res stream ok?
Low res stream seems stable.
If you can, please try a test with the camera close to the router. Did you enable swap space?
Please, try this binary: rRTSPServer.gz
If you can, please try a test with the camera close to the router. Did you enable swap space?
I tried testing it close to the router - still it happens - gray screen. swap space is enabled.
Please, try this binary: rRTSPServer.gz
It seems much more stable, the gray screens are much less frequent.
Thank you
Ok, send me a log of the rtsp server. Stop the watchdog, stop the server and start the server in debug mode:
killall wd_rtsp.sh
killall rRTSPServer
rRTSPServer -m y501gc -r high -a no -p 554 -d 3
Finally, post the output.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Continuing the ticket in the roleoroleo/yi-hack-Allwinner-v2 project.
I would like to test a beta version for Kami Baby. Serial number is starting with LFUS, firmware version is 1.3.0.0C. Firmware backup: https://drive.google.com/file/d/1rSXdw0ar4VVb0X1-tJpdtiU8fOVGA9sa/view?usp=sharing Also, this camera has temperature and humidity sensors, any chance I can read them and expose them to Home Assistant integration? The camera also has night vision support, will it also work? will it be possible to control it?
Thanks a lot!