Skip to content

Commit

Permalink
Merge branch 'main' into update_release_drafter
Browse files Browse the repository at this point in the history
  • Loading branch information
woopstar authored Oct 15, 2024
2 parents 242be57 + a087c2c commit b7d9e2d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@
from homeassistant.helpers.event import async_track_state_change_event
from homeassistant.helpers.restore_state import RestoreEntity

from ..const import DEFAULT_EMA_DESIRED_TIME_TO_95, DOMAIN, ICON, NAME
from ..entity import SmoothingAnalyticsEntity
from ..const import (
DEFAULT_EMA_DESIRED_TIME_TO_95,
DOMAIN,
ICON
)


_LOGGER = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
from homeassistant.helpers.event import async_track_state_change_event
from homeassistant.helpers.restore_state import RestoreEntity

from ..const import DEFAULT_LOW_PASS, DOMAIN, ICON, NAME
from ..entity import SmoothingAnalyticsEntity
from ..const import (
DEFAULT_LOW_PASS,
ICON
)

_LOGGER = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
from homeassistant.helpers.event import async_track_state_change_event
from homeassistant.helpers.restore_state import RestoreEntity

from ..const import DEFAULT_MEDIAN_SIZE, DOMAIN, ICON, NAME
from ..entity import SmoothingAnalyticsEntity
from ..const import (
DEFAULT_MEDIAN_SIZE,
DOMAIN,
ICON
)

_LOGGER = logging.getLogger(__name__)

Expand Down
7 changes: 5 additions & 2 deletions custom_components/smoothing_analytics_sensors/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,19 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
median_unique_id = f"sas_lowpass_{sensor_hash}"
ema_unique_id = f"sas_median_{sensor_hash}"

# Create the lowpass, median, and ema sensors using the unique IDs
# Create the lowpass from the input sensor
lowpass_sensor = LowpassSensor(
input_sensor, lowpass_time_constant, sensor_hash, config_entry
)

# Create the median, and ema sensors using the unique IDs
median_sensor = MedianSensor(
median_unique_id, median_sampling_size, sensor_hash, config_entry
)

ema_sensor = EmaSensor(ema_unique_id, desired_time_to_95, sensor_hash, config_entry)
ema_sensor = EmaSensor(
ema_unique_id, desired_time_to_95, sensor_hash, config_entry
)

# Add sensors to Home Assistant
async_add_entities([lowpass_sensor, median_sensor, ema_sensor])
Expand Down

0 comments on commit b7d9e2d

Please sign in to comment.