Skip to content
This repository has been archived by the owner on Jul 10, 2022. It is now read-only.

Commit

Permalink
Add boost range
Browse files Browse the repository at this point in the history
  • Loading branch information
cyr-ius committed Apr 30, 2020
1 parent 3956213 commit d0fcffa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion custom_components/cozytouch/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Cozytouch",
"config_flow": true,
"documentation": "https://www.home-assistant.io/components/cozytouch",
"requirements": ["cozytouchpy==1.5.4"],
"requirements": ["cozytouchpy==1.5.5"],
"dependencies": [],
"codeowners": ["@biker91620", "@cyr-ius"]
}
28 changes: 23 additions & 5 deletions custom_components/cozytouch/water_heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,16 @@ def avaibility(self):
"""Return avaibility sensor."""
return self.water_heater.is_on

@property
def target_temperature_high(self):
"""Return the highbound target temperature we try to reach."""
return self.water_heater.get_state(DeviceState.MAX_TEMPERATURE_MANUEL_MODE_STATE)

@property
def target_temperature_low(self):
"""Return the lowbound target temperature we try to reach."""
return self.water_heater.get_state(DeviceState.MIN_TEMPERATURE_MANUEL_MODE_STATE)

@property
def min_temp(self):
"""Return the minimum temperature."""
Expand Down Expand Up @@ -246,6 +256,12 @@ def device_state_attributes(self):
"boost_mode_duration": self.water_heater.get_state(
DeviceState.BOOST_MODE_DURATION_STATE
),
"boost_mode_start": self.water_heater.get_state(
DeviceState.BOOST_START_DATE_STATE
),
"boost_mode_end": self.water_heater.get_state(
DeviceState.BOOST_END_DATE_STATE
),
"anti_legionellosis": self.water_heater.get_state(
DeviceState.ANTI_LEGIONELLOSIS_STATE
),
Expand All @@ -258,10 +274,10 @@ def device_state_attributes(self):
"booster_time": int(
self.water_heater.get_state(
DeviceState.ELECTRIC_BOOSTER_OPERATING_TIME_STATE
)
) or -1
),
"heatpump_time": int(
self.water_heater.get_state(DeviceState.HEAT_PUMP_OPERATING_TIME_STATE)
self.water_heater.get_state(DeviceState.HEAT_PUMP_OPERATING_TIME_STATE) or -1
),
"power_electrical": int(
self.water_heater.get_state(DeviceState.POWER_HEAT_ELECTRICAL_STATE)
Expand All @@ -288,9 +304,11 @@ def device_state_attributes(self):
)
) * 100
),
"showers_remaining": round(
(self.current_temperature - 10) / 30 / 1.33 * int(self.water_heater.get_state(DeviceState.DHW_CAPACITY_STATE)) / 40
"showers_remaining": int(
self.water_heater.get_state(DeviceState.NUM_SHOWER_REMAINING_STATE) or -1
),
}

return attributes
# Remove attributes is empty
clean_attributes = {k: v for k, v in attributes.items() if (v is not None and v != -1)}
return clean_attributes

0 comments on commit d0fcffa

Please sign in to comment.