mirror of
https://github.com/micahqcade/custom_vesync.git
synced 2025-03-12 07:40:07 +01:00
Add current_humidity attribute (#24)
* Add current_humidity attribute * fix linter * ignore brand in validate * same * improve extra attributes
This commit is contained in:
parent
c0b9adc723
commit
4f3c7fd36f
1
.github/workflows/validate.yml
vendored
1
.github/workflows/validate.yml
vendored
@ -13,5 +13,6 @@ jobs:
|
|||||||
- name: HACS validation
|
- name: HACS validation
|
||||||
uses: "hacs/action@main"
|
uses: "hacs/action@main"
|
||||||
with:
|
with:
|
||||||
|
ignore: "brands"
|
||||||
category: "integration"
|
category: "integration"
|
||||||
comment: false
|
comment: false
|
||||||
|
@ -2,6 +2,3 @@
|
|||||||
ignored:
|
ignored:
|
||||||
- SC1090
|
- SC1090
|
||||||
- SC1091
|
- SC1091
|
||||||
|
|
||||||
/home/vlb/temp/HAcore/custom_vesync/.venv/local/bin
|
|
||||||
/home/vlb/temp/HAcore/custom_vesync/.venv/bin
|
|
@ -22,6 +22,7 @@ MAX_HUMIDITY = 80
|
|||||||
MIN_HUMIDITY = 30
|
MIN_HUMIDITY = 30
|
||||||
|
|
||||||
MODES = [MODE_AUTO, MODE_NORMAL, MODE_SLEEP]
|
MODES = [MODE_AUTO, MODE_NORMAL, MODE_SLEEP]
|
||||||
|
VESYNC_TO_HA_ATTRIBUTES = {"humidity": "current_humidity"}
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
@ -113,35 +114,13 @@ class VeSyncHumidifierHA(VeSyncDevice, HumidifierEntity):
|
|||||||
@property
|
@property
|
||||||
def extra_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the humidifier."""
|
"""Return the state attributes of the humidifier."""
|
||||||
|
|
||||||
attr = {}
|
attr = {}
|
||||||
|
for k, v in self.smarthumidifier.details.items():
|
||||||
if "water_lacks" in self.smarthumidifier.details:
|
if k in VESYNC_TO_HA_ATTRIBUTES:
|
||||||
attr["water_lacks"] = self.smarthumidifier.details["water_lacks"]
|
attr[VESYNC_TO_HA_ATTRIBUTES[k]] = v
|
||||||
|
elif k not in self.state_attributes:
|
||||||
if "humidity_high" in self.smarthumidifier.details:
|
attr[k] = v
|
||||||
attr["humidity_high"] = self.smarthumidifier.details["humidity_high"]
|
|
||||||
|
|
||||||
if "water_tank_lifted" in self.smarthumidifier.details:
|
|
||||||
attr["water_tank_lifted"] = self.smarthumidifier.details[
|
|
||||||
"water_tank_lifted"
|
|
||||||
]
|
|
||||||
|
|
||||||
if "automatic_stop_reach_target" in self.smarthumidifier.details:
|
|
||||||
attr["automatic_stop_reach_target"] = self.smarthumidifier.details[
|
|
||||||
"automatic_stop_reach_target"
|
|
||||||
]
|
|
||||||
|
|
||||||
if "mist_level" in self.smarthumidifier.details:
|
|
||||||
attr["mist_level"] = self.smarthumidifier.details["mist_level"]
|
|
||||||
|
|
||||||
if "warm_mist_level" in self.smarthumidifier.details:
|
|
||||||
attr["warm_mist_level"] = self.smarthumidifier.details["warm_mist_level"]
|
|
||||||
|
|
||||||
if "warm_mist_enabled" in self.smarthumidifier.details:
|
|
||||||
attr["warm_mist_enabled"] = self.smarthumidifier.details[
|
|
||||||
"warm_mist_enabled"
|
|
||||||
]
|
|
||||||
|
|
||||||
return attr
|
return attr
|
||||||
|
|
||||||
def set_humidity(self, humidity):
|
def set_humidity(self, humidity):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user