Skip to content

Commit

Permalink
Run formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Oct 1, 2024
1 parent a978735 commit 4227238
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 1 addition & 3 deletions custom_components/smoothing_analytics_sensors/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ async def async_step_init(self, user_input=None):
{
vol.Optional(
"device_name",
default=self.config_entry.options.get(
"device_name", NAME
),
default=self.config_entry.options.get("device_name", NAME),
): str,
vol.Optional(
"lowpass_time_constant",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def ema_filter(value, previous_value, alpha):
"""Apply Exponential Moving Average (EMA) filter using the given alpha"""
return alpha * value + (1 - alpha) * previous_value


class EmaSensor(SmoothingAnalyticsEntity, RestoreEntity):
"""Exponential Moving Average (EMA) filtered sensor with persistent state and device support, based on unique_id."""

Expand Down Expand Up @@ -95,7 +96,8 @@ def extra_state_attributes(self):
"input_entity_id": self._input_entity_id,
"input_unique_id": self._input_unique_id,
"last_updated": self._last_updated,
"number_of_updates_needed": self._desired_time_to_95 / self._update_interval,
"number_of_updates_needed": self._desired_time_to_95
/ self._update_interval,
"previous_value": self._previous_value,
"sensor_hash": self._sensor_hash,
"sensor_update_interval": self._update_interval,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

_LOGGER = logging.getLogger(__name__)


def lowpass_filter(current_value, previous_value, time_constant):
"""Apply a lowpass filter to smooth out fast fluctuations"""
B = 1.0 / time_constant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

_LOGGER = logging.getLogger(__name__)


class MedianSensor(SmoothingAnalyticsEntity, RestoreEntity):
"""Median filtered sensor with persistent state and device support, based on unique_id."""

Expand Down
4 changes: 1 addition & 3 deletions custom_components/smoothing_analytics_sensors/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ def device_info(self):

return {
"identifiers": {(DOMAIN, self.config_entry.entry_id)},
"name": self.config_entry.data.get(
"device_name", NAME
),
"name": self.config_entry.data.get("device_name", NAME),
"manufacturer": NAME,
}

0 comments on commit 4227238

Please sign in to comment.