Skip to content

Commit

Permalink
Merge pull request #39 from rospogrigio/fixes_rploeg
Browse files Browse the repository at this point in the history
Fixes for missing capabilities
  • Loading branch information
rospogrigio authored Dec 7, 2021
2 parents 52aed6a + 3f557df commit 3ca544d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
18 changes: 7 additions & 11 deletions custom_components/daikin_residential/daikin_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,26 +513,22 @@ async def async_update(self, **kwargs):
)

_mode = "none"
if (
"econoMode" in dev_data["managementPoints"][1]
and dev_data["managementPoints"][1]["econoMode"]["value"] == "on"
):
mp_data = dev_data["managementPoints"][1]
if "econoMode" in mp_data and mp_data["econoMode"]["value"] == "on":
_mode = "eco"
if (
"powerfulMode" in dev_data["managementPoints"][1]
and dev_data["managementPoints"][1]["powerfulMode"]["value"] == "on"
):
if "powerfulMode" in mp_data and mp_data["powerfulMode"]["value"] == "on":
_mode = "powerful"

_streamer = "not supported"
if "streamerMode" in mp_data:
_streamer = "streamer " + mp_data["streamerMode"]["value"]
_LOGGER.debug(
"DEVICE %s: %s/%s/%s/%s",
dev_data["managementPoints"][1]["name"]["value"],
dev_data["managementPoints"][1]["onOffMode"]["value"],
dev_data["managementPoints"][1]["operationMode"]["value"],
_mode,
"streamer"
if dev_data["managementPoints"][1]["streamerMode"]["value"] == "on"
else "nostreamer",
_streamer,
)

return True
5 changes: 5 additions & 0 deletions custom_components/daikin_residential/daikin_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,11 @@ def support_humidity(self):
"""Return True if the device has humidity sensor."""
return False

@property
def support_inside_temperature(self):
"""Return True if the device supports outsite temperature measurement."""
return self.getData(ATTR_INSIDE_TEMPERATURE) is not None

@property
def support_outside_temperature(self):
"""Return True if the device supports outsite temperature measurement."""
Expand Down
6 changes: 3 additions & 3 deletions custom_components/daikin_residential/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up Daikin climate based on config_entry."""
sensors = []
for dev_id, device in hass.data[DAIKIN_DOMAIN][DAIKIN_DEVICES].items():
sensor = DaikinSensor.factory(device, ATTR_INSIDE_TEMPERATURE)
sensors.append(sensor)

if device.support_inside_temperature:
sensor = DaikinSensor.factory(device, ATTR_INSIDE_TEMPERATURE)
sensors.append(sensor)
if device.support_outside_temperature:
sensor = DaikinSensor.factory(device, ATTR_OUTSIDE_TEMPERATURE)
sensors.append(sensor)
Expand Down

0 comments on commit 3ca544d

Please sign in to comment.