Closed bjeanes closed 2 years ago
@bjeanes you can achieve that by turning the camera off and on via services.
Ah fantastic. I didn't realise that would have that effect already :). Thanks for the prompt reply!
@evilmarty ah the caveat here is that stopping the camera also stops me from viewing the accumulated timelapse (the /api/camera_proxy/camera.xxxx/
route returns a 503`. More so I'm hoping to have it continue to show/loop the frames that do exist but stop capturing new frames. This is for a timelapse of a garden situation, so being able to see if the plant was starting to droop before the lights went out to identify watering issues is the goal here.
Any ideas?
@bjeanes if that is so then it'll have to be controlled by service calls, which need to be implemented.
@bjeanes I've added the ability to use service calls to pause and resume recording. Hopefully that should suffice your needs.
Thank you! I'll try it out tonight.
I was unable to get this working. I updated to the 3e4fa7a via HACS, restarted HA, but the new services do not show up in service dev tools.
If I create an automation to use what I assume is the service names (based on looking at the code), I get:
The services don't show up under mjpeg_timelapse
nor camera
:
There's a newer version with some fixes. Can you try update and try again?
I'm on 3e4fa7a already and AFAICT that is the tip of main
It's odd that the services don't appear. Are there any errors in the logs?
Nothing that I can see, no. I will try uninstalling and re-installing the integration via HACS, restarting in between. Perhaps those service registrations only happen once and not each boot...
Uninstalled HACS. Restarted. Re-installed. Restarted. Still only the Clear images
service shows up. As a sanity check, I SSHd into HASS to check that it is using the right version of the code:
[core-ssh mjpeg_timelapse]$ pwd
/root/config/custom_components/mjpeg_timelapse
[core-ssh mjpeg_timelapse]$ cat services.yaml
clear_images:
name: Clear images
description: Deletes all recorded images.
target:
entity:
integration: mjpeg_timelapse
domain: camera
pause_recording:
name: Pause recording
description: Pauses fetching and saving images.
target:
entity:
integration: mjpeg_timelapse
domain: camera
resume_recording:
name: Resume recording
description: Resumes saving images.
target:
entity:
integration: mjpeg_timelapse
domain: camera
If I grep
for clear_images
vs the new services, the only notable difference is that only clear_images
is registered in async_setup_platform
: https://github.com/evilmarty/mjpeg-timelapse/blob/3e4fa7a02c2ecdfb3e582cd3b99b76bdad4a98aa/custom_components/mjpeg_timelapse/camera.py#L100-L111
Is that perhaps the issue?
That bit of code doesn't do anything. The part that does is above it in async_setup_entry
:
It's weird that one is working whilst the other is not. What version of HA are you using?
@bjeanes I figured it out. You are right, if you defined your entries in customization.yml
then they would not be available. If you had used the HA they would have been available.
Hah! ~I see. Can you make it work with customizations.yml
?~ I am using that because you have not enabled re-configuration via HA and so I'm still tweaking a few things. Working now!
I'm wondering if it would be possible to pause and resume the capture of frames for this integration? Perhaps with a service to start and stop? The use-case here is to stop capturing at a low light level and just show frames from when the image (from a camera) is light. Before finding this integration, I was planning to use the
camera.*
services to take a photo conditionally and have affmpeg
process stitch together the frames into a video to play, but something like this integration would work much nicer if it were possible to suppress capture (e.g. from an automation).