-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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 <[email protected]>
- Loading branch information
1 parent
ff8ae16
commit 6ae4048
Showing
3 changed files
with
20 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
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) | ||
data["active"] = data["parameters"]["onOffStatus"] == "1" | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters