def sms(self, msg): if self.bmqtt.checkSMS() is False: return payload = ujson.dumps({ 'deviceName': self.bmqtt.deviceName, 'key': self.auth, 'msg': msg }) response = requests.post( 'https://iotdev.clz.me/api/v1/user/device/sms', data=payload, headers={'Content-Type': 'application/json'}) self.bmqtt.smsTime = millis() data = response.json() # if self.bmqtt.isDebugAll() is True: BLINKER_LOG_ALL('response: ', data) if data[BLINKER_CMD_MESSAGE] != 1000: BLINKER_ERR_LOG(data[BLINKER_CMD_DETAIL])
def dataUpdate(self, msg): payload = ujson.dumps({ 'deviceName': self.bmqtt.deviceName, 'key': self.auth, 'data': msg }) response = requests.post( 'https://iotdev.clz.me/api/v1/user/device/cloudStorage/', data=payload, headers={'Content-Type': 'application/json'}) self.bmqtt.pushTime = millis() data = response.json() # if self.bmqtt.isDebugAll() is True: BLINKER_LOG_ALL('response: ', data) if data[BLINKER_CMD_MESSAGE] != 1000: BLINKER_ERR_LOG(data[BLINKER_CMD_DETAIL]) return False return True
def wechat(self, title, state, msg): if self.bmqtt.checkWECHAT() is False: return payload = ujson.dumps({ 'deviceName': self.bmqtt.deviceName, 'key': self.auth, 'title': title, 'state': state, 'msg': msg }) response = requests.post( 'https://iot.diandeng.tech/api/v1/user/device/wxMsg/', data=payload, headers={'Content-Type': 'application/json'}) self.bmqtt.pushTime = millis() data = response.json() # if self.bmqtt.isDebugAll() is True: BLINKER_LOG_ALL('response: ', data) if data[BLINKER_CMD_MESSAGE] != 1000: BLINKER_ERR_LOG(data[BLINKER_CMD_DETAIL])