refactor: refactor climate.py (#614)
Some checks failed
Tests / check-rule-format (push) Has been cancelled
Validate / validate-hassfest (push) Has been cancelled
Validate / validate-hacs (push) Has been cancelled
Validate / validate-lint (push) Has been cancelled
Validate / validate-setup (push) Has been cancelled

* feat: add thermostat as climate entity

* feat: add bath-heater as climate entity

* refactor: climate entity

* fix: thermostat on/off

* fix: get the current fan mode

* perf: get fan level

* fix: fix climate hvac_mode

* fix: misuse of getting key or value from dict[int, any]

* style: add comments

* style: format the file based on google style

* fix: initialize _attr_hvac_modes

* feat: add heat and defog mode of ptc bath heater

---------

Co-authored-by: topsworld <sworldtop@gmail.com>
This commit is contained in:
Li Shuzhen 2025-02-19 09:21:46 +08:00 committed by GitHub
parent 57422ddf0d
commit 20b0004746
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 601 additions and 428 deletions

File diff suppressed because it is too large Load Diff

View File

@ -224,6 +224,31 @@ SPEC_DEVICE_TRANS_MAP: dict = {
'entity': 'air-conditioner'
},
'air-condition-outlet': 'air-conditioner',
'thermostat': {
'required': {
'thermostat': {
'required': {
'properties': {
'on': {'read', 'write'}
}
},
'optional': {
'properties': {
'target-temperature', 'mode', 'fan-level',
'temperature'}
},
}
},
'optional': {
'environment': {
'required': {},
'optional': {
'properties': {'temperature', 'relative-humidity'}
}
},
},
'entity': 'thermostat'
},
'heater': {
'required': {
'heater': {
@ -246,6 +271,30 @@ SPEC_DEVICE_TRANS_MAP: dict = {
},
},
'entity': 'heater'
},
'bath-heater': {
'required': {
'ptc-bath-heater': {
'required': {},
'optional': {
'properties': {
'target-temperature', 'heat-level',
'temperature', 'mode'
}
},
}
},
'optional': {
'fan-control': {
'required': {},
'optional': {
'properties': {
'on', 'fan-level', 'horizontal-swing', 'vertical-swing'
}
},
}
},
'entity': 'bath-heater',
}
}