@@ -17,26 +17,26 @@ local mock_device = test.mock_device.build_test_matter_device({
1717 {
1818 endpoint_id = 0 ,
1919 clusters = {
20- {cluster_id = clusters .Basic .ID , cluster_type = " SERVER" },
20+ { cluster_id = clusters .Basic .ID , cluster_type = " SERVER" },
2121 },
2222 device_types = {
23- {device_type_id = 0x0016 , device_type_revision = 1 } -- RootNode
23+ { device_type_id = 0x0016 , device_type_revision = 1 } -- RootNode
2424 }
2525 },
2626 {
2727 endpoint_id = 1 ,
2828 clusters = {
2929 {
3030 cluster_id = clusters .Thermostat .ID ,
31- cluster_revision = 5 ,
32- cluster_type = " SERVER" ,
33- feature_map = 35 , -- Heat, Cool, and Auto features.
31+ cluster_revision = 5 ,
32+ cluster_type = " SERVER" ,
33+ feature_map = 35 , -- Heat, Cool, and Auto features.
3434 },
35- {cluster_id = clusters .PowerSource .ID , cluster_type = " SERVER" , feature_map = clusters .PowerSource .types .PowerSourceFeature .BATTERY },
36- {cluster_id = clusters .TemperatureMeasurement .ID , cluster_type = " BOTH" },
35+ { cluster_id = clusters .PowerSource .ID , cluster_type = " SERVER" , feature_map = clusters .PowerSource .types .PowerSourceFeature .BATTERY },
36+ { cluster_id = clusters .TemperatureMeasurement .ID , cluster_type = " BOTH" },
3737 },
3838 device_types = {
39- {device_type_id = 0x0301 , device_type_revision = 1 } -- Thermostat
39+ { device_type_id = 0x0301 , device_type_revision = 1 } -- Thermostat
4040 }
4141 }
4242 }
@@ -66,12 +66,14 @@ local function test_init()
6666 end
6767 end
6868 test .socket .capability :__expect_send (
69- mock_device :generate_test_message (" main" , capabilities .thermostatOperatingState .supportedThermostatOperatingStates ({" idle" , " heating" , " cooling" }, {visibility = {displayed = false }}))
69+ mock_device :generate_test_message (" main" ,
70+ capabilities .thermostatOperatingState .supportedThermostatOperatingStates ({ " idle" , " heating" , " cooling" },
71+ { visibility = { displayed = false } }))
7072 )
71- test .socket .matter :__expect_send ({mock_device .id , subscribe_request })
73+ test .socket .matter :__expect_send ({ mock_device .id , subscribe_request })
7274
7375 local read_setpoint_deadband = clusters .Thermostat .attributes .MinSetpointDeadBand :read ()
74- test .socket .matter :__expect_send ({mock_device .id , read_setpoint_deadband })
76+ test .socket .matter :__expect_send ({ mock_device .id , read_setpoint_deadband })
7577
7678 test .mock_device .add_test_device (mock_device )
7779
@@ -83,23 +85,27 @@ local function test_init()
8385 read_req :merge (clusters .FanControl .attributes .RockSupport :read ())
8486 read_req :merge (clusters .PowerSource .attributes .AttributeList :read ())
8587 read_req :merge (clusters .Thermostat .attributes .AttributeList :read ())
86- test .socket .matter :__expect_send ({mock_device .id , read_req })
88+ test .socket .matter :__expect_send ({ mock_device .id , read_req })
8789
8890 test .set_rpc_version (6 )
8991end
9092test .set_test_init_function (test_init )
9193
92- local cached_heating_setpoint = capabilities .thermostatHeatingSetpoint .heatingSetpoint ({ value = 24.44 , unit = " C" }, {state_change = true })
93- local cached_cooling_setpoint = capabilities .thermostatCoolingSetpoint .coolingSetpoint ({ value = 26.67 , unit = " C" }, {state_change = true })
94+ local cached_heating_setpoint = capabilities .thermostatHeatingSetpoint .heatingSetpoint ({ value = 24.44 , unit = " C" },
95+ { state_change = true })
96+ local cached_cooling_setpoint = capabilities .thermostatCoolingSetpoint .coolingSetpoint ({ value = 26.67 , unit = " C" },
97+ { state_change = true })
9498
9599local function configure (device )
96100 test .socket .device_lifecycle :__queue_receive ({ mock_device .id , " doConfigure" })
97101 mock_device :expect_metadata_update ({ provisioning_state = " PROVISIONED" })
98102
99103 test .wait_for_events ()
100104
101- test .socket .matter :__queue_receive ({mock_device .id , clusters .PowerSource .attributes .AttributeList :build_test_report_data (mock_device , 1 , {uint32 (0x0C )})})
102- test .socket .matter :__queue_receive ({mock_device .id , clusters .Thermostat .attributes .AttributeList :build_test_report_data (mock_device , 1 , {uint32 (0x29 )})})
105+ test .socket .matter :__queue_receive ({ mock_device .id , clusters .PowerSource .attributes .AttributeList
106+ :build_test_report_data (mock_device , 1 , { uint32 (0x0C ) }) })
107+ test .socket .matter :__queue_receive ({ mock_device .id , clusters .Thermostat .attributes .AttributeList
108+ :build_test_report_data (mock_device , 1 , { uint32 (0x29 ) }) })
103109 mock_device :expect_metadata_update ({ profile = " thermostat" })
104110
105111 -- populate cached setpoint values. This would normally happen due to subscription setup.
@@ -112,16 +118,22 @@ local function configure(device)
112118 clusters .Thermostat .attributes .OccupiedCoolingSetpoint :build_test_report_data (mock_device , 1 , 2667 ) -- 26.67 celcius
113119 })
114120 test .socket .capability :__expect_send (
115- device :generate_test_message (" main" , capabilities .thermostatHeatingSetpoint .heatingSetpointRange ({ value = { minimum = 0.00 , maximum = 100.00 , step = 0.1 }, unit = " C" }))
121+ device :generate_test_message (" main" ,
122+ capabilities .thermostatHeatingSetpoint .heatingSetpointRange ({ value = { minimum = 0.00 , maximum = 100.00 , step = 0.1 }, unit =
123+ " C" }))
116124 )
117125 test .socket .capability :__expect_send (
118- device :generate_test_message (" main" , capabilities .thermostatHeatingSetpoint .heatingSetpoint ({ value = 24.44 , unit = " C" }))
126+ device :generate_test_message (" main" ,
127+ capabilities .thermostatHeatingSetpoint .heatingSetpoint ({ value = 24.44 , unit = " C" }))
119128 )
120129 test .socket .capability :__expect_send (
121- device :generate_test_message (" main" , capabilities .thermostatCoolingSetpoint .coolingSetpointRange ({ value = { minimum = 0.00 , maximum = 100.00 , step = 0.1 }, unit = " C" }))
130+ device :generate_test_message (" main" ,
131+ capabilities .thermostatCoolingSetpoint .coolingSetpointRange ({ value = { minimum = 0.00 , maximum = 100.00 , step = 0.1 }, unit =
132+ " C" }))
122133 )
123134 test .socket .capability :__expect_send (
124- device :generate_test_message (" main" , capabilities .thermostatCoolingSetpoint .coolingSetpoint ({ value = 26.67 , unit = " C" }))
135+ device :generate_test_message (" main" ,
136+ capabilities .thermostatCoolingSetpoint .coolingSetpoint ({ value = 26.67 , unit = " C" }))
125137 )
126138end
127139
@@ -138,7 +150,9 @@ test.register_coroutine_test(
138150 clusters .Thermostat .attributes .AbsMaxHeatSetpointLimit :build_test_report_data (mock_device , 1 , 3222 )
139151 })
140152 test .socket .capability :__expect_send (
141- mock_device :generate_test_message (" main" , capabilities .thermostatHeatingSetpoint .heatingSetpointRange ({ value = { minimum = 10.00 , maximum = 32.22 , step = 0.1 }, unit = " C" }))
153+ mock_device :generate_test_message (" main" ,
154+ capabilities .thermostatHeatingSetpoint .heatingSetpointRange ({ value = { minimum = 10.00 , maximum = 32.22 , step = 0.1 }, unit =
155+ " C" }))
142156 )
143157 test .wait_for_events ()
144158 test .socket .capability :__queue_receive ({
@@ -150,7 +164,7 @@ test.register_coroutine_test(
150164 )
151165 end ,
152166 {
153- min_api_version = 17
167+ min_api_version = 17
154168 }
155169)
156170
@@ -167,7 +181,9 @@ test.register_coroutine_test(
167181 clusters .Thermostat .attributes .AbsMaxCoolSetpointLimit :build_test_report_data (mock_device , 1 , 3222 )
168182 })
169183 test .socket .capability :__expect_send (
170- mock_device :generate_test_message (" main" , capabilities .thermostatCoolingSetpoint .coolingSetpointRange ({ value = { minimum = 10.00 , maximum = 32.22 , step = 0.1 }, unit = " C" }))
184+ mock_device :generate_test_message (" main" ,
185+ capabilities .thermostatCoolingSetpoint .coolingSetpointRange ({ value = { minimum = 10.00 , maximum = 32.22 , step = 0.1 }, unit =
186+ " C" }))
171187 )
172188 test .wait_for_events ()
173189 test .socket .capability :__queue_receive ({
@@ -179,7 +195,7 @@ test.register_coroutine_test(
179195 )
180196 end ,
181197 {
182- min_api_version = 17
198+ min_api_version = 17
183199 }
184200)
185201
@@ -196,7 +212,9 @@ test.register_coroutine_test(
196212 clusters .Thermostat .attributes .AbsMaxHeatSetpointLimit :build_test_report_data (mock_device , 1 , 3222 )
197213 })
198214 test .socket .capability :__expect_send (
199- mock_device :generate_test_message (" main" , capabilities .thermostatHeatingSetpoint .heatingSetpointRange ({ value = { minimum = 10.00 , maximum = 32.22 , step = 0.1 }, unit = " C" }))
215+ mock_device :generate_test_message (" main" ,
216+ capabilities .thermostatHeatingSetpoint .heatingSetpointRange ({ value = { minimum = 10.00 , maximum = 32.22 , step = 0.1 }, unit =
217+ " C" }))
200218 )
201219 test .wait_for_events ()
202220 test .socket .capability :__queue_receive ({
@@ -208,7 +226,7 @@ test.register_coroutine_test(
208226 )
209227 end ,
210228 {
211- min_api_version = 17
229+ min_api_version = 17
212230 }
213231)
214232
@@ -225,7 +243,9 @@ test.register_coroutine_test(
225243 clusters .Thermostat .attributes .AbsMaxCoolSetpointLimit :build_test_report_data (mock_device , 1 , 3222 )
226244 })
227245 test .socket .capability :__expect_send (
228- mock_device :generate_test_message (" main" , capabilities .thermostatCoolingSetpoint .coolingSetpointRange ({ value = { minimum = 10.00 , maximum = 32.22 , step = 0.1 }, unit = " C" }))
246+ mock_device :generate_test_message (" main" ,
247+ capabilities .thermostatCoolingSetpoint .coolingSetpointRange ({ value = { minimum = 10.00 , maximum = 32.22 , step = 0.1 }, unit =
248+ " C" }))
229249 )
230250 test .wait_for_events ()
231251 test .socket .capability :__queue_receive ({
@@ -237,7 +257,7 @@ test.register_coroutine_test(
237257 )
238258 end ,
239259 {
240- min_api_version = 17
260+ min_api_version = 17
241261 }
242262)
243263
@@ -259,7 +279,7 @@ test.register_coroutine_test(
259279 )
260280 end ,
261281 {
262- min_api_version = 17
282+ min_api_version = 17
263283 }
264284)
265285
@@ -281,7 +301,7 @@ test.register_coroutine_test(
281301 )
282302 end ,
283303 {
284- min_api_version = 17
304+ min_api_version = 17
285305 }
286306)
287307
@@ -297,7 +317,7 @@ test.register_coroutine_test(
297317 assert (min_setpoint_deadband_checked == true , " min_setpoint_deadband_checked is True" )
298318 end ,
299319 {
300- min_api_version = 17
320+ min_api_version = 17
301321 }
302322)
303323
@@ -323,11 +343,13 @@ test.register_message_test(
323343 {
324344 channel = " capability" ,
325345 direction = " send" ,
326- message = mock_device :generate_test_message (" main" , capabilities .thermostatCoolingSetpoint .coolingSetpointRange ({ value = { minimum = 10.00 , maximum = 32.22 , step = 0.1 }, unit = " C" }))
346+ message = mock_device :generate_test_message (" main" ,
347+ capabilities .thermostatCoolingSetpoint .coolingSetpointRange ({ value = { minimum = 10.00 , maximum = 32.22 , step = 0.1 }, unit =
348+ " C" }))
327349 }
328350 },
329351 {
330- min_api_version = 17
352+ min_api_version = 17
331353 }
332354)
333355
@@ -353,11 +375,13 @@ test.register_message_test(
353375 {
354376 channel = " capability" ,
355377 direction = " send" ,
356- message = mock_device :generate_test_message (" main" , capabilities .thermostatHeatingSetpoint .heatingSetpointRange ({ value = { minimum = 10.00 , maximum = 32.22 , step = 0.1 }, unit = " C" }))
378+ message = mock_device :generate_test_message (" main" ,
379+ capabilities .thermostatHeatingSetpoint .heatingSetpointRange ({ value = { minimum = 10.00 , maximum = 32.22 , step = 0.1 }, unit =
380+ " C" }))
357381 }
358382 },
359383 {
360- min_api_version = 17
384+ min_api_version = 17
361385 }
362386)
363387
@@ -383,11 +407,12 @@ test.register_message_test(
383407 {
384408 channel = " capability" ,
385409 direction = " send" ,
386- message = mock_device :generate_test_message (" main" , capabilities .temperatureMeasurement .temperatureRange ({ value = { minimum = 5.00 , maximum = 39.00 }, unit = " C" }))
410+ message = mock_device :generate_test_message (" main" ,
411+ capabilities .temperatureMeasurement .temperatureRange ({ value = { minimum = 5.00 , maximum = 39.00 }, unit = " C" }))
387412 }
388413 },
389414 {
390- min_api_version = 17
415+ min_api_version = 17
391416 }
392417)
393418
0 commit comments