Compare commits
	
		
			4 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| d4c6ccdce3 | |||
| 9594b9ebd8 | |||
| b011d98e07 | |||
| ad864286fc | 
							
								
								
									
										0
									
								
								pyhon/__main__.py
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										0
									
								
								pyhon/__main__.py
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							| @ -1,4 +1,5 @@ | |||||||
| import importlib | import importlib | ||||||
|  | import logging | ||||||
| from contextlib import suppress | from contextlib import suppress | ||||||
| from typing import Optional, Dict, Any | from typing import Optional, Dict, Any | ||||||
| from typing import TYPE_CHECKING | from typing import TYPE_CHECKING | ||||||
| @ -11,6 +12,9 @@ if TYPE_CHECKING: | |||||||
|     from pyhon import HonAPI |     from pyhon import HonAPI | ||||||
|  |  | ||||||
|  |  | ||||||
|  | _LOGGER = logging.getLogger(__name__) | ||||||
|  |  | ||||||
|  |  | ||||||
| class HonAppliance: | class HonAppliance: | ||||||
|     def __init__( |     def __init__( | ||||||
|         self, api: Optional["HonAPI"], info: Dict[str, Any], zone: int = 0 |         self, api: Optional["HonAPI"], info: Dict[str, Any], zone: int = 0 | ||||||
| @ -183,7 +187,10 @@ class HonAppliance: | |||||||
|  |  | ||||||
|     async def load_attributes(self): |     async def load_attributes(self): | ||||||
|         self._attributes = await self._api.load_attributes(self) |         self._attributes = await self._api.load_attributes(self) | ||||||
|         for name, values in self._attributes.pop("shadow").get("parameters").items(): |         _LOGGER.warning(self._attributes) | ||||||
|  |         for name, values in ( | ||||||
|  |             self._attributes.pop("shadow", {}).get("parameters", {}).items() | ||||||
|  |         ): | ||||||
|             self._attributes.setdefault("parameters", {})[name] = values["parNewVal"] |             self._attributes.setdefault("parameters", {})[name] = values["parNewVal"] | ||||||
|  |  | ||||||
|     async def load_statistics(self): |     async def load_statistics(self): | ||||||
|  | |||||||
| @ -89,8 +89,6 @@ class HonCommand: | |||||||
|         for key, parameter in ( |         for key, parameter in ( | ||||||
|             command._parameters | command._ancillary_parameters |             command._parameters | command._ancillary_parameters | ||||||
|         ).items(): |         ).items(): | ||||||
|             if isinstance(parameter, HonParameterFixed): |  | ||||||
|                 continue |  | ||||||
|             if key not in keys: |             if key not in keys: | ||||||
|                 keys.append(key) |                 keys.append(key) | ||||||
|         return keys |         return keys | ||||||
| @ -108,7 +106,6 @@ class HonCommand: | |||||||
|  |  | ||||||
|     @property |     @property | ||||||
|     def settings(self) -> Dict[str, HonParameter]: |     def settings(self) -> Dict[str, HonParameter]: | ||||||
|         """Parameters with typology enum and range""" |  | ||||||
|         return { |         return { | ||||||
|             s: param |             s: param | ||||||
|             for s in self.setting_keys |             for s in self.setting_keys | ||||||
|  | |||||||
| @ -12,7 +12,7 @@ from pyhon.connection.auth import HonAuth | |||||||
| from pyhon.connection.handler.anonym import HonAnonymousConnectionHandler | from pyhon.connection.handler.anonym import HonAnonymousConnectionHandler | ||||||
| from pyhon.connection.handler.hon import HonConnectionHandler | from pyhon.connection.handler.hon import HonConnectionHandler | ||||||
|  |  | ||||||
| _LOGGER = logging.getLogger() | _LOGGER = logging.getLogger(__name__) | ||||||
|  |  | ||||||
|  |  | ||||||
| class HonAPI: | class HonAPI: | ||||||
| @ -74,13 +74,15 @@ class HonAPI: | |||||||
|             "applianceType": appliance.appliance_type, |             "applianceType": appliance.appliance_type, | ||||||
|             "code": appliance.info["code"], |             "code": appliance.info["code"], | ||||||
|             "applianceModelId": appliance.appliance_model_id, |             "applianceModelId": appliance.appliance_model_id, | ||||||
|             "firmwareId": appliance.info["eepromId"], |  | ||||||
|             "macAddress": appliance.mac_address, |             "macAddress": appliance.mac_address, | ||||||
|             "fwVersion": appliance.info["fwVersion"], |  | ||||||
|             "os": const.OS, |             "os": const.OS, | ||||||
|             "appVersion": const.APP_VERSION, |             "appVersion": const.APP_VERSION, | ||||||
|             "series": appliance.info["series"], |             "series": appliance.info["series"], | ||||||
|         } |         } | ||||||
|  |         if firmware_id := appliance.info.get("eepromId"): | ||||||
|  |             params["firmwareId"] = firmware_id | ||||||
|  |         if firmware_version := appliance.info.get("fwVersion"): | ||||||
|  |             params["fwVersion"] = firmware_version | ||||||
|         url: str = f"{const.API_URL}/commands/v1/retrieve" |         url: str = f"{const.API_URL}/commands/v1/retrieve" | ||||||
|         async with self._hon.get(url, params=params) as response: |         async with self._hon.get(url, params=params) as response: | ||||||
|             result: Dict = (await response.json()).get("payload", {}) |             result: Dict = (await response.json()).get("payload", {}) | ||||||
|  | |||||||
							
								
								
									
										2
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								setup.py
									
									
									
									
									
								
							| @ -7,7 +7,7 @@ with open("README.md", "r") as f: | |||||||
|  |  | ||||||
| setup( | setup( | ||||||
|     name="pyhOn", |     name="pyhOn", | ||||||
|     version="0.8.2", |     version="0.8.6", | ||||||
|     author="Andre Basche", |     author="Andre Basche", | ||||||
|     description="Control hOn devices with python", |     description="Control hOn devices with python", | ||||||
|     long_description=long_description, |     long_description=long_description, | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	