diff --git a/custom_components/tuya_local/devices/simple_switch_timerv2.yaml b/custom_components/tuya_local/devices/simple_switch_timerv2.yaml index b7a7cc1d95..d72552010c 100644 --- a/custom_components/tuya_local/devices/simple_switch_timerv2.yaml +++ b/custom_components/tuya_local/devices/simple_switch_timerv2.yaml @@ -49,6 +49,7 @@ secondary_entities: - id: 38 type: string name: available + optional: true mapping: - dps_val: null value: false diff --git a/tests/devices/test_simple_switch_with_timerv2.py b/tests/devices/test_simple_switch_with_timerv2.py index a137b4c1d3..9680b9dc93 100644 --- a/tests/devices/test_simple_switch_with_timerv2.py +++ b/tests/devices/test_simple_switch_with_timerv2.py @@ -9,6 +9,7 @@ SWITCH_DPS = "1" TIMER_DPS = "9" +INITIAL_STATE_DPS = "38" class TestTimedSwitch(BasicNumberTests, SwitchableTests, TuyaDeviceTestCase): @@ -32,3 +33,11 @@ def test_extra_state_attributes_set(self): self.subject.extra_state_attributes, {}, ) + + def test_available(self): + for id, e in self.entities.items(): + if id == "select_initial_state": + self.dps[INITIAL_STATE_DPS] = None + self.assertFalse(e.available) + self.dps[INITIAL_STATE_DPS] = "on" + self.assertTrue(e.available)