Selaa lähdekoodia

修改properties

locky 1 vuosi sitten
vanhempi
commit
1809c9494a
1 muutettua tiedostoa jossa 26 lisäystä ja 12 poistoa
  1. 26 12
      controller/deviceStatus.py

+ 26 - 12
controller/deviceStatus.py

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