File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 3131 (
3232 "state_1" ,
3333 "state_2" ,
34+ "state_3" ,
3435 "expected_state" ,
3536 ),
3637 [
3738 (
3839 "unavailable" ,
3940 "on" ,
4041 "on" ,
42+ "on" ,
4143 ),
4244 (
45+ "on" ,
4346 "on" ,
4447 "on" ,
4548 "off" ,
@@ -50,6 +53,7 @@ async def test_state_sensor(
5053 hass : HomeAssistant ,
5154 state_1 : str ,
5255 state_2 : str ,
56+ state_3 : str ,
5357 expected_state : str ,
5458 entity_registry : er .EntityRegistry ,
5559 label_registry : lr .LabelRegistry ,
@@ -106,6 +110,25 @@ async def test_state_sensor(
106110 assert state is not None
107111 assert state .state == expected_state
108112
113+ # Add a third sensor to test the listener change
114+ sensor3_entity_entry = entity_registry .async_get_or_create (
115+ "sensor" , "test_3" , "unique" , suggested_object_id = "test_3"
116+ )
117+ await hass .async_block_till_done ()
118+ sensor3_entity_entry = entity_registry .async_update_entity (
119+ sensor3_entity_entry .entity_id , labels = {test_label .label_id }
120+ )
121+ await hass .async_block_till_done ()
122+ assert sensor3_entity_entry .entity_id == "sensor.test_3"
123+
124+ hass .states .async_set (sensor3_entity_entry .entity_id , state_3 )
125+ await hass .async_block_till_done ()
126+
127+ state = hass .states .get ("binary_sensor.test_state" )
128+
129+ assert state is not None
130+ assert state .state == expected_state
131+
109132
110133@pytest .mark .parametrize (
111134 (
You can’t perform that action at this time.
0 commit comments