Skip to content

Commit

Permalink
Fixes power_sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
vassilis-panos committed Jan 7, 2021
1 parent 40973e4 commit 1ad385e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion custom_components/smartir/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
_LOGGER = logging.getLogger(__name__)

DOMAIN = 'smartir'
VERSION = '1.14.0'
VERSION = '1.14.1'
MANIFEST_URL = (
"https://raw.githubusercontent.com/"
"smartHomeHub/SmartIR/{}/"
Expand Down
9 changes: 6 additions & 3 deletions custom_components/smartir/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
SUPPORT_TARGET_TEMPERATURE, SUPPORT_FAN_MODE,
HVAC_MODES, ATTR_HVAC_MODE)
from homeassistant.const import (
CONF_NAME, STATE_ON, STATE_UNKNOWN, ATTR_TEMPERATURE,
CONF_NAME, STATE_ON, STATE_OFF, STATE_UNKNOWN, ATTR_TEMPERATURE,
PRECISION_TENTHS, PRECISION_HALVES, PRECISION_WHOLE)
from homeassistant.core import callback
from homeassistant.helpers.event import async_track_state_change
Expand Down Expand Up @@ -261,7 +261,7 @@ def device_state_attributes(self) -> dict:
'manufacturer': self._manufacturer,
'supported_models': self._supported_models,
'supported_controller': self._supported_controller,
'commands_encoding': self._commands_encoding,
'commands_encoding': self._commands_encoding
}

async def async_set_temperature(self, **kwargs):
Expand Down Expand Up @@ -362,6 +362,9 @@ async def _async_power_sensor_changed(self, entity_id, old_state, new_state):
if new_state is None:
return

if new_state.state == old_state.state:
return

if new_state.state == STATE_ON and self._hvac_mode == HVAC_MODE_OFF:
self._on_by_remote = True
if self._power_sensor_restore_state == True and self._last_on_operation is not None:
Expand All @@ -371,7 +374,7 @@ async def _async_power_sensor_changed(self, entity_id, old_state, new_state):

await self.async_update_ha_state()

if new_state.state == HVAC_MODE_OFF:
if new_state.state == STATE_OFF:
self._on_by_remote = False
if self._hvac_mode != HVAC_MODE_OFF:
self._hvac_mode = HVAC_MODE_OFF
Expand Down
4 changes: 2 additions & 2 deletions custom_components/smartir/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"requirements": ["aiofiles==0.5.0"],
"homeassistant": "0.115.0",
"updater": {
"version": "1.14.0",
"releaseNotes": "-- Adds power_sensor_restore_state",
"version": "1.14.1",
"releaseNotes": "-- Fixes power_sensor",
"files": [
"__init__.py",
"climate.py",
Expand Down

0 comments on commit 1ad385e

Please sign in to comment.