Restore last command value only if possible #6
This commit is contained in:
		@@ -1,4 +1,5 @@
 | 
			
		||||
import importlib
 | 
			
		||||
from contextlib import suppress
 | 
			
		||||
 | 
			
		||||
from pyhon.commands import HonCommand
 | 
			
		||||
from pyhon.parameter import HonParameterFixed
 | 
			
		||||
@@ -95,6 +96,7 @@ class HonDevice:
 | 
			
		||||
                command = self.commands[name]
 | 
			
		||||
            for key, data in command.settings.items():
 | 
			
		||||
                if not isinstance(data, HonParameterFixed) and parameters.get(key) is not None:
 | 
			
		||||
                    with suppress(ValueError):
 | 
			
		||||
                        data.value = parameters.get(key)
 | 
			
		||||
 | 
			
		||||
    async def load_commands(self):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user