|
@@ -8,7 +8,6 @@ import requests
|
|
|
import uuid
|
|
|
import logging
|
|
|
from django.views.generic import TemplateView
|
|
|
-from django.shortcuts import render_to_response
|
|
|
from django.http import JsonResponse
|
|
|
import http.client
|
|
|
from urllib.parse import urlencode
|
|
@@ -382,10 +381,10 @@ class deviceStatus(TemplateView):
|
|
|
|
|
|
}
|
|
|
SwitchModel.objects.create(**switch)
|
|
|
- if power_state == 0:
|
|
|
- res = {'state': 'OFF'}
|
|
|
- else:
|
|
|
+ if power_state:
|
|
|
res = {'state': 'ON'}
|
|
|
+ else:
|
|
|
+ res = {'state': 'OFF'}
|
|
|
return response.json(0, res=res)
|
|
|
except Exception as e:
|
|
|
logger.info('--------上传插座状态异常--------: {}'.format(repr(e)))
|