mirror of
https://github.com/Andre0512/pyhOn.git
synced 2024-11-24 14:50:12 +01:00
Fix error in starting programs
This commit is contained in:
parent
0301427497
commit
d26e33a055
@ -139,7 +139,7 @@ class HonAPI:
|
|||||||
"commandName": command,
|
"commandName": command,
|
||||||
"transactionId": f"{appliance.mac_address}_{now[:-3]}Z",
|
"transactionId": f"{appliance.mac_address}_{now[:-3]}Z",
|
||||||
"applianceOptions": appliance.commands_options,
|
"applianceOptions": appliance.commands_options,
|
||||||
"appliance": self._hon.device.get(),
|
"device": self._hon.device.get(mobile=True),
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"channel": "mobileApp",
|
"channel": "mobileApp",
|
||||||
"origin": "standardProgram",
|
"origin": "standardProgram",
|
||||||
@ -150,10 +150,11 @@ class HonAPI:
|
|||||||
"applianceType": appliance.appliance_type,
|
"applianceType": appliance.appliance_type,
|
||||||
}
|
}
|
||||||
url: str = f"{const.API_URL}/commands/v1/send"
|
url: str = f"{const.API_URL}/commands/v1/send"
|
||||||
async with self._hon.post(url, json=data) as resp:
|
async with self._hon.post(url, json=data) as response:
|
||||||
json_data: Dict = await resp.json()
|
json_data: Dict = await response.json()
|
||||||
if json_data.get("payload", {}).get("resultCode") == "0":
|
if json_data.get("payload", {}).get("resultCode") == "0":
|
||||||
return True
|
return True
|
||||||
|
_LOGGER.error(await response.text())
|
||||||
return False
|
return False
|
||||||
|
|
||||||
async def appliance_configuration(self) -> Dict:
|
async def appliance_configuration(self) -> Dict:
|
||||||
|
@ -32,11 +32,12 @@ class HonDevice:
|
|||||||
def mobile_id(self) -> str:
|
def mobile_id(self) -> str:
|
||||||
return self._mobile_id
|
return self._mobile_id
|
||||||
|
|
||||||
def get(self) -> Dict:
|
def get(self, mobile: bool = False) -> Dict:
|
||||||
return {
|
result = {
|
||||||
"appVersion": self.app_version,
|
"appVersion": self.app_version,
|
||||||
"mobileId": self.mobile_id,
|
"mobileId": self.mobile_id,
|
||||||
"osVersion": self.os_version,
|
|
||||||
"os": self.os,
|
"os": self.os,
|
||||||
|
"osVersion": self.os_version,
|
||||||
"deviceModel": self.device_model,
|
"deviceModel": self.device_model,
|
||||||
}
|
}
|
||||||
|
return (result | {"mobileOs": result.pop("os")}) if mobile else result
|
||||||
|
Loading…
Reference in New Issue
Block a user