Esempio n. 1
0
    def device_state_attributes(self):
        """Return the optional state attributes."""
        data = {}
        target_temp_high = self.target_temperature_high
        target_temp_low = self.target_temperature_low
        if target_temp_high is not None:
            data[ATTR_TARGET_TEMP_HIGH] = show_temp(
                self.hass, self.target_temperature_high, self.temperature_unit,
                PRECISION_TENTHS)
        if target_temp_low is not None:
            data[ATTR_TARGET_TEMP_LOW] = show_temp(
                self.hass, self.target_temperature_low, self.temperature_unit,
                PRECISION_TENTHS)

        if self.external_temperature:
            data[ATTR_EXTERNAL_TEMPERATURE] = show_temp(
                self.hass, self.external_temperature, self.temperature_unit,
                PRECISION_TENTHS)

        if self.smart_temperature:
            data[ATTR_SMART_TEMPERATURE] = self.smart_temperature

        if self.occupied:
            data[ATTR_OCCUPIED] = self.occupied

        if self.eco_target:
            data[ATTR_ECO_TARGET] = self.eco_target

        current_humidity = self.current_humidity
        if current_humidity is not None:
            data[ATTR_CURRENT_HUMIDITY] = current_humidity

        return data
Esempio n. 2
0
    def state_attributes(self):
        """Return the optional state attributes."""
        data = {
            ATTR_MIN_TEMP: show_temp(
                self.hass, self.min_temp, self.temperature_unit,
                self.precision),
            ATTR_MAX_TEMP: show_temp(
                self.hass, self.max_temp, self.temperature_unit,
                self.precision),
            ATTR_TEMPERATURE: show_temp(
                self.hass, self.target_temperature, self.temperature_unit,
                self.precision),
        }

        supported_features = self.supported_features

        if supported_features & SUPPORT_OPERATION_MODE:
            data[ATTR_OPERATION_MODE] = self.current_operation
            if self.operation_list:
                data[ATTR_OPERATION_LIST] = self.operation_list

        if supported_features & SUPPORT_AWAY_MODE:
            is_away = self.is_away_mode_on
            data[ATTR_AWAY_MODE] = STATE_ON if is_away else STATE_OFF

        return data
Esempio n. 3
0
    def state_attributes(self):
        """Return the state attributes."""
        data = {
            ATTR_WEATHER_TEMPERATURE: show_temp(
                self.hass, self.temperature, self.temperature_unit,
                self.precision),
        }

        humidity = self.humidity
        if humidity is not None:
            data[ATTR_WEATHER_HUMIDITY] = round(humidity)

        ozone = self.ozone
        if ozone is not None:
            data[ATTR_WEATHER_OZONE] = ozone

        pressure = self.pressure
        if pressure is not None:
            data[ATTR_WEATHER_PRESSURE] = pressure

        wind_bearing = self.wind_bearing
        if wind_bearing is not None:
            data[ATTR_WEATHER_WIND_BEARING] = wind_bearing

        wind_speed = self.wind_speed
        if wind_speed is not None:
            data[ATTR_WEATHER_WIND_SPEED] = wind_speed

        visibility = self.visibility
        if visibility is not None:
            data[ATTR_WEATHER_VISIBILITY] = visibility

        attribution = self.attribution
        if attribution is not None:
            data[ATTR_WEATHER_ATTRIBUTION] = attribution

        if self.forecast is not None:
            forecast = []
            for forecast_entry in self.forecast:
                forecast_entry = dict(forecast_entry)
                forecast_entry[ATTR_FORECAST_TEMP] = show_temp(
                    self.hass, forecast_entry[ATTR_FORECAST_TEMP],
                    self.temperature_unit, self.precision)
                if ATTR_FORECAST_TEMP_LOW in forecast_entry:
                    forecast_entry[ATTR_FORECAST_TEMP_LOW] = show_temp(
                        self.hass, forecast_entry[ATTR_FORECAST_TEMP_LOW],
                        self.temperature_unit, self.precision)
                forecast.append(forecast_entry)

            data[ATTR_FORECAST] = forecast

        return data
