Skip to content

Commit

Permalink
new extra_state_attributes for #36
Browse files Browse the repository at this point in the history
new extra_state_attributes ATTR_REMOTE_ACCESS_ALARM and ATTR_DEVICE_LOST_ALARM for #36
  • Loading branch information
dave-code-ruiz authored Dec 13, 2024
1 parent eca0a04 commit 326ab33
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
11 changes: 7 additions & 4 deletions custom_components/uhomeuponor/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@
ATTR_TECHNICAL_ALARM = "technical_alarm"
ATTR_RF_SIGNAL_ALARM = "rf_alarm"
ATTR_BATTERY_ALARM = "battery_alarm"
ATTR_REMOTE_ACCESS_ALARM = "remote_access_alarm"
ATTR_DEVICE_LOST_ALARM = "device_lost_alarm"

_LOGGER = getLogger(__name__)


async def async_setup_entry(hass, config_entry, async_add_entities):
_LOGGER.info("init setup climate platform for id: %s data: %s, options: %s", config_entry.entry_id, config_entry.data, config_entry.options)
config = config_entry.data
Expand Down Expand Up @@ -143,9 +144,11 @@ def target_temperature(self):
@property
def extra_state_attributes(self):
return {
ATTR_TECHNICAL_ALARM: self.thermostat.by_name('technical_alarm').value,
ATTR_RF_SIGNAL_ALARM: self.thermostat.by_name('rf_alarm').value,
ATTR_BATTERY_ALARM: self.thermostat.by_name('battery_alarm').value
ATTR_TECHNICAL_ALARM: self.thermostat.by_name(ATTR_TECHNICAL_ALARM).value,
ATTR_RF_SIGNAL_ALARM: self.thermostat.by_name(ATTR_RF_SIGNAL_ALARM).value,
ATTR_BATTERY_ALARM: self.thermostat.by_name(ATTR_BATTERY_ALARM).value,
ATTR_REMOTE_ACCESS_ALARM: self.uponor_client.uhome.by_name(ATTR_REMOTE_ACCESS_ALARM).value,
ATTR_DEVICE_LOST_ALARM: self.uponor_client.uhome.by_name(ATTR_DEVICE_LOST_ALARM).value
}

@property
Expand Down
16 changes: 8 additions & 8 deletions custom_components/uhomeuponor/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from homeassistant.exceptions import PlatformNotReady
from homeassistant.components.sensor import (PLATFORM_SCHEMA, SensorDeviceClass)
from homeassistant.const import (CONF_HOST, CONF_PREFIX, UnitOfTemperature)
from homeassistant.const import (CONF_HOST, CONF_PREFIX, ATTR_ATTRIBUTION, UnitOfTemperature)
import homeassistant.helpers.config_validation as cv
from logging import getLogger
from homeassistant.helpers.entity import Entity
Expand Down Expand Up @@ -103,13 +103,13 @@ def available(self):
return self._available

# ** DEBUG PROPERTY **
# @property
# def extra_state_attributes(self):
# """Return the device state attributes."""
# attr = self.thermostat.attributes() + self.uponor_client.uhome.attributes()
# return {
# ATTR_ATTRIBUTION: attr,
# }
@property
def extra_state_attributes(self):
"""Return the device state attributes."""
attr = self.thermostat.attributes() + self.uponor_client.uhome.attributes()
return {
ATTR_ATTRIBUTION: attr,
}

# ** Static **
@property
Expand Down
4 changes: 2 additions & 2 deletions custom_components/uhomeuponor/uponor_api/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
'average_temp_low': {'addr': 28, 'value': 0, 'property': '85'},
'low_temp_alarm_limit': {'addr': 29, 'value': 0, 'property': '85'},
'low_temp_alarm_hysteresis': {'addr': 30, 'value': 0, 'property': '85'},
'remote_access_alarm': {'addr': 31, 'value': 0, 'property': '85'},
'device_lost_alarm': {'addr': 32, 'value': 0, 'property': '85'},
'remote_access_alarm': {'addr': 31, 'value': 0, 'property': '662'},
'device_lost_alarm': {'addr': 32, 'value': 0, 'property': '662'},
'no_comm_controller1': {'addr': 33, 'value': 0, 'property': '85'},
'no_comm_controller2': {'addr': 34, 'value': 0, 'property': '85'},
'no_comm_controller3': {'addr': 35, 'value': 0, 'property': '85'},
Expand Down

0 comments on commit 326ab33

Please sign in to comment.