Skip to content

Commit

Permalink
Merge pull request #241 from codyc1515/econavi
Browse files Browse the repository at this point in the history
Fix typos that broke ECONAVI mode
  • Loading branch information
sockless-coding authored Jun 30, 2024
2 parents 654cc2c + 732cf1d commit 9146497
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
6 changes: 6 additions & 0 deletions custom_components/panasonic_cc/panasonic.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def __init__(
self._hvac_mode = None
self._eco_mode = None
self._nanoe_mode = None
self._eco_navi_mode = None
self._daily_energy = None

self.features = None
Expand Down Expand Up @@ -108,6 +109,7 @@ async def do_update(self):
self._hvac_mode = data.parameters.mode.name
self._eco_mode = data.parameters.eco_mode.name
self._nanoe_mode = data.parameters.nanoe_mode
self._eco_navi_mode = data.parameters.eco_navi_mode

except Exception as e:
_LOGGER.debug("Failed to set data for device {id}".format(**self.info))
Expand Down Expand Up @@ -236,6 +238,10 @@ def eco_mode(self) -> Optional[str]:
def nanoe_mode(self):
return self._nanoe_mode

@property
def eco_navi_mode(self):
return self._eco_navi_mode

@property
def energy_sensor_enabled(self):
return self.enable_energy_sensor
Expand Down
5 changes: 3 additions & 2 deletions custom_components/panasonic_cc/pcomfortcloud/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ class NanoeMode(Enum):
All = 4

class EcoNaviMode(Enum):
Off = 0
On = 1
Unavailable = 0
Off = 1
On = 2

class ZoneMode(Enum):
Off = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def __init__(self, json = None) -> None:
self.vertical_swing_mode = constants.AirSwingUD.Mid
self.eco_mode = constants.EcoMode.Auto
self.nanoe_mode = constants.NanoeMode.Unavailable
self.eco_navi_mode = constants.EcoNaviMode.Off
self.eco_navi_mode = constants.EcoNaviMode.Unavailable
self.target_temperature: int = None
self.inside_temperature: int = None
self.outside_temperature: int = None
Expand All @@ -140,7 +140,7 @@ def load(self, json):

self.eco_mode = read_enum(json, 'ecoMode', constants.EcoMode, self.eco_mode)
self.nanoe_mode = read_enum(json, 'nanoe', constants.NanoeMode, self.nanoe_mode)
self.eco_mode = read_enum(json, 'ecoNavi', constants.EcoNaviMode, self.eco_navi_mode)
self.eco_navi_mode = read_enum(json, 'ecoNavi', constants.EcoNaviMode, self.eco_navi_mode)


def _load_zones(self, json):
Expand Down
14 changes: 7 additions & 7 deletions custom_components/panasonic_cc/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ async def async_setup_entry(hass, entry, async_add_entities):
async_add_entities(devices)

class PanasonicNanoeSwitch(ToggleEntity):
"""Representation of a zone."""
"""Representation of Nanoe."""

def __init__(self, api_device:PanasonicApiDevice):
"""Initialize the zone."""
"""Initialize the Nanoe."""
self._api = api_device
self._attr_entity_category = EntityCategory.CONFIG

Expand Down Expand Up @@ -80,7 +80,7 @@ async def async_turn_off(self, **kwargs):
await self._api.set_nanoe_mode(self._api.constants.NanoeMode.Off.name)

class PanasonicEcoNaviSwitch(ToggleEntity):
"""Representation of a zone."""
"""Representation of ECONAVI."""

def __init__(self, api_device:PanasonicApiDevice):
"""Initialize the zone."""
Expand All @@ -100,12 +100,12 @@ def icon(self):
@property
def name(self):
"""Return the name of the sensor."""
return f"{self._api.name} Eco Navi"
return f"{self._api.name} ECONAVI"

@property
def is_on(self):
"""Return the state of the sensor."""
return self._api.nanoe_mode == constants.EcoNaviMode.On
return self._api.eco_navi_mode == self._api.constants.EcoNaviMode.On

@property
def device_info(self):
Expand All @@ -117,11 +117,11 @@ async def async_update(self):
await self._api.update()

async def async_turn_on(self, **kwargs):
"""Turn on nanoe."""
"""Turn on ECONAVI."""
await self._api.set_eco_navi_mode(constants.EcoNaviMode.On)

async def async_turn_off(self, **kwargs):
"""Turn off nanoe."""
"""Turn off ECONAVI."""
await self._api.set_eco_navi_mode(constants.EcoNaviMode.Off)

class PanasonicZoneSwitch(ToggleEntity):
Expand Down

0 comments on commit 9146497

Please sign in to comment.