pax_global_header00006660000000000000000000000064146513712370014523gustar00rootroot0000000000000052 comment=e5cf8af7bc8f8a42d7b43883ec4264d7253994bc pyElectra-1.2.4/000077500000000000000000000000001465137123700134575ustar00rootroot00000000000000pyElectra-1.2.4/LICENSE000066400000000000000000000261351465137123700144730ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. pyElectra-1.2.4/README.md000066400000000000000000000034201465137123700147350ustar00rootroot00000000000000# pyElectra ![PyPI](https://img.shields.io/pypi/v/pyelectra?label=pypi%20package) ![PyPI - Downloads](https://img.shields.io/pypi/dm/pyelectra) Python library to control Electra Smart Air Condtioiner devices Usage: ```python import asyncio import aiohttp from electrasmart import * async def main(): session = aiohttp.ClientSession(connector=aiohttp.TCPConnector(ssl=False), timeout=aiohttp.ClientTimeout(total=10)) api = ElectraAPI(session) # User phone number phone_number = "0521234567" # Generate token imei = generate_imei() try: resp = await api.generate_new_token(phone_number=phone_number, imei=imei) except ElectraApiError as e: # handle error pass otp = input("Enter the OTP you recieved via SMS") # more error handling if resp[electra.ATTR_STATUS] == electra.STATUS_SUCCESS: if resp[electra.ATTR_DATA][electra.ATTR_RES] != electra.STATUS_SUCCESS: # Wrong phone number or unregistered user sys.exit(1) resp = await api.validate_one_time_password(otp=otp, imei=imei, phone_number=phone_number) if resp[electra.ATTR_DATA][electra.ATTR_RES] == electra.STATUS_SUCCESS: token = resp[electra.ATTR_DATA][electra.ATTR_TOKEN] else: # wrong OTP sys.exit(1) ac_devices = api.get_devices() for ac in ac_devices: assert(ac, ElectraAirConditioner) if ac.name == "Saloon AC": ac.turn_on() ac.set_mode(OPER_MODE_COOL) ac.set_temperature(17) ac.set_fan_speed(OPER_FAN_SPEED_HIGH) ac.set_vertical_swing(OPER_ON) api.set_state(ac) # This will send the conf to the AC loop = asyncio.get_event_loop() loop.run_until_complete(main()) ``` pyElectra-1.2.4/mypy.ini000066400000000000000000000007621465137123700151630ustar00rootroot00000000000000[mypy] python_version = 3.9 show_error_codes = true follow_imports = silent ignore_missing_imports = true strict_equality = true warn_incomplete_stub = true warn_redundant_casts = true warn_unused_configs = true warn_unused_ignores = true check_untyped_defs = true disallow_incomplete_defs = true disallow_subclassing_any = true disallow_untyped_calls = true disallow_untyped_decorators = true disallow_untyped_defs = true no_implicit_optional = true warn_return_any = true warn_unreachable = true pyElectra-1.2.4/pyproject.toml000066400000000000000000000014731465137123700164000ustar00rootroot00000000000000[build-system] requires = ["setuptools>=61.0.0", "wheel"] build-backend = "setuptools.build_meta" [project] name = "pyElectra" version = "1.2.4" description = "Electra Smart Python Integration." readme = "README.md" authors = [{ name = "Jafar Atili", email = "at.jafar@outlook.com" }] keywords = [ "home", "automation", "Electra", "smart", "Electra Smart", "Air Condition"] classifiers = [ "Intended Audience :: Developers", "Operating System :: OS Independent", "Topic :: Home Automation", "Topic :: Software Development :: Libraries :: Python Modules", "Typing :: Typed", "License :: OSI Approved :: Apache Software License", ] dependencies = ["aiohttp"] requires-python = ">=3.9" [project.urls] homepage = "https://pypi.org/project/pyelectra/" repository = "https://github.com/jafar-atili/pyelectra/" pyElectra-1.2.4/src/000077500000000000000000000000001465137123700142465ustar00rootroot00000000000000pyElectra-1.2.4/src/electrasmart/000077500000000000000000000000001465137123700167345ustar00rootroot00000000000000pyElectra-1.2.4/src/electrasmart/__init__.py000066400000000000000000000000631465137123700210440ustar00rootroot00000000000000name = "electrasmart" __all__ = ["api", "device"] pyElectra-1.2.4/src/electrasmart/api/000077500000000000000000000000001465137123700175055ustar00rootroot00000000000000pyElectra-1.2.4/src/electrasmart/api/__init__.py000066400000000000000000000153751465137123700216310ustar00rootroot00000000000000from __future__ import annotations from asyncio import TimeoutError, create_task from datetime import datetime from json import JSONDecodeError from logging import getLogger from typing import Any, List from aiohttp import ClientError, ClientSession from electrasmart.device import ElectraAirConditioner from .const import (DELAY_BETWEEM_SID_REQUESTS, SID_EXPIRATION, STATUS_SUCCESS, Attributes) logger = getLogger(__name__) class ElectraApiError(Exception): pass class ElectraAPI(object): def __init__( self, websession: ClientSession, imei: str | None = None, token: str | None = None, ) -> None: self._base_url = "https://app.ecpiot.co.il/mobile/mobilecommand" self._sid = None self._imei = imei self._token = token self._sid_expiration = 0 self._last_sid_request_ts = 0 self._session = websession self._phone_number = None self._devices: list[ElectraAirConditioner] = [] logger.debug("Initialized Electra API object") @property def devices(self) -> list[ElectraAirConditioner]: return self._devices async def _send_request(self, payload: dict[str, Any]) -> dict[str, Any]: try: resp = await self._session.post( url=self._base_url, json=payload, headers={"user-agent": "Electra Client"}, ) json_resp: dict[str, Any] = await resp.json(content_type=None) except TimeoutError as ex: raise ElectraApiError(f"Failed to communicate with Electra API due to time out: ({str(ex)})") except ClientError as ex: raise ElectraApiError(f"Failed to communicate with Electra API due to ClientError: ({str(ex)})") except JSONDecodeError as ex: raise ElectraApiError(f"Recieved invalid response from Electra API: {str(ex)}") return json_resp async def generate_new_token(self, phone_number: str, imei: str) -> dict[str, Any]: payload = { "pvdid": 1, "id": 99, "cmd": "SEND_OTP", "data": {"imei": imei, "phone": phone_number}, } return await self._send_request(payload=payload) async def validate_one_time_password(self, otp: str, imei: str, phone_number: str) -> dict[str, Any]: payload = { "pvdid": 1, "id": 99, "cmd": "CHECK_OTP", "data": { "imei": imei, "phone": phone_number, "code": otp, "os": "android", "osver": "M4B30Z", }, } return await self._send_request(payload=payload) def _sid_expired(self) -> bool: current_time = int(datetime.now().timestamp()) refresh_in = self._sid_expiration - current_time if refresh_in > 0: logger.debug("Should refresh in %s minutes", round(refresh_in / 60)) if current_time < self._sid_expiration: return False else: self._sid = None return True async def _get_sid(self, force: bool = False) -> None: current_ts = int(datetime.now().timestamp()) if not force and not self._sid_expired(): logger.debug("Found valid sid (%s) in cache, using it", self._sid) return if self._last_sid_request_ts and current_ts < (self._last_sid_request_ts + DELAY_BETWEEM_SID_REQUESTS): logger.debug( 'Session ID was requested less than 5 minutes ago! waiting in order to prevent "intruder lockdown"...' ) return payload = { "pvdid": 1, "id": 99, "cmd": "VALIDATE_TOKEN", "data": { "imei": self._imei, "token": self._token, "os": "android", "osver": "M4B30Z", }, } resp = await self._send_request(payload=payload) if resp is None: raise ElectraApiError("Failed to retrieve sid") else: if not resp[Attributes.DATA][Attributes.SID]: raise ElectraApiError( "Failed to retrieve SID due to %s", resp[Attributes.DATA][Attributes.DESC], ) else: self._sid = resp[Attributes.DATA][Attributes.SID] self._sid_expiration = current_ts + SID_EXPIRATION self._last_sid_request_ts = current_ts logger.debug("Successfully acquired sid: %s", self._sid) async def fetch_devices(self) -> None: fetch_state_tasks = [] logger.debug("About to Get Electra AC devices") await self._get_sid() payload = {"pvdid": 1, "id": 99, "cmd": "GET_DEVICES", "sid": self._sid} ac_list: List[ElectraAirConditioner] = [] resp = await self._send_request(payload=payload) if resp[Attributes.STATUS] == STATUS_SUCCESS: for ac in resp[Attributes.DATA][Attributes.DEVICES]: if ac["deviceTypeName"] == "A/C": electra_ac: ElectraAirConditioner = ElectraAirConditioner(ac) logger.debug("Discovered A/C device %s", electra_ac.name) ac_list.append(electra_ac) fetch_state_tasks.append(create_task(self.get_last_telemtry(electra_ac))) else: logger.debug("Discovered non AC device %s", ac) for task in fetch_state_tasks: await task for ac in ac_list: ac.update_features() self._devices = ac_list else: raise ElectraApiError("Failed to fetch devices %s", resp) async def get_last_telemtry(self, ac: ElectraAirConditioner) -> None: logger.debug("Getting AC %s state", ac.name) await self._get_sid() payload = { "pvdid": 1, "id": 99, "cmd": "GET_LAST_TELEMETRY", "sid": self._sid, "data": {"id": ac.id, "commandName": "OPER,DIAG_L2"}, } resp = await self._send_request(payload=payload) if resp[Attributes.STATUS] != STATUS_SUCCESS: raise ElectraApiError(f"Failed to get AC operation state: {resp}") else: ac.update_operation_states(resp[Attributes.DATA]) async def set_state(self, device: ElectraAirConditioner) -> dict[str, Any]: json_command = device.get_operation_state() await self._get_sid() payload = { "pvdid": 1, "id": 99, "cmd": "SEND_COMMAND", "sid": self._sid, "data": {"id": device.id, "commandJson": json_command}, } return await self._send_request(payload=payload) pyElectra-1.2.4/src/electrasmart/api/const.py000066400000000000000000000006531465137123700212110ustar00rootroot00000000000000from dataclasses import dataclass from datetime import timedelta STATUS_SUCCESS = 0 DELAY_BETWEEM_SID_REQUESTS = int(timedelta(minutes=5).total_seconds()) SID_EXPIRATION = int(timedelta(minutes=15).total_seconds()) @dataclass class Attributes: INTRUDER_LOCKOUT = "Intruder lockout" DESC = "res_desc" DATA = "data" TOKEN = "token" SID = "sid" RES = "res" STATUS = "status" DEVICES = "devices" pyElectra-1.2.4/src/electrasmart/api/utils.py000066400000000000000000000003231465137123700212150ustar00rootroot00000000000000from math import floor, pow from random import randint def generate_imei() -> str: minimum = int(pow(10, 7)) maximum = int(pow(10, 8) - 1) return f"2b950000{str(floor(randint(minimum, maximum)))}" pyElectra-1.2.4/src/electrasmart/device/000077500000000000000000000000001465137123700201735ustar00rootroot00000000000000pyElectra-1.2.4/src/electrasmart/device/__init__.py000066400000000000000000000114541465137123700223110ustar00rootroot00000000000000from __future__ import annotations import json from typing import Any from .const import Feature, OperationMode class ElectraAirConditioner(object): def __init__(self, data: dict[str, str]) -> None: self.id: str = data["id"] self.name: str = data["name"] self.regdate: str = data["regdate"] self.model = data["model"] self.mac: str = data["mac"] self.serial_number: str = data["sn"] self.manufactor: str = data["manufactor"] self.type: str = data["deviceTypeName"] self.status: str = data["status"] self.token: str = data["deviceToken"] self._time_delta: int = 0 self.features: list[int] = [] self.current_mode: str | None = None self.collected_measure: int | None = None self._oper_data: dict[str, str] = {} def is_disconnected(self, thresh_sec: int = 60) -> bool: return self._time_delta > thresh_sec def update_features(self) -> None: if "VSWING" in self._oper_data: self.features.append(Feature.V_SWING) if "HSWING" in self._oper_data: self.features.append(Feature.H_SWING) def get_sensor_temperature(self) -> int | None: return self.collected_measure def get_mode(self) -> str: return self._oper_data["AC_MODE"] def set_mode(self, mode: str) -> None: if mode in [ OperationMode.MODE_AUTO, OperationMode.MODE_COOL, OperationMode.MODE_DRY, OperationMode.MODE_FAN, OperationMode.MODE_HEAT, ]: if mode != self._oper_data["AC_MODE"]: self._oper_data["AC_MODE"] = mode def set_horizontal_swing(self, enable: bool) -> None: if "HSWING" in self._oper_data: self._oper_data["HSWING"] = OperationMode.ON if enable else OperationMode.OFF def set_vertical_swing(self, enable: bool) -> None: if "VSWING" in self._oper_data: self._oper_data["VSWING"] = OperationMode.ON if enable else OperationMode.OFF def is_vertical_swing(self) -> bool: if "VSWING" in self._oper_data: return self._oper_data["VSWING"] == OperationMode.ON return False def is_horizontal_swing(self) -> bool: if "HSWING" in self._oper_data: return self._oper_data["HSWING"] == OperationMode.ON return False def is_on(self) -> bool: if "TURN_ON_OFF" in self._oper_data: return self._oper_data["TURN_ON_OFF"] == OperationMode.ON else: return self._oper_data["AC_MODE"] != OperationMode.STANDBY def turn_on(self) -> None: if not self.is_on(): if "TURN_ON_OFF" in self._oper_data: self._oper_data["TURN_ON_OFF"] = OperationMode.ON def turn_off(self) -> None: if self.is_on(): if "TURN_ON_OFF" in self._oper_data: self._oper_data["TURN_ON_OFF"] = OperationMode.OFF else: self._oper_data["AC_MODE"] = OperationMode.STANDBY def get_temperature(self) -> int: return int(self._oper_data["SPT"]) def set_temperature(self, val: int) -> None: if self.get_temperature() != val: self._oper_data["SPT"] = str(val) def get_fan_speed(self) -> str: return self._oper_data["FANSPD"] def set_fan_speed(self, speed: str) -> None: if speed in [ OperationMode.FAN_SPEED_AUTO, OperationMode.FAN_SPEED_HIGH, OperationMode.FAN_SPEED_MED, OperationMode.FAN_SPEED_LOW, ]: if speed != self._oper_data["FANSPD"]: self._oper_data["FANSPD"] = speed def set_turbo_mode(self, enable: bool) -> None: self._oper_data["TURBO"] = OperationMode.ON if enable else OperationMode.OFF def get_turbo_mode(self) -> bool: return self._oper_data["TURBO"] == OperationMode.ON def set_shabat_mode(self, enable: bool) -> None: self._oper_data["SHABAT"] = OperationMode.ON if enable else OperationMode.OFF def get_shabat_mode(self) -> bool: return self._oper_data["SHABAT"] == OperationMode.ON def update_operation_states(self, data: dict[str, Any]) -> None: self._oper_data = json.loads(data["commandJson"]["OPER"])["OPER"] self._time_delta = data["timeDelta"] measurments = json.loads(data["commandJson"]["DIAG_L2"])["DIAG_L2"] if "I_RAT" in measurments: self.collected_measure = int(measurments["I_RAT"]) if "I_CALC_AT" in measurments: self.collected_measure = int(measurments["I_CALC_AT"]) self.current_mode = measurments["O_ODU_MODE"] def get_operation_state(self) -> str: if "AC_STSRC" in self._oper_data: self._oper_data["AC_STSRC"] = "WI-FI" return json.dumps({"OPER": self._oper_data}) pyElectra-1.2.4/src/electrasmart/device/const.py000066400000000000000000000006531465137123700216770ustar00rootroot00000000000000from dataclasses import dataclass MAX_TEMP = 30 MIN_TEMP = 17 @dataclass class OperationMode: MODE_COOL = "COOL" MODE_HEAT = "HEAT" MODE_AUTO = "AUTO" MODE_DRY = "DRY" MODE_FAN = "FAN" FAN_SPEED_LOW = "LOW" FAN_SPEED_MED = "MED" FAN_SPEED_HIGH = "HIGH" FAN_SPEED_AUTO = "AUTO" ON = "ON" OFF = "OFF" STANDBY = "STBY" @dataclass class Feature: V_SWING = 0 H_SWING = 1 pyElectra-1.2.4/src/electrasmart/py.typed000066400000000000000000000000001465137123700204210ustar00rootroot00000000000000pyElectra-1.2.4/tests/000077500000000000000000000000001465137123700146215ustar00rootroot00000000000000pyElectra-1.2.4/tests/pyaloads.py000066400000000000000000000035321465137123700170120ustar00rootroot00000000000000oper_state = { "id": 99, "status": 0, "desc": None, "data": { "timeDelta": 15, "commandJson": { "OPER": '{"OPER":{"TURN_ON_OFF":"OFF","AC_MODE":"COOL","SPT":"24","FANSPD":"AUTO","VSWING":"OFF","SLEEP":"OFF","HSWING":"OFF","CLEAR_FILT":"OFF","IDU_PN":"","IFEEL":"OFF","MSGTYPE":"OPER","OP_VAL_ERR":"OK","SHABAT":"OFF","TIMER":"OFF","TURBO":"OFF"}}', "DIAG_L2": '{"DIAG_L2":{"I_RAT":"24","O_ODU_MODE":"COOL","IDU_FAN":"AUTO","IDU_PN":"","MSGTYPE":"DIAG_L2","O_OAT":""}}', }, "res": 0, "res_desc": None, }, } resp = { "id": 99, "status": 0, "desc": None, "data": { "devices": [ { "providerName": None, "deviceTypeName": "A/C", "manufactor": "Midea", "photoId": None, "permissions": 15, "deviceTypeId": 1, "name": "סלון", "status": 1, "providerid": 1, "latitude": None, "longitude": None, "location": None, "sn": "XXXXXX", "mac": "XXXXX", "model": "XXXXX", "hwVersion": None, "fmVersion": None, "userId": 99999, "manufactorId": 2, "iconId": "1", "hasImage": False, "deviceToken": "XXXXX", "mqttId": "XXXXX", "enableEvents": True, "isActivated": False, "logLevel": None, "lastIntervalActivity": None, "PowerOnID": None, "IsDebugMode": False, "regdate": "2021-03-31T21:12:39", "id": 9999, } ], "res": 0, "res_desc": None, }, }