Esempio n. 4
0
    def state_attributes(self):
        """Return the state attributes."""
        data = {
            ATTR_WEATHER_TEMPERATURE:
            show_temp(self.hass, self.temperature, self.temperature_unit,
                      self.precision),
        }

        humidity = self.humidity
        if humidity is not None:
            data[ATTR_WEATHER_HUMIDITY] = round(humidity)

        ozone = self.ozone
        if ozone is not None:
            data[ATTR_WEATHER_OZONE] = ozone

        pressure = self.pressure
        if pressure is not None:
            data[ATTR_WEATHER_PRESSURE] = pressure

        wind_bearing = self.wind_bearing
        if wind_bearing is not None:
            data[ATTR_WEATHER_WIND_BEARING] = wind_bearing

        wind_speed = self.wind_speed
        if wind_speed is not None:
            data[ATTR_WEATHER_WIND_SPEED] = wind_speed

        visibility = self.visibility
        if visibility is not None:
            data[ATTR_WEATHER_VISIBILITY] = visibility

        attribution = self.attribution
        if attribution is not None:
            data[ATTR_WEATHER_ATTRIBUTION] = attribution

        if self.forecast is not None:
            forecast = []
            for forecast_entry in self.forecast:
                forecast_entry = dict(forecast_entry)
                forecast_entry[ATTR_FORECAST_TEMP] = show_temp(
                    self.hass, forecast_entry[ATTR_FORECAST_TEMP],
                    self.temperature_unit, self.precision)
                if ATTR_FORECAST_TEMP_LOW in forecast_entry:
                    forecast_entry[ATTR_FORECAST_TEMP_LOW] = show_temp(
                        self.hass, forecast_entry[ATTR_FORECAST_TEMP_LOW],
                        self.temperature_unit, self.precision)
                forecast.append(forecast_entry)

            data[ATTR_FORECAST] = forecast

        return data
    def state_attributes(self):
        """Return the optional state attributes."""
        data = {
            ATTR_CURRENT_TEMPERATURE:
            show_temp(self.hass, self.current_temperature,
                      self.temperature_unit, self.precision),
            ATTR_MIN_TEMP:
            show_temp(self.hass, self.min_temp, self.temperature_unit,
                      self.precision),
            ATTR_MAX_TEMP:
            show_temp(self.hass, self.max_temp, self.temperature_unit,
                      self.precision),
            ATTR_TEMPERATURE:
            show_temp(self.hass, self.target_temperature,
                      self.temperature_unit, self.precision),
        }
        data[ATTR_TARGET_TEMPERATURE] = self.target_temperature
        data[ATTR_AIRCLEAN_MODE] = self.is_airclean_mode
        data[ATTR_COOLPOWER_MODE] = self.is_coolpower_mode
        data[ATTR_AUTODRY_MODE] = self.is_autodry_mode
        data[ATTR_SMARTCARE_MODE] = self.is_smartcare_mode
        data[ATTR_POWERSAVE_MODE] = self.is_powersave_mode
        data[ATTR_LONGPOWER_MODE] = self.is_longpower_mode
        data[ATTR_UP_DOWN_MODE] = self.is_up_down_mode
        data[ATTR_HUMIDITY] = self._state.humidity
        data[ATTR_SENSORPM1] = self._state.sensorpm1
        data[ATTR_SENSORPM2] = self._state.sensorpm2
        data[ATTR_SENSORPM10] = self._state.sensorpm10
        data[ATTR_TOTALAIRPOLUTION] = self._state.total_air_polution
        data[ATTR_AIRPOLUTION] = self._state.air_polution
        data[ATTR_STATUS] = self.current_status
        data[ATTR_FILTER_STATE] = self.filter_state
        data[ATTR_MFILTER_STATE] = self.mfilter_state
        supported_features = self.supported_features
        if supported_features & SUPPORT_FAN_MODE:
            data[ATTR_FAN_MODE] = self.current_fan_mode
            if self.fan_list:
                data[ATTR_FAN_LIST] = self.fan_list

        if supported_features & SUPPORT_OPERATION_MODE:
            data[ATTR_OPERATION_MODE] = self.current_operation
            if self.operation_list:
                data[ATTR_OPERATION_LIST] = self.operation_list

        if supported_features & SUPPORT_SWING_MODE:
            data[ATTR_SWING_MODE] = self.current_swing_mode
            if self.swing_list:
                data[ATTR_SWING_LIST] = self.swing_list
        return data
Esempio n. 6
0
 def state_attributes(self):
     """Return the optional state attributes."""
     data = super().state_attributes
     data['supply_temperature'] = show_temp(
         self.hass, self.supply_temperature, self.temperature_unit,
         self.precision)
     return data
Esempio n. 7
0
 def device_state_attributes(self):
     """Return the optional state attributes."""
     return {
         "supply_temperature": show_temp(
             self.hass,
             self.supply_temperature,
             self.temperature_unit,
             self.precision,
         ),
         "temp_setpoint": show_temp(
             self.hass,
             self._controller.temp_setpoint,
             self.temperature_unit,
             PRECISION_HALVES,
         ),
     }
Esempio n. 8
0
    def capability_attributes(self):
        """Return capability attributes."""
        supported_features = self.supported_features or 0

        data = {
            ATTR_MIN_TEMP: show_temp(
                self.hass, self.min_temp, self.temperature_unit, self.precision
            ),
            ATTR_MAX_TEMP: show_temp(
                self.hass, self.max_temp, self.temperature_unit, self.precision
            ),
        }

        if supported_features & SUPPORT_OPERATION_MODE:
            data[ATTR_OPERATION_LIST] = self.operation_list

        return data
Esempio n. 9
0
    def device_state_attributes(self):
        """Return the optional device state attributes."""
        data = {}
        target_temp_high = self.target_temperature_high
        target_temp_low = self.target_temperature_low
        if target_temp_high is not None:
            data[ATTR_TARGET_TEMP_HIGH] = show_temp(
                self.hass, self.target_temperature_high, self.temperature_unit,
                PRECISION_TENTHS)
        if target_temp_low is not None:
            data[ATTR_TARGET_TEMP_LOW] = show_temp(
                self.hass, self.target_temperature_low, self.temperature_unit,
                PRECISION_TENTHS)
        data[ATTR_TOTAL_CONSUMPTION] = self.wink.total_consumption()
        data[ATTR_SCHEDULE_ENABLED] = self.wink.schedule_enabled()

        return data
Esempio n. 10
0
 def state(self):
     """Return the current state."""
     return show_temp(
         self.hass,
         self.spa.temp_now,
         self.temperature_unit,
         self.precision,
     )
