yi-hack-Allwinner-v2
yi-hack-Allwinner-v2 copied to clipboard
Access media files from home assistant
Hi is there a way to access these media files from home assistant ?
It would be nice to add this folder to media section and watch them directly from this section.
You can upload the file to an FTP server or access them with the web services. Check the wiki: https://github.com/roleoroleo/yi-hack-Allwinner-v2/wiki/Web-services-description
Yes, but now finding a file is a pain in the ass.
I'm thinking about something more "user friendly" Accessing camera sd card like a network drive, and put the video catalog to media section in HA The whole main catalog of video files, let's say " Yihack", then subfolder with specific days, hours and inside a list of files to play. Just like frigate does ( screen below) It would be much easier to watch and find a specific video from specific
I do not know whether it is possible or not, It is just a wish to consider :) But I think it would be a great thing.
Try the new release of the integration.
Wow Great 😊👍 thanks . There is now a new folder yihackin media section but when I go inside, error appears. Any solution?
Please, check the registry log and send me the error.
This is what it should appear:
Log below
Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/yi_hack/media_source.py:76 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 06:23:53 (3 occurrences) Last logged: 08:39:47
[547642575360] Error handling message: Unknown error [547642851184] Error handling message: Unknown error Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response await func(hass, connection, msg) File "/usr/src/homeassistant/homeassistant/components/media_source/init.py", line 152, in websocket_browse_media media = await async_browse_media(hass, msg.get("media_content_id", "")) File "/usr/src/homeassistant/homeassistant/components/media_source/init.py", line 111, in async_browse_media item = await _get_media_item(hass, media_content_id).async_browse() File "/usr/src/homeassistant/homeassistant/components/media_source/models.py", line 85, in async_browse return await self.async_media_source().async_browse_media(self) File "/config/custom_components/yi_hack/media_source.py", line 76, in async_browse_media domain = list(list(device.identifiers)[0])[0] IndexError: list index out of range
Try this file: media_source.py.gz
Now Works flawlessly, Thanks! For the feature and for help. You're the best !!!
With the next release cam/integration the video will have a thumbnail that will display the first frame, as shown in my previous post.
Great 👍😃 Couldn't ask for more. Appreciate the job
Hi, I updated camera to the latest 0.2.1 release, but there is no thumbnail, still just icons yi-hack Home Assistant integration is also updated to 0.3.8
Login with ssh and check if crontab file is ok:
root@yi-hack-allwinner:~# cat /var/spool/cron/crontabs/root
* * * * * /home/yi-hack/script/thumb.sh cron
0 * * * * sleep 20; /home/yi-hack/script/clean_records.sh 30
Try to run the process manually and check the output:
root@yi-hack-allwinner:~# . /home/yi-hack/script/env.sh
root@yi-hack-allwinner:~# /home/yi-hack/script/thumb.sh cron
I get this
I've edited it a little and process started
Sorry, I got confused with Allwinner. This is for Allwinner-v2
root@yi-hack-allwinner-v2:~# cat /var/spool/cron/crontabs/root
* * * * * /tmp/sd/yi-hack/script/thumb.sh cron
0 * * * * sleep 20; /tmp/sd/yi-hack/script/clean_records.sh 30
Try to run the process manually and check the output:
root@yi-hack-allwinner-v2:~# . /tmp/sd/yi-hack/script/env.sh
root@yi-hack-allwinner-v2:~# /tmp/sd/yi-hack/script/thumb.sh cron
Did you understand why the script didn't start?
It is running now, starting thumb.sh cron helped. Thumbnails are being created and I can see them in the media section.
To be honest I have no idea why the script did not run automatically after the update and reboot
You wrote 0 * * * * sleep 20; /tmp/sd/yi-hack/script/clean_records.sh 30
and I have 0 * * * * sleep 20; /tmp/sd/yi-hack/script/clean_records.sh 5
How do I change it ? was it the reason ?
Proces makes thumbnails, but only once. New records do not have them and cron does not start automatically again. How do I change it ?
Is crond running?
How do I check that?
root@yi-hack-allwinner-v2:~# ps | grep crond
The process is ok, I don't understand.
and I have 0 * * * * sleep 20; /tmp/sd/yi-hack/script/clean_records.sh 5
This is another process, don't care. Do you have another line with thumb.sh or just this line with clean_records.sh?
I have this lines
When I paste: root@yi-hack-allwinner-v2:~# /tmp/sd/yi-hack/script/thumb.sh cron
Proces starts just one time, when I paste: root@yi-hack-allwinner-v2:~# . /tmp/sd/yi-hack/script/env.sh
Nothing happens, maybe this is the reason ?
It's ok. env.sh command sets environment variable.
Check if there are empty jpg in the record folder. If the process find a jpg file it doesn't try to create it again. But if the file is zero lenght you can't see the image in the media source.
I did not find any empty jpg :(
If it is a cron then how often should the process start? Every 1 hr ?
"* * * * *" means every 1 minute.
Found the problem. Check the last commit: https://github.com/roleoroleo/yi-hack-Allwinner-v2/commit/968dd8580b1800c2b0ae0d035a171be490b21781
Great 😃👍 can I test it now, upadte via ssh ? How? Or wait till next release?
upadte via ssh ?
Yes.
But how ?