Restore last command value only if possible #6
This commit is contained in:
		@@ -1,4 +1,5 @@
 | 
				
			|||||||
import importlib
 | 
					import importlib
 | 
				
			||||||
 | 
					from contextlib import suppress
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from pyhon.commands import HonCommand
 | 
					from pyhon.commands import HonCommand
 | 
				
			||||||
from pyhon.parameter import HonParameterFixed
 | 
					from pyhon.parameter import HonParameterFixed
 | 
				
			||||||
@@ -95,7 +96,8 @@ class HonDevice:
 | 
				
			|||||||
                command = self.commands[name]
 | 
					                command = self.commands[name]
 | 
				
			||||||
            for key, data in command.settings.items():
 | 
					            for key, data in command.settings.items():
 | 
				
			||||||
                if not isinstance(data, HonParameterFixed) and parameters.get(key) is not None:
 | 
					                if not isinstance(data, HonParameterFixed) and parameters.get(key) is not None:
 | 
				
			||||||
                    data.value = parameters.get(key)
 | 
					                    with suppress(ValueError):
 | 
				
			||||||
 | 
					                        data.value = parameters.get(key)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    async def load_commands(self):
 | 
					    async def load_commands(self):
 | 
				
			||||||
        raw = await self._connector.load_commands(self)
 | 
					        raw = await self._connector.load_commands(self)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										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.7",
 | 
					    version="0.3.8",
 | 
				
			||||||
    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