Esempio n. 11
0
    def device_state_attributes(self):
        """Return the optional state attributes."""
        data = {}
        target_temp_high = self.target_temperature_high
        target_temp_low = self.target_temperature_low
        if target_temp_high is not None:
            data[ATTR_TARGET_TEMP_HIGH] = show_temp(
                self.hass, self.target_temperature_high, self.temperature_unit,
                PRECISION_TENTHS)
        if target_temp_low is not None:
            data[ATTR_TARGET_TEMP_LOW] = show_temp(
                self.hass, self.target_temperature_low, self.temperature_unit,
                PRECISION_TENTHS)
        data[ATTR_TOTAL_CONSUMPTION] = self.wink.total_consumption()
        data[ATTR_SCHEDULE_ENABLED] = self.wink.schedule_enabled()

        return data
Esempio n. 12
0
 def target_temperature(self):
     """Return the target temperature."""
     return show_temp(
         self.hass,
         self._lm.current_status.get(
             self._entities[self._object_id][ENTITY_TSET_TAG], 0),
         self.temperature_unit,
         self.precision,
     )
Esempio n. 13
0
    def state_attributes(self):
        """Return the optional state attributes."""
        data = {
            ATTR_CURRENT_TEMPERATURE:
            show_temp(
                self.hass,
                self.current_temperature,
                self.temperature_unit,
                self.precision,
            ),
            ATTR_TEMPERATURE:
            show_temp(
                self.hass,
                self.target_temperature,
                self.temperature_unit,
                self.precision,
            ),
            ATTR_TARGET_TEMP_HIGH:
            show_temp(
                self.hass,
                self.target_temperature_high,
                self.temperature_unit,
                self.precision,
            ),
            ATTR_TARGET_TEMP_LOW:
            show_temp(
                self.hass,
                self.target_temperature_low,
                self.temperature_unit,
                self.precision,
            ),
        }

        supported_features = self.supported_features

        if supported_features & SUPPORT_OPERATION_MODE:
            data[ATTR_OPERATION_MODE] = self.current_operation

        if supported_features & SUPPORT_AWAY_MODE:
            is_away = self.is_away_mode_on
            data[ATTR_AWAY_MODE] = STATE_ON if is_away else STATE_OFF

        return data
Esempio n. 14
0
    def state_attributes(self):
        """Return the optional state attributes."""
        supported_features = self.supported_features
        data = {
            ATTR_HVAC_MODES: self.hvac_modes,
            ATTR_CURRENT_TEMPERATURE: show_temp(
                self.hass,
                self.current_temperature,
                self.temperature_unit,
                self.precision,
            ),
            'current_temperature_external': show_temp(
                self.hass, self.current_temperature_external, self.temperature_unit, self.precision
            ),
            ATTR_MIN_TEMP: show_temp(
                self.hass, self.min_temp, self.temperature_unit, self.precision
            ),
            ATTR_MAX_TEMP: show_temp(
                self.hass, self.max_temp, self.temperature_unit, self.precision
            ),
        }

        if self.target_temperature_step:
            data[ATTR_TARGET_TEMP_STEP] = self.target_temperature_step

        if supported_features & SUPPORT_TARGET_TEMPERATURE:
            data[ATTR_TEMPERATURE] = show_temp(
                self.hass,
                self.target_temperature,
                self.temperature_unit,
                self.precision,
            )

        if supported_features & SUPPORT_TARGET_TEMPERATURE_RANGE:
            data[ATTR_TARGET_TEMP_HIGH] = show_temp(
                self.hass,
                self.target_temperature_high,
                self.temperature_unit,
                self.precision,
            )
            data[ATTR_TARGET_TEMP_LOW] = show_temp(
                self.hass,
                self.target_temperature_low,
                self.temperature_unit,
                self.precision,
            )

        if self.hvac_action:
            data[ATTR_HVAC_ACTION] = self.hvac_action

        if supported_features & SUPPORT_PRESET_MODE:
            data[ATTR_PRESET_MODE] = self.preset_mode
            data[ATTR_PRESET_MODES] = self.preset_modes

        if supported_features & SUPPORT_AUX_HEAT:
            data[ATTR_AUX_HEAT] = STATE_ON if self.is_aux_heat else STATE_OFF

        return data
Esempio n. 15
0
    def state_attributes(self):
        """Return the state attributes."""
        data = {}
        if self.temperature is not None:
            data[ATTR_WEATHER_TEMPERATURE] = show_temp(self.hass,
                                                       self.temperature,
                                                       self.temperature_unit,
                                                       self.precision)

        if (humidity := self.humidity) is not None:
            data[ATTR_WEATHER_HUMIDITY] = round(humidity)
Esempio n. 16
0
    def capability_attributes(self):
        """Return capability attributes."""
        supported_features = self.supported_features or 0

        data = {
            ATTR_MIN_TEMP:
            show_temp(self.hass, self.min_temp, self.temperature_unit,
                      self.precision),
            ATTR_MAX_TEMP:
            show_temp(self.hass, self.max_temp, self.temperature_unit,
                      self.precision),
        }

        if supported_features & SUPPORT_OPERATION_MODE:
            data[ATTR_OPERATION_LIST] = self.operation_list

        if supported_features & SUPPORT_AWAY_MODE:
            is_away = self.is_away_mode_on
            data[ATTR_AWAY_MODE] = STATE_ON if is_away else STATE_OFF

        return data
