diff --git a/custom_components/reolink_dev/switch.py b/custom_components/reolink_dev/switch.py index 368cfa5..984fd6c 100644 --- a/custom_components/reolink_dev/switch.py +++ b/custom_components/reolink_dev/switch.py @@ -17,27 +17,28 @@ async def async_setup_entry(hass: HomeAssistant, config_entry, async_add_devices devices = [] base = hass.data[DOMAIN][config_entry.entry_id][BASE] - for capability in await base.api.get_switch_capabilities(): - if capability == "ftp": - devices.append(FTPSwitch(hass, config_entry)) - elif capability == "email": - devices.append(EmailSwitch(hass, config_entry)) - elif capability == "audio": - devices.append(AudioSwitch(hass, config_entry)) - elif capability == "irLights": - devices.append(IRLightsSwitch(hass, config_entry)) - elif capability == "spotlight": - devices.append(SpotLightSwitch(hass, config_entry)) - elif capability == "siren": - devices.append(SirenSwitch(hass, config_entry)) - elif capability == "push": - devices.append(PushSwitch(hass, config_entry)) - elif capability == "recording": - devices.append(RecordingSwitch(hass, config_entry)) - else: - continue - - async_add_devices(devices, update_before_add=False) + if (base.unique_id[13:] == "1") and not base.api.is_nvr(): + for capability in await base.api.get_switch_capabilities(): + if capability == "ftp": + devices.append(FTPSwitch(hass, config_entry)) + elif capability == "email": + devices.append(EmailSwitch(hass, config_entry)) + elif capability == "audio": + devices.append(AudioSwitch(hass, config_entry)) + elif capability == "irLights": + devices.append(IRLightsSwitch(hass, config_entry)) + elif capability == "spotlight": + devices.append(SpotLightSwitch(hass, config_entry)) + elif capability == "siren": + devices.append(SirenSwitch(hass, config_entry)) + elif capability == "push": + devices.append(PushSwitch(hass, config_entry)) + elif capability == "recording": + devices.append(RecordingSwitch(hass, config_entry)) + else: + continue + + async_add_devices(devices, update_before_add=False) class FTPSwitch(ReolinkEntity, ToggleEntity):