Fix bugs
This commit is contained in:
		
							
								
								
									
										0
									
								
								pyhon/appliances/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								pyhon/appliances/__init__.py
									
									
									
									
									
										Normal file
									
								
							@@ -23,7 +23,7 @@ class HonDevice:
 | 
				
			|||||||
        if "." in item:
 | 
					        if "." in item:
 | 
				
			||||||
            result = self.data
 | 
					            result = self.data
 | 
				
			||||||
            for key in item.split("."):
 | 
					            for key in item.split("."):
 | 
				
			||||||
                if all([k in "0123456789" for k in key]):
 | 
					                if all([k in "0123456789" for k in key]) and type(result) is list:
 | 
				
			||||||
                    result = result[int(key)]
 | 
					                    result = result[int(key)]
 | 
				
			||||||
                else:
 | 
					                else:
 | 
				
			||||||
                    result = result[key]
 | 
					                    result = result[key]
 | 
				
			||||||
@@ -31,15 +31,16 @@ class HonDevice:
 | 
				
			|||||||
        else:
 | 
					        else:
 | 
				
			||||||
            if item in self.data:
 | 
					            if item in self.data:
 | 
				
			||||||
                return self.data[item]
 | 
					                return self.data[item]
 | 
				
			||||||
            return self.attributes["parameters"].get(item, self.appliance[item])
 | 
					            if item in self.attributes["parameters"]:
 | 
				
			||||||
 | 
					                return self.attributes["parameters"].get(item)
 | 
				
			||||||
 | 
					            return self.appliance[item]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def get(self, item, default=None):
 | 
					    def get(self, item, default=None):
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            return self[item]
 | 
					            return self[item]
 | 
				
			||||||
        except KeyError | IndexError:
 | 
					        except (KeyError, IndexError):
 | 
				
			||||||
            return default
 | 
					            return default
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    @property
 | 
					    @property
 | 
				
			||||||
    def appliance_model_id(self):
 | 
					    def appliance_model_id(self):
 | 
				
			||||||
        return self._appliance.get("applianceModelId")
 | 
					        return self._appliance.get("applianceModelId")
 | 
				
			||||||
@@ -127,7 +128,7 @@ class HonDevice:
 | 
				
			|||||||
    @property
 | 
					    @property
 | 
				
			||||||
    def data(self):
 | 
					    def data(self):
 | 
				
			||||||
        result = {"attributes": self.attributes, "appliance": self.appliance, "statistics": self.statistics,
 | 
					        result = {"attributes": self.attributes, "appliance": self.appliance, "statistics": self.statistics,
 | 
				
			||||||
                  "commands": self.parameters}
 | 
					                  **self.parameters}
 | 
				
			||||||
        if self._extra:
 | 
					        if self._extra:
 | 
				
			||||||
            return result | self._extra.Appliance(result).get()
 | 
					            return result | self._extra.Appliance(result).get()
 | 
				
			||||||
        return result
 | 
					        return result
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										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.3.1",
 | 
					    version="0.3.2",
 | 
				
			||||||
    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