* Added water heater appliance. Added ability to send only mandatory parameters * fixed build * formatting * cleanup * cleanup * reformatting * Added ability to send specific parameters. Useful in case the command has many not mandatory parameters and you want to send only one/few * cleanup * Fixed code style * sync_command - fixed typos, skip to sync(actually reset) parameters of different types. Improved WaterHeater appliance * cleanup * cleanup * clean code style * check if base parameter is mandatory * Reverted back sync_command, send mandatory parameters beside with specified --------- Co-authored-by: Vadym Melnychuk <vme@primexm.com>
		
			
				
	
	
		
			17 lines
		
	
	
		
			564 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
		
			564 B
		
	
	
	
		
			Python
		
	
	
	
	
	
from typing import Any, Dict
 | 
						|
 | 
						|
from pyhon.appliances.base import ApplianceBase
 | 
						|
from pyhon.parameter.base import HonParameter
 | 
						|
 | 
						|
 | 
						|
class Appliance(ApplianceBase):
 | 
						|
    def attributes(self, data: Dict[str, Any]) -> Dict[str, Any]:
 | 
						|
        data = super().attributes(data)
 | 
						|
        parameter = data["parameters"]["onOffStatus"]
 | 
						|
        is_class = isinstance(parameter, HonParameter)
 | 
						|
        data["active"] = parameter.value == 1 if is_class else parameter == 1
 | 
						|
        return data
 | 
						|
 | 
						|
    def settings(self, settings: Dict[str, Any]) -> Dict[str, Any]:
 | 
						|
        return settings
 |