Esempio n. 17
0
    def device_state_attributes(self):
        """Return the optional device state attributes."""
        data = {}
        target_temp_high = self.target_temperature_high
        target_temp_low = self.target_temperature_low
        if target_temp_high is not None:
            data[ATTR_TARGET_TEMP_HIGH] = show_temp(
                self.hass, self.target_temperature_high, self.temperature_unit,
                PRECISION_TENTHS)
        if target_temp_low is not None:
            data[ATTR_TARGET_TEMP_LOW] = show_temp(self.hass,
                                                   self.target_temperature_low,
                                                   self.temperature_unit,
                                                   PRECISION_TENTHS)

        if self.external_temperature is not None:
            data[ATTR_EXTERNAL_TEMPERATURE] = show_temp(
                self.hass, self.external_temperature, self.temperature_unit,
                PRECISION_TENTHS)

        if self.smart_temperature:
            data[ATTR_SMART_TEMPERATURE] = self.smart_temperature

        if self.occupied is not None:
            data[ATTR_OCCUPIED] = self.occupied

        if self.eco_target is not None:
            data[ATTR_ECO_TARGET] = self.eco_target

        if self.heat_on is not None:
            data[ATTR_HEAT_ON] = self.heat_on

        if self.cool_on is not None:
            data[ATTR_COOL_ON] = self.cool_on

        current_humidity = self.current_humidity
        if current_humidity is not None:
            data[ATTR_CURRENT_HUMIDITY] = current_humidity

        return data
Esempio n. 18
0
    def state_attributes(self) -> Dict[str, Any]:
        """Return the optional state attributes."""
        supported_features = self.supported_features
        data = {
            ATTR_HVAC_MODES:
            self.hvac_modes,
            ATTR_CURRENT_TEMPERATURE:
            show_temp(self.hass, self.current_temperature,
                      self.temperature_unit, self.precision),
            ATTR_MIN_TEMP:
            show_temp(self.hass, self.min_temp, self.temperature_unit,
                      self.precision),
            ATTR_MAX_TEMP:
            show_temp(self.hass, self.max_temp, self.temperature_unit,
                      self.precision),
            ATTR_TEMPERATURE:
            show_temp(self.hass, self.target_temperature,
                      self.temperature_unit, self.precision),
        }

        if self.target_temperature_step:
            data[ATTR_TARGET_TEMP_STEP] = self.target_temperature_step

        if supported_features & SUPPORT_TARGET_TEMPERATURE_RANGE:
            data[ATTR_TARGET_TEMP_HIGH] = show_temp(
                self.hass, self.target_temperature_high, self.temperature_unit,
                self.precision)
            data[ATTR_TARGET_TEMP_LOW] = show_temp(self.hass,
                                                   self.target_temperature_low,
                                                   self.temperature_unit,
                                                   self.precision)

        if self.current_humidity is not None:
            data[ATTR_CURRENT_HUMIDITY] = self.current_humidity

        if supported_features & SUPPORT_TARGET_HUMIDITY:
            data[ATTR_HUMIDITY] = self.target_humidity
            data[ATTR_MIN_HUMIDITY] = self.min_humidity
            data[ATTR_MAX_HUMIDITY] = self.max_humidity

        if supported_features & SUPPORT_FAN_MODE:
            data[ATTR_FAN_MODE] = self.fan_mode
            data[ATTR_FAN_MODES] = self.fan_modes

        if self.hvac_action:
            data[ATTR_HVAC_ACTIONS] = self.hvac_action

        if supported_features & SUPPORT_PRESET_MODE:
            data[ATTR_PRESET_MODE] = self.preset_mode
            data[ATTR_PRESET_MODES] = self.preset_modes

        if supported_features & SUPPORT_SWING_MODE:
            data[ATTR_SWING_MODE] = self.swing_mode
            data[ATTR_SWING_MODES] = self.swing_modes

        if supported_features & SUPPORT_AUX_HEAT:
            data[ATTR_AUX_HEAT] = STATE_ON if self.is_aux_heat else STATE_OFF

        return data
Esempio n. 19
0
    def state_attributes(self):
        """Return the state attributes, converted from native units to user-configured units."""
        data = {}
        if self.temperature is not None:
            data[ATTR_WEATHER_TEMPERATURE] = show_temp(
                self.hass,
                self.temperature,
                self.temperature_unit,
                self.precision,
            )

        if (humidity := self.humidity) is not None:
            data[ATTR_WEATHER_HUMIDITY] = round(humidity)
Esempio n. 20
0
    def state_attributes(self) -> Dict[str, Any]:
        """Return the optional state attributes."""

        data = super().state_attributes

        if self._active_target_temp is not None:
            data[ATTR_ACTIVE_TARGET_TEMP] = show_temp(
                self.hass,
                self._active_target_temp,
                self.temperature_unit,
                self.precision,
            )

        return data
Esempio n. 21
0
    def state_attributes(self):
        """Return the optional state attributes."""
        data = {
            ATTR_CURRENT_TEMPERATURE:
            show_temp(
                self.hass,
                self.current_temperature,
                self.temperature_unit,
                self.precision,
            ),
            ATTR_TEMPERATURE:
            show_temp(
                self.hass,
                self.target_temperature,
                self.temperature_unit,
                self.precision,
            ),
            "Heat Power":
            self.spa.heat_power,
            "Power":
            self.spa.power,
            "Bubbles Power":
            self.spa.wave_power,
            "Filter Power":
            self.spa.filter_power,
        }

        supported_features = self.supported_features

        if supported_features & SUPPORT_OPERATION_MODE:
            data[ATTR_OPERATION_MODE] = self.current_operation

        if supported_features & SUPPORT_AWAY_MODE:
            is_away = self.is_away_mode_on
            data[ATTR_AWAY_MODE] = STATE_ON if is_away else STATE_OFF

        return data
