Skip to content

Commit

Permalink
Small updated with the sentinel API
Browse files Browse the repository at this point in the history
  • Loading branch information
guerrerotook committed Apr 10, 2022
1 parent ce51c46 commit e358241
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,20 +252,20 @@ async def get_sentinel_data(
"numinst": str(installation.number),
"zone": str(service.attributes.attributes[0].value),
},
"query": "query Sentinel($numinst: String!, $zone: String!) {\n xSAllConfort(numinst: $numinst, zone: $zone) {\n zone\n alias\n zonePrevious\n aliasPrevious\n zoneNext\n aliasNext\n moreDdis\n status {\n airQuality\n airQualityMsg\n humidity\n temperature\n }\n forecast {\n city\n currentTemp\n currentHum\n description\n forecastImg\n day1 {\n forecastImg\n maxTemp\n minTemp\n value\n }\n day2 {\n forecastImg\n maxTemp\n minTemp\n value\n }\n day3 {\n forecastImg\n maxTemp\n minTemp\n value\n }\n day4 {\n forecastImg\n maxTemp\n minTemp\n value\n }\n day5 {\n forecastImg\n maxTemp\n minTemp\n value\n }\n }\n }\n}\n",
"query": "query Sentinel($numinst: String!, $zone: String!) {\n xSAllConfort(numinst: $numinst, zone: $zone) {\n res\n msg\n ddi {\n zone\n alias\n zonePrevious\n aliasPrevious\n zoneNext\n aliasNext\n moreDdis\n status {\n airQuality\n airQualityMsg\n humidity\n temperature\n }\n forecast {\n city\n currentTemp\n currentHum\n description\n forecastImg\n day1 {\n forecastImg\n maxTemp\n minTemp\n value\n }\n day2 {\n forecastImg\n maxTemp\n minTemp\n value\n }\n day3 {\n forecastImg\n maxTemp\n minTemp\n value\n }\n day4 {\n forecastImg\n maxTemp\n minTemp\n value\n }\n day5 {\n forecastImg\n maxTemp\n minTemp\n value\n }\n }\n }\n }\n}\n",
}
response: ClientResponse = await self._execute_request(content)
result_json = json.loads(await response.text())
if "errors" in result_json:
error_message = result_json["errors"][0]["message"]
return error_message

raw_data = result_json["data"]["xSAllConfort"][0]["status"]
raw_data = result_json["data"]["xSAllConfort"][0]["ddi"]
return Sentinel(
result_json["data"]["xSAllConfort"][0]["alias"],
raw_data["airQualityMsg"],
int(raw_data["humidity"]),
int(raw_data["temperature"]),
raw_data["alias"],
raw_data["status"]["airQualityMsg"],
int(raw_data["status"]["humidity"]),
int(raw_data["status"]["temperature"]),
)

async def get_air_quality_data(
Expand Down

0 comments on commit e358241

Please sign in to comment.