Explorar o código

改回properties

locky hai 1 ano
pai
achega
553de36ebb
Modificáronse 1 ficheiros con 12 adicións e 26 borrados
  1. 12 26
      controller/deviceStatus.py

+ 12 - 26
controller/deviceStatus.py

@@ -590,32 +590,18 @@ class deviceStatus(TemplateView):
                             }
                         ]
             if online is not None:
-                if online == '1':
-                    endpoint_health_value = 'OK'
-                    properties.append(
-                        {
-                            "namespace": "Alexa.EndpointHealth",
-                            "name": "connectivity",
-                            "value": {
-                                "value": endpoint_health_value
-                            },
-                            "timeOfSample": time_of_sample,
-                            "uncertaintyInMilliseconds": 0
-                        }
-                    )
-                else:
-                    endpoint_health_value = 'UNREACHABLE'
-                    properties = [
-                        {
-                            "namespace": "Alexa.EndpointHealth",
-                            "name": "connectivity",
-                            "value": {
-                                "value": endpoint_health_value
-                            },
-                            "timeOfSample": time_of_sample,
-                            "uncertaintyInMilliseconds": 0
-                        }
-                    ]
+                endpoint_health_value = 'OK' if online == '1' else 'UNREACHABLE'
+                properties.append(
+                    {
+                        "namespace": "Alexa.EndpointHealth",
+                        "name": "connectivity",
+                        "value": {
+                            "value": endpoint_health_value
+                        },
+                        "timeOfSample": time_of_sample,
+                        "uncertaintyInMilliseconds": 0
+                    }
+                )
             logger.info('插座ChangeReport properties:{}'.format(properties))
             payload = {
                 "event": {