Migrate camera services to support translations (#96313)

* Migrate camera services to support translations

* Apply suggestions from code review

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>

* Update homeassistant/components/camera/strings.json

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>

---------

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>
This commit is contained in:
Franck Nijhof 2023-07-11 21:59:08 +02:00 committed by GitHub
parent 91273481a8
commit 76e3272432
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 62 additions and 29 deletions

View File

@ -1,65 +1,47 @@
# Describes the format for available camera services
turn_off:
name: Turn off
description: Turn off camera.
target:
entity:
domain: camera
turn_on:
name: Turn on
description: Turn on camera.
target:
entity:
domain: camera
enable_motion_detection:
name: Enable motion detection
description: Enable the motion detection in a camera.
target:
entity:
domain: camera
disable_motion_detection:
name: Disable motion detection
description: Disable the motion detection in a camera.
target:
entity:
domain: camera
snapshot:
name: Take snapshot
description: Take a snapshot from a camera.
target:
entity:
domain: camera
fields:
filename:
name: Filename
description: Template of a Filename. Variable is entity_id.
required: true
example: "/tmp/snapshot_{{ entity_id.name }}.jpg"
selector:
text:
play_stream:
name: Play stream
description: Play camera stream on supported media player.
target:
entity:
domain: camera
fields:
media_player:
name: Media Player
description: Name(s) of media player to stream to.
required: true
selector:
entity:
domain: media_player
format:
name: Format
description: Stream format supported by media player.
default: "hls"
selector:
select:
@ -67,22 +49,16 @@ play_stream:
- "hls"
record:
name: Record
description: Record live camera feed.
target:
entity:
domain: camera
fields:
filename:
name: Filename
description: Template of a Filename. Variable is entity_id. Must be mp4.
required: true
example: "/tmp/snapshot_{{ entity_id.name }}.mp4"
selector:
text:
duration:
name: Duration
description: Target recording length.
default: 30
selector:
number:
@ -90,10 +66,6 @@ record:
max: 3600
unit_of_measurement: seconds
lookback:
name: Lookback
description:
Target lookback period to include in addition to duration. Only
available if there is currently an active HLS stream.
default: 0
selector:
number:

View File

@ -34,5 +34,66 @@
}
}
}
}
},
"services": {
"turn_off": {
"name": "Turn off",
"description": "Turns off the camera."
},
"turn_on": {
"name": "Turn on",
"description": "Turns on the camera."
},
"enable_motion_detection": {
"name": "Enable motion detection",
"description": "Enables the motion detection."
},
"disable_motion_detection": {
"name": "Disable motion detection",
"description": "Disables the motion detection."
},
"snapshot": {
"name": "Take snapshot",
"description": "Takes a snapshot from a camera.",
"fields": {
"filename": {
"name": "Filename",
"description": "Template of a filename. Variable available is `entity_id`."
}
}
},
"play_stream": {
"name": "Play stream",
"description": "Plays the camera stream on a supported media player.",
"fields": {
"media_player": {
"name": "Media player",
"description": "Media players to stream to."
},
"format": {
"name": "Format",
"description": "Stream format supported by the media player."
}
}
},
"record": {
"name": "Record",
"description": "Creates a recording of a live camera feed.",
"fields": {
"filename": {
"name": "[%key:component::camera::services::snapshot::fields::filename::name%]",
"description": "Template of a filename. Variable available is `entity_id`. Must be mp4."
},
"duration": {
"name": "Duration",
"description": "Planned duration of the recording. The actual duration may vary."
},
"lookback": {
"name": "Lookback",
"description": "Planned lookback period to include in the recording (in addition to the duration). Only available if there is currently an active HLS stream. The actual length of the lookback period may vary."
}
}
}
},
"selector": {}
}