From ade1d333677d461f778001bed8c1347f5500ac8e Mon Sep 17 00:00:00 2001 From: starkillerOG Date: Tue, 22 Aug 2023 23:07:31 +0200 Subject: [PATCH] Add entity name translations for Reolink (#98589) Co-authored-by: Joost Lekkerkerker --- .../components/reolink/binary_sensor.py | 17 +- homeassistant/components/reolink/button.py | 20 +- homeassistant/components/reolink/light.py | 6 +- homeassistant/components/reolink/number.py | 38 ++-- homeassistant/components/reolink/select.py | 17 +- homeassistant/components/reolink/siren.py | 2 +- homeassistant/components/reolink/strings.json | 203 ++++++++++++++++++ homeassistant/components/reolink/switch.py | 32 +-- homeassistant/components/reolink/update.py | 1 - tests/components/reolink/test_init.py | 2 +- 10 files changed, 269 insertions(+), 69 deletions(-) diff --git a/homeassistant/components/reolink/binary_sensor.py b/homeassistant/components/reolink/binary_sensor.py index 996f2c6b3ab..49e964e2b3f 100644 --- a/homeassistant/components/reolink/binary_sensor.py +++ b/homeassistant/components/reolink/binary_sensor.py @@ -49,26 +49,25 @@ class ReolinkBinarySensorEntityDescription( BINARY_SENSORS = ( ReolinkBinarySensorEntityDescription( key="motion", - name="Motion", device_class=BinarySensorDeviceClass.MOTION, value=lambda api, ch: api.motion_detected(ch), ), ReolinkBinarySensorEntityDescription( key=FACE_DETECTION_TYPE, - name="Face", + translation_key="face", icon="mdi:face-recognition", value=lambda api, ch: api.ai_detected(ch, FACE_DETECTION_TYPE), supported=lambda api, ch: api.ai_supported(ch, FACE_DETECTION_TYPE), ), ReolinkBinarySensorEntityDescription( key=PERSON_DETECTION_TYPE, - name="Person", + translation_key="person", value=lambda api, ch: api.ai_detected(ch, PERSON_DETECTION_TYPE), supported=lambda api, ch: api.ai_supported(ch, PERSON_DETECTION_TYPE), ), ReolinkBinarySensorEntityDescription( key=VEHICLE_DETECTION_TYPE, - name="Vehicle", + translation_key="vehicle", icon="mdi:car", icon_off="mdi:car-off", value=lambda api, ch: api.ai_detected(ch, VEHICLE_DETECTION_TYPE), @@ -76,7 +75,7 @@ BINARY_SENSORS = ( ), ReolinkBinarySensorEntityDescription( key=PET_DETECTION_TYPE, - name="Pet", + translation_key="pet", icon="mdi:dog-side", icon_off="mdi:dog-side-off", value=lambda api, ch: api.ai_detected(ch, PET_DETECTION_TYPE), @@ -84,7 +83,7 @@ BINARY_SENSORS = ( ), ReolinkBinarySensorEntityDescription( key="visitor", - name="Visitor", + translation_key="visitor", icon="mdi:bell-ring-outline", icon_off="mdi:doorbell", value=lambda api, ch: api.visitor_detected(ch), @@ -130,7 +129,11 @@ class ReolinkBinarySensorEntity(ReolinkChannelCoordinatorEntity, BinarySensorEnt self.entity_description = entity_description if self._host.api.model in DUAL_LENS_DUAL_MOTION_MODELS: - self._attr_name = f"{entity_description.name} lens {self._channel}" + if entity_description.translation_key is not None: + key = entity_description.translation_key + else: + key = entity_description.key + self._attr_translation_key = f"{key}_lens_{self._channel}" self._attr_unique_id = ( f"{self._host.unique_id}_{self._channel}_{entity_description.key}" diff --git a/homeassistant/components/reolink/button.py b/homeassistant/components/reolink/button.py index 93ea5810bb6..f1797527914 100644 --- a/homeassistant/components/reolink/button.py +++ b/homeassistant/components/reolink/button.py @@ -58,7 +58,7 @@ class ReolinkHostButtonEntityDescription( BUTTON_ENTITIES = ( ReolinkButtonEntityDescription( key="ptz_stop", - name="PTZ stop", + translation_key="ptz_stop", icon="mdi:pan", enabled_default=lambda api, ch: api.supported(ch, "pan_tilt"), supported=lambda api, ch: api.supported(ch, "pan_tilt") @@ -67,35 +67,35 @@ BUTTON_ENTITIES = ( ), ReolinkButtonEntityDescription( key="ptz_left", - name="PTZ left", + translation_key="ptz_left", icon="mdi:pan", supported=lambda api, ch: api.supported(ch, "pan"), method=lambda api, ch: api.set_ptz_command(ch, command=PtzEnum.left.value), ), ReolinkButtonEntityDescription( key="ptz_right", - name="PTZ right", + translation_key="ptz_right", icon="mdi:pan", supported=lambda api, ch: api.supported(ch, "pan"), method=lambda api, ch: api.set_ptz_command(ch, command=PtzEnum.right.value), ), ReolinkButtonEntityDescription( key="ptz_up", - name="PTZ up", + translation_key="ptz_up", icon="mdi:pan", supported=lambda api, ch: api.supported(ch, "tilt"), method=lambda api, ch: api.set_ptz_command(ch, command=PtzEnum.up.value), ), ReolinkButtonEntityDescription( key="ptz_down", - name="PTZ down", + translation_key="ptz_down", icon="mdi:pan", supported=lambda api, ch: api.supported(ch, "tilt"), method=lambda api, ch: api.set_ptz_command(ch, command=PtzEnum.down.value), ), ReolinkButtonEntityDescription( key="ptz_zoom_in", - name="PTZ zoom in", + translation_key="ptz_zoom_in", icon="mdi:magnify", entity_registry_enabled_default=False, supported=lambda api, ch: api.supported(ch, "zoom_basic"), @@ -103,7 +103,7 @@ BUTTON_ENTITIES = ( ), ReolinkButtonEntityDescription( key="ptz_zoom_out", - name="PTZ zoom out", + translation_key="ptz_zoom_out", icon="mdi:magnify", entity_registry_enabled_default=False, supported=lambda api, ch: api.supported(ch, "zoom_basic"), @@ -111,7 +111,7 @@ BUTTON_ENTITIES = ( ), ReolinkButtonEntityDescription( key="ptz_calibrate", - name="PTZ calibrate", + translation_key="ptz_calibrate", icon="mdi:pan", entity_category=EntityCategory.CONFIG, supported=lambda api, ch: api.supported(ch, "ptz_callibrate"), @@ -119,14 +119,14 @@ BUTTON_ENTITIES = ( ), ReolinkButtonEntityDescription( key="guard_go_to", - name="Guard go to", + translation_key="guard_go_to", icon="mdi:crosshairs-gps", supported=lambda api, ch: api.supported(ch, "ptz_guard"), method=lambda api, ch: api.set_ptz_guard(ch, command=GuardEnum.goto.value), ), ReolinkButtonEntityDescription( key="guard_set", - name="Guard set current position", + translation_key="guard_set", icon="mdi:crosshairs-gps", entity_category=EntityCategory.CONFIG, supported=lambda api, ch: api.supported(ch, "ptz_guard"), diff --git a/homeassistant/components/reolink/light.py b/homeassistant/components/reolink/light.py index 0f80215d506..4ac8166410f 100644 --- a/homeassistant/components/reolink/light.py +++ b/homeassistant/components/reolink/light.py @@ -45,7 +45,7 @@ class ReolinkLightEntityDescription( LIGHT_ENTITIES = ( ReolinkLightEntityDescription( key="floodlight", - name="Floodlight", + translation_key="floodlight", icon="mdi:spotlight-beam", supported_fn=lambda api, ch: api.supported(ch, "floodLight"), is_on_fn=lambda api, ch: api.whiteled_state(ch), @@ -55,7 +55,7 @@ LIGHT_ENTITIES = ( ), ReolinkLightEntityDescription( key="ir_lights", - name="Infra red lights in night mode", + translation_key="ir_lights", icon="mdi:led-off", entity_category=EntityCategory.CONFIG, supported_fn=lambda api, ch: api.supported(ch, "ir_lights"), @@ -64,7 +64,7 @@ LIGHT_ENTITIES = ( ), ReolinkLightEntityDescription( key="status_led", - name="Status LED", + translation_key="status_led", icon="mdi:lightning-bolt-circle", entity_category=EntityCategory.CONFIG, supported_fn=lambda api, ch: api.supported(ch, "power_led"), diff --git a/homeassistant/components/reolink/number.py b/homeassistant/components/reolink/number.py index 1be6cd24027..24e5d1bd72b 100644 --- a/homeassistant/components/reolink/number.py +++ b/homeassistant/components/reolink/number.py @@ -45,7 +45,7 @@ class ReolinkNumberEntityDescription( NUMBER_ENTITIES = ( ReolinkNumberEntityDescription( key="zoom", - name="Zoom", + translation_key="zoom", icon="mdi:magnify", mode=NumberMode.SLIDER, native_step=1, @@ -57,7 +57,7 @@ NUMBER_ENTITIES = ( ), ReolinkNumberEntityDescription( key="focus", - name="Focus", + translation_key="focus", icon="mdi:focus-field", mode=NumberMode.SLIDER, native_step=1, @@ -72,7 +72,7 @@ NUMBER_ENTITIES = ( # or when using the "light.floodlight" entity. ReolinkNumberEntityDescription( key="floodlight_brightness", - name="Floodlight turn on brightness", + translation_key="floodlight_brightness", icon="mdi:spotlight-beam", entity_category=EntityCategory.CONFIG, native_step=1, @@ -84,7 +84,7 @@ NUMBER_ENTITIES = ( ), ReolinkNumberEntityDescription( key="volume", - name="Volume", + translation_key="volume", icon="mdi:volume-high", entity_category=EntityCategory.CONFIG, native_step=1, @@ -96,7 +96,7 @@ NUMBER_ENTITIES = ( ), ReolinkNumberEntityDescription( key="guard_return_time", - name="Guard return time", + translation_key="guard_return_time", icon="mdi:crosshairs-gps", entity_category=EntityCategory.CONFIG, native_step=1, @@ -109,7 +109,7 @@ NUMBER_ENTITIES = ( ), ReolinkNumberEntityDescription( key="motion_sensitivity", - name="Motion sensitivity", + translation_key="motion_sensitivity", icon="mdi:motion-sensor", entity_category=EntityCategory.CONFIG, native_step=1, @@ -121,7 +121,7 @@ NUMBER_ENTITIES = ( ), ReolinkNumberEntityDescription( key="ai_face_sensititvity", - name="AI face sensitivity", + translation_key="ai_face_sensititvity", icon="mdi:face-recognition", entity_category=EntityCategory.CONFIG, native_step=1, @@ -135,7 +135,7 @@ NUMBER_ENTITIES = ( ), ReolinkNumberEntityDescription( key="ai_person_sensititvity", - name="AI person sensitivity", + translation_key="ai_person_sensititvity", icon="mdi:account", entity_category=EntityCategory.CONFIG, native_step=1, @@ -149,7 +149,7 @@ NUMBER_ENTITIES = ( ), ReolinkNumberEntityDescription( key="ai_vehicle_sensititvity", - name="AI vehicle sensitivity", + translation_key="ai_vehicle_sensititvity", icon="mdi:car", entity_category=EntityCategory.CONFIG, native_step=1, @@ -163,7 +163,7 @@ NUMBER_ENTITIES = ( ), ReolinkNumberEntityDescription( key="ai_pet_sensititvity", - name="AI pet sensitivity", + translation_key="ai_pet_sensititvity", icon="mdi:dog-side", entity_category=EntityCategory.CONFIG, native_step=1, @@ -177,7 +177,7 @@ NUMBER_ENTITIES = ( ), ReolinkNumberEntityDescription( key="ai_face_delay", - name="AI face delay", + translation_key="ai_face_delay", icon="mdi:face-recognition", entity_category=EntityCategory.CONFIG, entity_registry_enabled_default=False, @@ -193,7 +193,7 @@ NUMBER_ENTITIES = ( ), ReolinkNumberEntityDescription( key="ai_person_delay", - name="AI person delay", + translation_key="ai_person_delay", icon="mdi:account", entity_category=EntityCategory.CONFIG, entity_registry_enabled_default=False, @@ -209,7 +209,7 @@ NUMBER_ENTITIES = ( ), ReolinkNumberEntityDescription( key="ai_vehicle_delay", - name="AI vehicle delay", + translation_key="ai_vehicle_delay", icon="mdi:car", entity_category=EntityCategory.CONFIG, entity_registry_enabled_default=False, @@ -225,7 +225,7 @@ NUMBER_ENTITIES = ( ), ReolinkNumberEntityDescription( key="ai_pet_delay", - name="AI pet delay", + translation_key="ai_pet_delay", icon="mdi:dog-side", entity_category=EntityCategory.CONFIG, entity_registry_enabled_default=False, @@ -241,7 +241,7 @@ NUMBER_ENTITIES = ( ), ReolinkNumberEntityDescription( key="auto_quick_reply_time", - name="Auto quick reply time", + translation_key="auto_quick_reply_time", icon="mdi:message-reply-text-outline", entity_category=EntityCategory.CONFIG, native_step=1, @@ -254,7 +254,7 @@ NUMBER_ENTITIES = ( ), ReolinkNumberEntityDescription( key="auto_track_limit_left", - name="Auto track limit left", + translation_key="auto_track_limit_left", icon="mdi:angle-acute", mode=NumberMode.SLIDER, entity_category=EntityCategory.CONFIG, @@ -267,7 +267,7 @@ NUMBER_ENTITIES = ( ), ReolinkNumberEntityDescription( key="auto_track_limit_right", - name="Auto track limit right", + translation_key="auto_track_limit_right", icon="mdi:angle-acute", mode=NumberMode.SLIDER, entity_category=EntityCategory.CONFIG, @@ -280,7 +280,7 @@ NUMBER_ENTITIES = ( ), ReolinkNumberEntityDescription( key="auto_track_disappear_time", - name="Auto track disappear time", + translation_key="auto_track_disappear_time", icon="mdi:target-account", entity_category=EntityCategory.CONFIG, native_step=1, @@ -295,7 +295,7 @@ NUMBER_ENTITIES = ( ), ReolinkNumberEntityDescription( key="auto_track_stop_time", - name="Auto track stop time", + translation_key="auto_track_stop_time", icon="mdi:target-account", entity_category=EntityCategory.CONFIG, native_step=1, diff --git a/homeassistant/components/reolink/select.py b/homeassistant/components/reolink/select.py index 2ae3442278e..e9dc151f33b 100644 --- a/homeassistant/components/reolink/select.py +++ b/homeassistant/components/reolink/select.py @@ -45,10 +45,9 @@ class ReolinkSelectEntityDescription( SELECT_ENTITIES = ( ReolinkSelectEntityDescription( key="floodlight_mode", - name="Floodlight mode", + translation_key="floodlight_mode", icon="mdi:spotlight-beam", entity_category=EntityCategory.CONFIG, - translation_key="floodlight_mode", get_options=lambda api, ch: api.whiteled_mode_list(ch), supported=lambda api, ch: api.supported(ch, "floodLight"), value=lambda api, ch: SpotlightModeEnum(api.whiteled_mode(ch)).name, @@ -56,10 +55,9 @@ SELECT_ENTITIES = ( ), ReolinkSelectEntityDescription( key="day_night_mode", - name="Day night mode", + translation_key="day_night_mode", icon="mdi:theme-light-dark", entity_category=EntityCategory.CONFIG, - translation_key="day_night_mode", get_options=[mode.name for mode in DayNightEnum], supported=lambda api, ch: api.supported(ch, "dayNight"), value=lambda api, ch: DayNightEnum(api.daynight_state(ch)).name, @@ -67,7 +65,7 @@ SELECT_ENTITIES = ( ), ReolinkSelectEntityDescription( key="ptz_preset", - name="PTZ preset", + translation_key="ptz_preset", icon="mdi:pan", get_options=lambda api, ch: list(api.ptz_presets(ch)), supported=lambda api, ch: api.supported(ch, "ptz_presets"), @@ -75,9 +73,8 @@ SELECT_ENTITIES = ( ), ReolinkSelectEntityDescription( key="auto_quick_reply_message", - name="Auto quick reply message", - icon="mdi:message-reply-text-outline", translation_key="auto_quick_reply_message", + icon="mdi:message-reply-text-outline", get_options=lambda api, ch: list(api.quick_reply_dict(ch).values()), supported=lambda api, ch: api.supported(ch, "quick_reply"), value=lambda api, ch: api.quick_reply_dict(ch)[api.quick_reply_file(ch)], @@ -87,9 +84,8 @@ SELECT_ENTITIES = ( ), ReolinkSelectEntityDescription( key="auto_track_method", - name="Auto track method", - icon="mdi:target-account", translation_key="auto_track_method", + icon="mdi:target-account", entity_category=EntityCategory.CONFIG, get_options=[method.name for method in TrackMethodEnum], supported=lambda api, ch: api.supported(ch, "auto_track_method"), @@ -98,9 +94,8 @@ SELECT_ENTITIES = ( ), ReolinkSelectEntityDescription( key="status_led", - name="Status LED", - icon="mdi:lightning-bolt-circle", translation_key="status_led", + icon="mdi:lightning-bolt-circle", entity_category=EntityCategory.CONFIG, get_options=[state.name for state in StatusLedEnum], supported=lambda api, ch: api.supported(ch, "doorbell_led"), diff --git a/homeassistant/components/reolink/siren.py b/homeassistant/components/reolink/siren.py index 9dba3b840ea..c91f633ecab 100644 --- a/homeassistant/components/reolink/siren.py +++ b/homeassistant/components/reolink/siren.py @@ -33,7 +33,7 @@ class ReolinkSirenEntityDescription(SirenEntityDescription): SIREN_ENTITIES = ( ReolinkSirenEntityDescription( key="siren", - name="Siren", + translation_key="siren", icon="mdi:alarm-light", supported=lambda api, ch: api.supported(ch, "siren_play"), ), diff --git a/homeassistant/components/reolink/strings.json b/homeassistant/components/reolink/strings.json index cdaeb7d0656..95aa26a1ff5 100644 --- a/homeassistant/components/reolink/strings.json +++ b/homeassistant/components/reolink/strings.json @@ -62,8 +62,164 @@ } }, "entity": { + "binary_sensor": { + "face": { + "name": "Face" + }, + "person": { + "name": "Person" + }, + "vehicle": { + "name": "Vehicle" + }, + "pet": { + "name": "Pet" + }, + "visitor": { + "name": "Visitor" + }, + "motion_lens_0": { + "name": "Motion lens 0" + }, + "face_lens_0": { + "name": "Face lens 0" + }, + "person_lens_0": { + "name": "Person lens 0" + }, + "vehicle_lens_0": { + "name": "Vehicle lens 0" + }, + "pet_lens_0": { + "name": "Pet lens 0" + }, + "visitor_lens_0": { + "name": "Visitor lens 0" + }, + "motion_lens_1": { + "name": "Motion lens 1" + }, + "face_lens_1": { + "name": "Face lens 1" + }, + "person_lens_1": { + "name": "Person lens 1" + }, + "vehicle_lens_1": { + "name": "Vehicle lens 1" + }, + "pet_lens_1": { + "name": "Pet lens 1" + }, + "visitor_lens_1": { + "name": "Visitor lens 1" + } + }, + "button": { + "ptz_stop": { + "name": "PTZ stop" + }, + "ptz_left": { + "name": "PTZ left" + }, + "ptz_right": { + "name": "PTZ right" + }, + "ptz_up": { + "name": "PTZ up" + }, + "ptz_down": { + "name": "PTZ down" + }, + "ptz_zoom_in": { + "name": "PTZ zoom in" + }, + "ptz_zoom_out": { + "name": "PTZ zoom out" + }, + "ptz_calibrate": { + "name": "PTZ calibrate" + }, + "guard_go_to": { + "name": "Guard go to" + }, + "guard_set": { + "name": "Guard set current position" + } + }, + "light": { + "floodlight": { + "name": "Floodlight" + }, + "ir_lights": { + "name": "Infra red lights in night mode" + }, + "status_led": { + "name": "Status LED" + } + }, + "number": { + "zoom": { + "name": "Zoom" + }, + "focus": { + "name": "Focus" + }, + "floodlight_brightness": { + "name": "Floodlight turn on brightness" + }, + "volume": { + "name": "Volume" + }, + "guard_return_time": { + "name": "Guard return time" + }, + "motion_sensitivity": { + "name": "Motion sensitivity" + }, + "ai_face_sensititvity": { + "name": "AI face sensitivity" + }, + "ai_person_sensititvity": { + "name": "AI person sensitivity" + }, + "ai_vehicle_sensititvity": { + "name": "AI vehicle sensitivity" + }, + "ai_pet_sensititvity": { + "name": "AI pet sensitivity" + }, + "ai_face_delay": { + "name": "AI face delay" + }, + "ai_person_delay": { + "name": "AI person delay" + }, + "ai_vehicle_delay": { + "name": "AI vehicle delay" + }, + "ai_pet_delay": { + "name": "AI pet delay" + }, + "auto_quick_reply_time": { + "name": "Auto quick reply time" + }, + "auto_track_limit_left": { + "name": "Auto track limit left" + }, + "auto_track_limit_right": { + "name": "Auto track limit right" + }, + "auto_track_disappear_time": { + "name": "Auto track disappear time" + }, + "auto_track_stop_time": { + "name": "Auto track stop time" + } + }, "select": { "floodlight_mode": { + "name": "Floodlight mode", "state": { "off": "[%key:common::state::off%]", "auto": "Auto", @@ -73,18 +229,24 @@ } }, "day_night_mode": { + "name": "Day night mode", "state": { "auto": "Auto", "color": "Color", "blackwhite": "Black&White" } }, + "ptz_preset": { + "name": "PTZ preset" + }, "auto_quick_reply_message": { + "name": "Auto quick reply message", "state": { "off": "[%key:common::state::off%]" } }, "auto_track_method": { + "name": "Auto track method", "state": { "digital": "Digital", "digitalfirst": "Digital first", @@ -92,6 +254,7 @@ } }, "status_led": { + "name": "Status LED", "state": { "stayoff": "Stay off", "auto": "Auto", @@ -106,6 +269,46 @@ "ptz_pan_position": { "name": "PTZ pan position" } + }, + "siren": { + "siren": { + "name": "[%key:component::siren::title%]" + } + }, + "switch": { + "record_audio": { + "name": "Record audio" + }, + "siren_on_event": { + "name": "Siren on event" + }, + "auto_tracking": { + "name": "Auto tracking" + }, + "auto_focus": { + "name": "Auto focus" + }, + "gaurd_return": { + "name": "Guard return" + }, + "email": { + "name": "Email on event" + }, + "ftp_upload": { + "name": "FTP upload" + }, + "push_notifications": { + "name": "Push notifications" + }, + "record": { + "name": "Record" + }, + "buzzer": { + "name": "Buzzer on event" + }, + "doorbell_button_sound": { + "name": "Doorbell button sound" + } } } } diff --git a/homeassistant/components/reolink/switch.py b/homeassistant/components/reolink/switch.py index aa121911758..4a5b415a144 100644 --- a/homeassistant/components/reolink/switch.py +++ b/homeassistant/components/reolink/switch.py @@ -55,7 +55,7 @@ class ReolinkNVRSwitchEntityDescription( SWITCH_ENTITIES = ( ReolinkSwitchEntityDescription( key="record_audio", - name="Record audio", + translation_key="record_audio", icon="mdi:microphone", entity_category=EntityCategory.CONFIG, supported=lambda api, ch: api.supported(ch, "audio"), @@ -64,7 +64,7 @@ SWITCH_ENTITIES = ( ), ReolinkSwitchEntityDescription( key="siren_on_event", - name="Siren on event", + translation_key="siren_on_event", icon="mdi:alarm-light", entity_category=EntityCategory.CONFIG, supported=lambda api, ch: api.supported(ch, "siren"), @@ -73,7 +73,7 @@ SWITCH_ENTITIES = ( ), ReolinkSwitchEntityDescription( key="auto_tracking", - name="Auto tracking", + translation_key="auto_tracking", icon="mdi:target-account", entity_category=EntityCategory.CONFIG, supported=lambda api, ch: api.supported(ch, "auto_track"), @@ -82,7 +82,7 @@ SWITCH_ENTITIES = ( ), ReolinkSwitchEntityDescription( key="auto_focus", - name="Auto focus", + translation_key="auto_focus", icon="mdi:focus-field", entity_category=EntityCategory.CONFIG, supported=lambda api, ch: api.supported(ch, "auto_focus"), @@ -91,7 +91,7 @@ SWITCH_ENTITIES = ( ), ReolinkSwitchEntityDescription( key="gaurd_return", - name="Guard return", + translation_key="gaurd_return", icon="mdi:crosshairs-gps", entity_category=EntityCategory.CONFIG, supported=lambda api, ch: api.supported(ch, "ptz_guard"), @@ -100,7 +100,7 @@ SWITCH_ENTITIES = ( ), ReolinkSwitchEntityDescription( key="email", - name="Email on event", + translation_key="email", icon="mdi:email", entity_category=EntityCategory.CONFIG, supported=lambda api, ch: api.supported(ch, "email") and api.is_nvr, @@ -109,7 +109,7 @@ SWITCH_ENTITIES = ( ), ReolinkSwitchEntityDescription( key="ftp_upload", - name="FTP upload", + translation_key="ftp_upload", icon="mdi:swap-horizontal", entity_category=EntityCategory.CONFIG, supported=lambda api, ch: api.supported(ch, "ftp") and api.is_nvr, @@ -118,7 +118,7 @@ SWITCH_ENTITIES = ( ), ReolinkSwitchEntityDescription( key="push_notifications", - name="Push notifications", + translation_key="push_notifications", icon="mdi:message-badge", entity_category=EntityCategory.CONFIG, supported=lambda api, ch: api.supported(ch, "push") and api.is_nvr, @@ -127,7 +127,7 @@ SWITCH_ENTITIES = ( ), ReolinkSwitchEntityDescription( key="record", - name="Record", + translation_key="record", icon="mdi:record-rec", supported=lambda api, ch: api.supported(ch, "recording") and api.is_nvr, value=lambda api, ch: api.recording_enabled(ch), @@ -135,7 +135,7 @@ SWITCH_ENTITIES = ( ), ReolinkSwitchEntityDescription( key="buzzer", - name="Buzzer on event", + translation_key="buzzer", icon="mdi:room-service", entity_category=EntityCategory.CONFIG, supported=lambda api, ch: api.supported(ch, "buzzer") and api.is_nvr, @@ -144,7 +144,7 @@ SWITCH_ENTITIES = ( ), ReolinkSwitchEntityDescription( key="doorbell_button_sound", - name="Doorbell button sound", + translation_key="doorbell_button_sound", icon="mdi:volume-high", entity_category=EntityCategory.CONFIG, supported=lambda api, ch: api.supported(ch, "doorbell_button_sound"), @@ -156,7 +156,7 @@ SWITCH_ENTITIES = ( NVR_SWITCH_ENTITIES = ( ReolinkNVRSwitchEntityDescription( key="email", - name="Email on event", + translation_key="email", icon="mdi:email", entity_category=EntityCategory.CONFIG, supported=lambda api: api.supported(None, "email"), @@ -165,7 +165,7 @@ NVR_SWITCH_ENTITIES = ( ), ReolinkNVRSwitchEntityDescription( key="ftp_upload", - name="FTP upload", + translation_key="ftp_upload", icon="mdi:swap-horizontal", entity_category=EntityCategory.CONFIG, supported=lambda api: api.supported(None, "ftp"), @@ -174,7 +174,7 @@ NVR_SWITCH_ENTITIES = ( ), ReolinkNVRSwitchEntityDescription( key="push_notifications", - name="Push notifications", + translation_key="push_notifications", icon="mdi:message-badge", entity_category=EntityCategory.CONFIG, supported=lambda api: api.supported(None, "push"), @@ -183,7 +183,7 @@ NVR_SWITCH_ENTITIES = ( ), ReolinkNVRSwitchEntityDescription( key="record", - name="Record", + translation_key="record", icon="mdi:record-rec", supported=lambda api: api.supported(None, "recording"), value=lambda api: api.recording_enabled(), @@ -191,7 +191,7 @@ NVR_SWITCH_ENTITIES = ( ), ReolinkNVRSwitchEntityDescription( key="buzzer", - name="Buzzer on event", + translation_key="buzzer", icon="mdi:room-service", entity_category=EntityCategory.CONFIG, supported=lambda api: api.supported(None, "buzzer"), diff --git a/homeassistant/components/reolink/update.py b/homeassistant/components/reolink/update.py index fbbb037080b..57efe1d9e92 100644 --- a/homeassistant/components/reolink/update.py +++ b/homeassistant/components/reolink/update.py @@ -41,7 +41,6 @@ class ReolinkUpdateEntity( _attr_device_class = UpdateDeviceClass.FIRMWARE _attr_release_url = "https://reolink.com/download-center/" - _attr_name = "Update" def __init__( self, diff --git a/tests/components/reolink/test_init.py b/tests/components/reolink/test_init.py index d649baeb937..e2bd622bb43 100644 --- a/tests/components/reolink/test_init.py +++ b/tests/components/reolink/test_init.py @@ -85,7 +85,7 @@ async def test_firmware_error_twice( assert config_entry.state == ConfigEntryState.LOADED - entity_id = f"{Platform.UPDATE}.{TEST_NVR_NAME}_update" + entity_id = f"{Platform.UPDATE}.{TEST_NVR_NAME}_firmware" assert hass.states.is_state(entity_id, STATE_OFF) async_fire_time_changed(