def get_details(self): body = helpers.req_body(self.manager, 'devicedetail') body['uuid'] = self.uuid r, _ = helpers.call_api( '/15a/v1/device/devicedetail', 'post', headers=helpers.req_headers(self.manager), json=body ) attr_list = ('deviceStatus', 'activeTime', 'energy', 'power', 'voltage', 'nightLightStatus', 'nightLightAutomode', 'nightLightBrightness') if (helpers.check_response(r, '15a_detail') and all(k in r for k in attr_list)): self.device_status = r.get('deviceStatus') self.connection_status = r.get('connectionStatus') self.details = helpers.build_details_dict(r) else: logger.debug( 'Unable to get {0} details'.format(self.device_name) )
def get_details(self) -> None: """Get 15A outlet details.""" body = Helpers.req_body(self.manager, 'devicedetail') body['uuid'] = self.uuid r, _ = Helpers.call_api( '/15a/v1/device/devicedetail', 'post', headers=Helpers.req_headers(self.manager), json_object=body, ) attr_list = ( 'deviceStatus', 'activeTime', 'energy', 'power', 'voltage', 'nightLightStatus', 'nightLightAutomode', 'nightLightBrightness', ) if Helpers.code_check(r) and all(k in r for k in attr_list): self.device_status = r.get('deviceStatus') self.connection_status = r.get('connectionStatus') self.nightlight_status = r.get('nightLightStatus') self.nightlight_brightness = r.get('nightLightBrightness') self.details = Helpers.build_details_dict(r) else: logger.debug('Unable to get %s details', self.device_name)
def get_details(self): """Get 10A outlet details.""" body = helpers.req_body(self.manager, 'devicedetail') body['uuid'] = self.uuid r, _ = helpers.call_api('/10a/v1/device/devicedetail', 'post', headers=helpers.req_headers(self.manager), json=body) if helpers.code_check(r): self.device_status = r.get('deviceStatus', self.device_status) self.connection_status = r.get('connectionStatus', self.connection_status) self.details = helpers.build_details_dict(r) else: logger.debug('Unable to get %s details', self.device_name)
def get_details(self): body = helpers.req_body(self.manager, 'devicedetail') body['uuid'] = self.uuid r, _ = helpers.call_api( '/10a/v1/device/devicedetail', 'post', headers=helpers.req_headers(self.manager), json=body ) if helpers.check_response(r, '10a_detail'): self.device_status = r.get('deviceStatus', self.device_status) self.connection_status = r.get('connectionStatus', self.connection_status) self.details = helpers.build_details_dict(r) else: logger.debug('Unable to get {0} details'.format(self.device_name))
def get_details(self): """Get details for outdoor outlet.""" body = helpers.req_body(self.manager, 'devicedetail') body['uuid'] = self.uuid r, _ = helpers.call_api('/outdoorsocket15a/v1/device/devicedetail', 'post', headers=helpers.req_headers(self.manager), json=body) if helpers.code_check(r): self.details = helpers.build_details_dict(r) self.connection_status = r.get('connectionStatus') dev_no = self.sub_device_no sub_device_list = r.get('subDevices') if sub_device_list and dev_no <= len(sub_device_list): self.device_status = sub_device_list[( dev_no + -1)].get('subDeviceStatus') else: logger.debug('Unable to get %s details', self.device_name)