* Add amcrest camera services and deprecate switches
- Implement enabling and disabling motion detection from camera platform.
- Add amcrest specific camera services for controlling audio stream, motion recording, continuous recording and camera color mode, as well as moving camera to PTZ preset and starting and stopping PTZ tour function.
- Add camera attributes to indicate the state of the various camera settings controlled by the new services.
- Deprecate switches in favor of camera services and attributes.
* Rename services and move service handling to __init__.py
Rename services from 'camera.amcrest_xxx' to 'amcrest.xxx'. This allows services to be documented in services.yaml.
Add services.yaml.
Reorganize hass.data[DATA_AMCREST] and do some general cleanup to make various platform modules more consistent.
Move service handling code to __init__.py from camera.py.
* Update per review comments, part 1
- Rebase
- Add permission checking to services
- Change cv.ensure_list_csv to cv.ensure_list
- Add comment for "pointless-statement" in setup
- Change handler_services to handled_services
- Remove check if services have alreaday been registered
- Pass ffmpeg instead of hass to AmcrestCam __init__
- Remove writing motion_detection attr from device_state_attributes
- Change service methods from callbacks to coroutines
* Update per review comments, part 2
- Use dispatcher to signal camera entities to run services.
- Reorganize a bit, including moving a few things to new modules const.py & helpers.py.
* Update per review comments, part 3
Move call data extraction from camera.py to __init__.py.
* Add amcrest binary_sensors
Add binary_sensors with option motion_detected. Deprecate motion_detector sensor.
* Update per review
* Update per review
Add custom validators to make sure camera names are unique, and to issue warning if deprecated sensors option motion_detector is used.
async_setup_platform should not return a value.
* Another review update
Since there is only one type of binary_sensor, remove type test in update method.
* Amcrest: Add on/off support & attributes to camera entity. Bump amcrest package to 1.3.0.
Add support for turn_on & turn_off services.
Add implementation of is_recording method, as well as brand, model, hardware_version, machine_name, serial_number, software_build and software_version attributes.
Bump amcrest package to 1.3.0 required for above changes and also handles errors in storage commands which resolves#19982.
* Update per review
Rebase to upstream/dev.
Remove video_enabled property and setter and replace with _enable_video_stream
method.
Remove static attributes from camera and sensors.
amcrest 1.2.7 now includes camera's configured RTSP port in generated URL. Necessary to make new stream component work correctly if camera does not use default RTSP port.
* Serialize snapshot commands and bump amcrest package to 1.2.4
Attempting to send a snapshot command when a previous one hasn't finished will result in warnings and/or errors. This can happen when the camera picture is clicked on in the frontend, resulting in the thread that updates the thumbnail in the background every 10 seconds to sometimes collide with the thread that updates the large picture in the foreground quickly. An automation that calls the camera.snapshot service in yet another thread can make the situation worse. Fix by adding a thread lock to serialize snapshot commands. Also bump the amcrest package to 1.2.4 which fixes error handling in the command method and improves performance by reusing requests sessions.
* Update amcrest package to 1.2.4