Esempio n. 22
0
    def state_attributes(self):
        """Return the state attributes."""
        data = {}
        if self.temperature is not None:
            data[ATTR_TEMPERATURE] = show_temp(self.hass, self.temperature,
                                               self.temperature_unit,
                                               self.precision)

        pressure = self.pressure
        if pressure is not None:
            data[ATTR_PRESSURE] = pressure

        attribution = self.attribution
        if attribution is not None:
            data[ATTR_ATTRIBUTION] = attribution

        return data
Esempio n. 23
0
    def device_state_attributes(self):
        """Return the optional device state attributes."""
        data = {}
        if self.external_temperature is not None:
            data[ATTR_EXTERNAL_TEMPERATURE] = show_temp(
                self.hass, self.external_temperature, self.temperature_unit,
                PRECISION_TENTHS)

        if self.smart_temperature:
            data[ATTR_SMART_TEMPERATURE] = self.smart_temperature

        if self.occupied is not None:
            data[ATTR_OCCUPIED] = self.occupied

        if self.eco_target is not None:
            data[ATTR_ECO_TARGET] = self.eco_target

        return data
Esempio n. 24
0
    def state_attributes(self):
        """Return the optional state attributes."""
        data = {
            ATTR_CURRENT_TEMPERATURE: show_temp(
                self.hass, self.current_temperature, self.temperature_unit,
                self.precision),
            ATTR_MIN_TEMP: show_temp(
                self.hass, self.min_temp, self.temperature_unit,
                self.precision),
            ATTR_MAX_TEMP: show_temp(
                self.hass, self.max_temp, self.temperature_unit,
                self.precision),
            ATTR_TEMPERATURE: show_temp(
                self.hass, self.target_temperature, self.temperature_unit,
                self.precision),
        }

        supported_features = self.supported_features
        if self.target_temperature_step is not None:
            data[ATTR_TARGET_TEMP_STEP] = self.target_temperature_step

        if supported_features & SUPPORT_TARGET_TEMPERATURE_HIGH:
            data[ATTR_TARGET_TEMP_HIGH] = show_temp(
                self.hass, self.target_temperature_high, self.temperature_unit,
                self.precision)

        if supported_features & SUPPORT_TARGET_TEMPERATURE_LOW:
            data[ATTR_TARGET_TEMP_LOW] = show_temp(
                self.hass, self.target_temperature_low, self.temperature_unit,
                self.precision)

        if self.current_humidity is not None:
            data[ATTR_CURRENT_HUMIDITY] = self.current_humidity

        if supported_features & SUPPORT_TARGET_HUMIDITY:
            data[ATTR_HUMIDITY] = self.target_humidity

            if supported_features & SUPPORT_TARGET_HUMIDITY_LOW:
                data[ATTR_MIN_HUMIDITY] = self.min_humidity

            if supported_features & SUPPORT_TARGET_HUMIDITY_HIGH:
                data[ATTR_MAX_HUMIDITY] = self.max_humidity

        if supported_features & SUPPORT_FAN_MODE:
            data[ATTR_FAN_MODE] = self.current_fan_mode
            if self.fan_list:
                data[ATTR_FAN_LIST] = self.fan_list

        if supported_features & SUPPORT_OPERATION_MODE:
            data[ATTR_OPERATION_MODE] = self.current_operation
            if self.operation_list:
                data[ATTR_OPERATION_LIST] = self.operation_list

        if supported_features & SUPPORT_HOLD_MODE:
            data[ATTR_HOLD_MODE] = self.current_hold_mode

        if supported_features & SUPPORT_SWING_MODE:
            data[ATTR_SWING_MODE] = self.current_swing_mode
            if self.swing_list:
                data[ATTR_SWING_LIST] = self.swing_list

        if supported_features & SUPPORT_AWAY_MODE:
            is_away = self.is_away_mode_on
            data[ATTR_AWAY_MODE] = STATE_ON if is_away else STATE_OFF

        if supported_features & SUPPORT_AUX_HEAT:
            is_aux_heat = self.is_aux_heat_on
            data[ATTR_AUX_HEAT] = STATE_ON if is_aux_heat else STATE_OFF

        return data
Esempio n. 25
0
    def state_attributes(self):
        """Return the optional state attributes."""
        data = {}

        supported_features = self.supported_features

        # Operational mode will be off or schedule
        if supported_features & SUPPORT_OPERATION_MODE:
            data[ATTR_OPERATION_MODE] = self.current_operation

        # This is, is the away mode feature turned on/off
        if supported_features & SUPPORT_AWAY_MODE:
            is_away = self.is_away_mode_on
            data[ATTR_AWAY_MODE] = STATE_ON if is_away else STATE_OFF

        # away_mode_active - true if away mode is active.
        # If away mode is on, and no one has been seen for 48hrs away mode
        # should go active
        if supported_features & SUPPORT_AWAY_MODE:
            if self.device.device_data[
                    self.device_id]['hot_water_away_active']:
                away_active = self.device.device_data[
                    self.device_id]['hot_water_away_active']
                data[ATTR_AWAY_MODE_ACTIVE] = away_active
            else:
                data[ATTR_AWAY_MODE_ACTIVE] = False

        if supported_features & SUPPORT_BOOST_MODE:
            # boost_mode - true if boost mode is currently active.
            # boost_mode will be 0 if off, and non-zero otherwise - it is set to
            # the epoch time when the boost is due to end
            if self.device.device_data[
                    self.device_id]['hot_water_boost_setting']:
                boost_mode = self.device.device_data[
                    self.device_id]['hot_water_boost_setting']
                data[ATTR_BOOST_MODE_STATUS] = bool(boost_mode)
            else:
                data[ATTR_BOOST_MODE_STATUS] = False

        # heating_active - true if hot water is currently being heated.
        # So it is either on via schedule or boost and currently firing
        # (demand on) the boiler
        if self.device.device_data[self.device_id]['hot_water_status']:
            if self.device.device_data[
                    self.device_id]['hot_water_actively_heating']:
                boiler_firing = self.device.device_data[
                    self.device_id]['hot_water_actively_heating']
                data[ATTR_HEATING_ACTIVE] = boiler_firing
            else:
                data[ATTR_HEATING_ACTIVE] = False
        else:
            data[ATTR_HEATING_ACTIVE] = False

        if supported_features & SUPPORT_TARGET_TEMPERATURE:
            # Set target temperature
            data[ATTR_TEMPERATURE] = show_temp(
                self.hass, self.device.device_data[
                    self.device_id]['hot_water_temperature'],
                self.temperature_unit, self.precision)

            # Set current target temperature
            data[ATTR_CURRENT_TEMPERATURE] = show_temp(
                self.hass, self.device.device_data[
                    self.device_id]['current_water_temperature'],
                self.temperature_unit, self.precision)

        _LOGGER.debug("Device state attributes: {}".format(data))
        return data
Esempio n. 26
0
    def state_attributes(self):
        """Return the state attributes."""
        data = {}

        if self.temperature is not None:
            data[ATTR_WEATHER_TEMPERATURE] = show_temp(self.hass,
                                                       self.temperature,
                                                       self.temperature_unit,
                                                       self.precision)

        humidity = self.humidity
        if humidity is not None:
            data[ATTR_WEATHER_HUMIDITY] = round(humidity)

        ozone = self.ozone
        if ozone is not None:
            data[ATTR_WEATHER_OZONE] = ozone

        pressure = self.pressure
        if pressure is not None:
            data[ATTR_WEATHER_PRESSURE] = pressure

        wind_bearing = self.wind_bearing
        if wind_bearing is not None:
            data[ATTR_WEATHER_WIND_BEARING] = wind_bearing

        wind_speed = self.wind_speed
        if wind_speed is not None:
            data[ATTR_WEATHER_WIND_SPEED] = wind_speed

        visibility = self.visibility
        if visibility is not None:
            data[ATTR_WEATHER_VISIBILITY] = visibility

        attribution = self.attribution
        if attribution is not None:
            data[ATTR_WEATHER_ATTRIBUTION] = attribution

        if self.forecast is not None:
            forecast = []
            for forecast_entry in self.forecast:
                forecast_entry = dict(forecast_entry)
                forecast_entry[ATTR_FORECAST_TEMP] = show_temp(
                    self.hass,
                    forecast_entry[ATTR_FORECAST_TEMP],
                    self.temperature_unit,
                    self.precision,
                )
                if ATTR_FORECAST_TEMP_LOW in forecast_entry:
                    forecast_entry[ATTR_FORECAST_TEMP_LOW] = show_temp(
                        self.hass,
                        forecast_entry[ATTR_FORECAST_TEMP_LOW],
                        self.temperature_unit,
                        self.precision,
                    )
                forecast.append(forecast_entry)

            data[ATTR_FORECAST] = forecast

        #add our own custom shit
        data["forecast_temp_high"] = self._weatherData[
            "Forecast.Today.TempHigh"]
        data["forecast_temp_low"] = self._weatherData[
            "Forecast.Tonight.TempLow"]
        data["report"] = self._weatherData["Report"]

        return data
Esempio n. 27
0
            data[ATTR_WEATHER_WIND_SPEED] = wind_speed

        if (visibility := self.visibility) is not None:
            if (unit := self.visibility_unit) is not None:
                visibility = round(
                    self.hass.config.units.length(visibility, unit), ROUNDING_PRECISION
                )
            data[ATTR_WEATHER_VISIBILITY] = visibility

        if self.forecast is not None:
            forecast = []
            for forecast_entry in self.forecast:
                forecast_entry = dict(forecast_entry)
                forecast_entry[ATTR_FORECAST_TEMP] = show_temp(
                    self.hass,
                    forecast_entry[ATTR_FORECAST_TEMP],
                    self.temperature_unit,
                    self.precision,
                )
                if ATTR_FORECAST_TEMP_LOW in forecast_entry:
                    forecast_entry[ATTR_FORECAST_TEMP_LOW] = show_temp(
                        self.hass,
                        forecast_entry[ATTR_FORECAST_TEMP_LOW],
                        self.temperature_unit,
                        self.precision,
                    )
                if (
                    native_pressure := forecast_entry.get(ATTR_FORECAST_PRESSURE)
                ) is not None:
                    if (unit := self.pressure_unit) is not None:
                        pressure = round(
                            self.hass.config.units.pressure(native_pressure, unit),
Esempio n. 28
0
    def state_attributes(self):
        """Return the optional state attributes."""
        data = {
            ATTR_CURRENT_TEMPERATURE: show_temp(
                self.hass, self.current_temperature, self.temperature_unit,
                self.precision),
            ATTR_MIN_TEMP: show_temp(
                self.hass, self.min_temp, self.temperature_unit,
                self.precision),
            ATTR_MAX_TEMP: show_temp(
                self.hass, self.max_temp, self.temperature_unit,
                self.precision),
            ATTR_TEMPERATURE: show_temp(
                self.hass, self.target_temperature, self.temperature_unit,
                self.precision),
        }

        if self.target_temperature_step is not None:
            data[ATTR_TARGET_TEMP_STEP] = self.target_temperature_step

        target_temp_high = self.target_temperature_high
        if target_temp_high is not None:
            data[ATTR_TARGET_TEMP_HIGH] = show_temp(
                self.hass, self.target_temperature_high, self.temperature_unit,
                self.precision)
            data[ATTR_TARGET_TEMP_LOW] = show_temp(
                self.hass, self.target_temperature_low, self.temperature_unit,
                self.precision)

        humidity = self.target_humidity
        if humidity is not None:
            data[ATTR_HUMIDITY] = humidity
            data[ATTR_CURRENT_HUMIDITY] = self.current_humidity
            data[ATTR_MIN_HUMIDITY] = self.min_humidity
            data[ATTR_MAX_HUMIDITY] = self.max_humidity

        fan_mode = self.current_fan_mode
        if fan_mode is not None:
            data[ATTR_FAN_MODE] = fan_mode
            if self.fan_list:
                data[ATTR_FAN_LIST] = self.fan_list

        operation_mode = self.current_operation
        if operation_mode is not None:
            data[ATTR_OPERATION_MODE] = operation_mode
            if self.operation_list:
                data[ATTR_OPERATION_LIST] = self.operation_list

        is_hold = self.current_hold_mode
        if is_hold is not None:
            data[ATTR_HOLD_MODE] = is_hold

        swing_mode = self.current_swing_mode
        if swing_mode is not None:
            data[ATTR_SWING_MODE] = swing_mode
            if self.swing_list:
                data[ATTR_SWING_LIST] = self.swing_list

        is_away = self.is_away_mode_on
        if is_away is not None:
            data[ATTR_AWAY_MODE] = STATE_ON if is_away else STATE_OFF

        is_aux_heat = self.is_aux_heat_on
        if is_aux_heat is not None:
            data[ATTR_AUX_HEAT] = STATE_ON if is_aux_heat else STATE_OFF

        return data
Esempio n. 29
0
    def state_attributes(self):
        """Return the optional state attributes."""
        data = {
            ATTR_CURRENT_TEMPERATURE:
            show_temp(self.hass, self.current_temperature,
                      self.temperature_unit, self.precision),
            ATTR_MIN_TEMP:
            show_temp(self.hass, self.min_temp, self.temperature_unit,
                      self.precision),
            ATTR_MAX_TEMP:
            show_temp(self.hass, self.max_temp, self.temperature_unit,
                      self.precision),
            ATTR_TEMPERATURE:
            show_temp(self.hass, self.target_temperature,
                      self.temperature_unit, self.precision),
        }

        supported_features = self.supported_features
        if self.target_temperature_step is not None:
            data[ATTR_TARGET_TEMP_STEP] = self.target_temperature_step

        if supported_features & SUPPORT_TARGET_TEMPERATURE_HIGH:
            data[ATTR_TARGET_TEMP_HIGH] = show_temp(
                self.hass, self.target_temperature_high, self.temperature_unit,
                self.precision)

        if supported_features & SUPPORT_TARGET_TEMPERATURE_LOW:
            data[ATTR_TARGET_TEMP_LOW] = show_temp(self.hass,
                                                   self.target_temperature_low,
                                                   self.temperature_unit,
                                                   self.precision)

        if self.current_humidity is not None:
            data[ATTR_CURRENT_HUMIDITY] = self.current_humidity

        if supported_features & SUPPORT_TARGET_HUMIDITY:
            data[ATTR_HUMIDITY] = self.target_humidity

            if supported_features & SUPPORT_TARGET_HUMIDITY_LOW:
                data[ATTR_MIN_HUMIDITY] = self.min_humidity

            if supported_features & SUPPORT_TARGET_HUMIDITY_HIGH:
                data[ATTR_MAX_HUMIDITY] = self.max_humidity

        if supported_features & SUPPORT_FAN_MODE:
            data[ATTR_FAN_MODE] = self.current_fan_mode
            if self.fan_list:
                data[ATTR_FAN_LIST] = self.fan_list

        if supported_features & SUPPORT_OPERATION_MODE:
            data[ATTR_OPERATION_MODE] = self.current_operation
            if self.operation_list:
                data[ATTR_OPERATION_LIST] = self.operation_list

        if supported_features & SUPPORT_HOLD_MODE:
            data[ATTR_HOLD_MODE] = self.current_hold_mode

        if supported_features & SUPPORT_SWING_MODE:
            data[ATTR_SWING_MODE] = self.current_swing_mode
            if self.swing_list:
                data[ATTR_SWING_LIST] = self.swing_list

        if supported_features & SUPPORT_AWAY_MODE:
            is_away = self.is_away_mode_on
            data[ATTR_AWAY_MODE] = STATE_ON if is_away else STATE_OFF

        if supported_features & SUPPORT_AUX_HEAT:
            is_aux_heat = self.is_aux_heat_on
            data[ATTR_AUX_HEAT] = STATE_ON if is_aux_heat else STATE_OFF

        return data
Esempio n. 30
0
    def state_attributes(self):
        """Return the optional state attributes."""
        data = {
            ATTR_CURRENT_TEMPERATURE: show_temp(
                self.hass, self.current_temperature, self.temperature_unit,
                self.precision),
            ATTR_MIN_TEMP: show_temp(
                self.hass, self.min_temp, self.temperature_unit,
                self.precision),
            ATTR_MAX_TEMP: show_temp(
                self.hass, self.max_temp, self.temperature_unit,
                self.precision),
            ATTR_TEMPERATURE: show_temp(
                self.hass, self.target_temperature, self.temperature_unit,
                self.precision),
        }

        if self.target_temperature_step is not None:
            data[ATTR_TARGET_TEMP_STEP] = self.target_temperature_step

        target_temp_high = self.target_temperature_high
        if target_temp_high is not None:
            data[ATTR_TARGET_TEMP_HIGH] = show_temp(
                self.hass, self.target_temperature_high, self.temperature_unit,
                self.precision)
            data[ATTR_TARGET_TEMP_LOW] = show_temp(
                self.hass, self.target_temperature_low, self.temperature_unit,
                self.precision)

        humidity = self.target_humidity
        if humidity is not None:
            data[ATTR_HUMIDITY] = humidity
            data[ATTR_CURRENT_HUMIDITY] = self.current_humidity
            data[ATTR_MIN_HUMIDITY] = self.min_humidity
            data[ATTR_MAX_HUMIDITY] = self.max_humidity

        fan_mode = self.current_fan_mode
        if fan_mode is not None:
            data[ATTR_FAN_MODE] = fan_mode
            if self.fan_list:
                data[ATTR_FAN_LIST] = self.fan_list

        operation_mode = self.current_operation
        if operation_mode is not None:
            data[ATTR_OPERATION_MODE] = operation_mode
            if self.operation_list:
                data[ATTR_OPERATION_LIST] = self.operation_list

        is_hold = self.current_hold_mode
        if is_hold is not None:
            data[ATTR_HOLD_MODE] = is_hold

        swing_mode = self.current_swing_mode
        if swing_mode is not None:
            data[ATTR_SWING_MODE] = swing_mode
            if self.swing_list:
                data[ATTR_SWING_LIST] = self.swing_list

        is_away = self.is_away_mode_on
        if is_away is not None:
            data[ATTR_AWAY_MODE] = STATE_ON if is_away else STATE_OFF

        is_aux_heat = self.is_aux_heat_on
        if is_aux_heat is not None:
            data[ATTR_AUX_HEAT] = STATE_ON if is_aux_heat else STATE_OFF

        return data
Esempio n. 31
0
    def state_attributes(self):
        """Return the state attributes."""
        data = {
            ATTR_WEATHER_TEMPERATURE:
            show_temp(self.hass, self.temperature, self.temperature_unit,
                      self.precision),
        }

        humidity = self.humidity
        if humidity is not None:
            data[ATTR_WEATHER_HUMIDITY] = round(humidity)

        dewpoint = self.dewpoint
        if dewpoint is not None:
            data[ATTR_WEATHER_DEWPOINT] = dewpoint

        feels_like = self.feels_like
        if feels_like is not None:
            data[ATTR_WEATHER_FEELS_LIKE] = feels_like

        ozone = self.ozone
        if ozone is not None:
            data[ATTR_WEATHER_OZONE] = ozone

        precipitation = self.precipitation
        if precipitation is not None:
            data[ATTR_WEATHER_PRECIPITATION] = precipitation

        precipitation_rate = self.precipitation_rate
        if precipitation_rate is not None:
            data[ATTR_WEATHER_PRECIPITATION_RATE] = precipitation_rate

        pressure = self.pressure
        if pressure is not None:
            data[ATTR_WEATHER_PRESSURE] = pressure

        wind_bearing = self.wind_bearing
        if wind_bearing is not None:
            data[ATTR_WEATHER_WIND_BEARING] = wind_bearing

        wind_speed = self.wind_speed
        if wind_speed is not None:
            data[ATTR_WEATHER_WIND_SPEED] = wind_speed

        wind_gust = self.wind_gust
        if wind_gust is not None:
            data[ATTR_WEATHER_WIND_GUST] = wind_gust

        wind_lull = self.wind_lull
        if wind_lull is not None:
            data[ATTR_WEATHER_WIND_LULL] = wind_lull

        visibility = self.visibility
        if visibility is not None:
            data[ATTR_WEATHER_VISIBILITY] = visibility

        attribution = self.attribution
        if attribution is not None:
            data[ATTR_WEATHER_ATTRIBUTION] = attribution

        if self.forecast is not None:
            forecast = []
            for forecast_entry in self.forecast:
                forecast_entry = dict(forecast_entry)
                forecast_entry[ATTR_FORECAST_TEMP] = show_temp(
                    self.hass, forecast_entry[ATTR_FORECAST_TEMP],
                    self.temperature_unit, self.precision)
                if ATTR_FORECAST_TEMP_LOW in forecast_entry:
                    forecast_entry[ATTR_FORECAST_TEMP_LOW] = show_temp(
                        self.hass, forecast_entry[ATTR_FORECAST_TEMP_LOW],
                        self.temperature_unit, self.precision)
                forecast.append(forecast_entry)

            data[ATTR_FORECAST] = forecast

        return data