diff --git a/homeassistant/components/simulated/__init__.py b/homeassistant/components/simulated/__init__.py deleted file mode 100644 index 35c6d106d037d3..00000000000000 --- a/homeassistant/components/simulated/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""The simulated component.""" diff --git a/homeassistant/components/simulated/manifest.json b/homeassistant/components/simulated/manifest.json deleted file mode 100644 index e76bf14208676f..00000000000000 --- a/homeassistant/components/simulated/manifest.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "domain": "simulated", - "name": "Simulated", - "codeowners": [], - "documentation": "https://www.home-assistant.io/integrations/simulated", - "iot_class": "local_polling", - "quality_scale": "internal" -} diff --git a/homeassistant/components/simulated/sensor.py b/homeassistant/components/simulated/sensor.py deleted file mode 100644 index 22ce4bd7cea78a..00000000000000 --- a/homeassistant/components/simulated/sensor.py +++ /dev/null @@ -1,175 +0,0 @@ -"""Adds a simulated sensor.""" - -from __future__ import annotations - -from datetime import datetime -import math -from random import Random - -import voluptuous as vol - -from homeassistant.components.sensor import ( - PLATFORM_SCHEMA as SENSOR_PLATFORM_SCHEMA, - SensorEntity, -) -from homeassistant.const import CONF_NAME -from homeassistant.core import HomeAssistant -from homeassistant.helpers import issue_registry as ir -import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType -import homeassistant.util.dt as dt_util - -CONF_AMP = "amplitude" -CONF_FWHM = "spread" -CONF_MEAN = "mean" -CONF_PERIOD = "period" -CONF_PHASE = "phase" -CONF_SEED = "seed" -CONF_UNIT = "unit" -CONF_RELATIVE_TO_EPOCH = "relative_to_epoch" - -DEFAULT_AMP = 1 -DEFAULT_FWHM = 0 -DEFAULT_MEAN = 0 -DEFAULT_NAME = "simulated" -DEFAULT_PERIOD = 60 -DEFAULT_PHASE = 0 -DEFAULT_SEED = 999 -DEFAULT_UNIT = "value" -DEFAULT_RELATIVE_TO_EPOCH = True - -DOMAIN = "simulated" - -PLATFORM_SCHEMA = SENSOR_PLATFORM_SCHEMA.extend( - { - vol.Optional(CONF_AMP, default=DEFAULT_AMP): vol.Coerce(float), - vol.Optional(CONF_FWHM, default=DEFAULT_FWHM): vol.Coerce(float), - vol.Optional(CONF_MEAN, default=DEFAULT_MEAN): vol.Coerce(float), - vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, - vol.Optional(CONF_PERIOD, default=DEFAULT_PERIOD): cv.positive_int, - vol.Optional(CONF_PHASE, default=DEFAULT_PHASE): vol.Coerce(float), - vol.Optional(CONF_SEED, default=DEFAULT_SEED): cv.positive_int, - vol.Optional(CONF_UNIT, default=DEFAULT_UNIT): cv.string, - vol.Optional( - CONF_RELATIVE_TO_EPOCH, default=DEFAULT_RELATIVE_TO_EPOCH - ): cv.boolean, - } -) - - -async def async_setup_platform( - hass: HomeAssistant, - config: ConfigType, - async_add_entities: AddEntitiesCallback, - discovery_info: DiscoveryInfoType | None = None, -) -> None: - """Set up the simulated sensor.""" - # Simulated has been deprecated and will be removed in 2025.1 - - ir.async_create_issue( - hass, - DOMAIN, - DOMAIN, - breaks_in_ha_version="2025.1.0", - is_fixable=False, - severity=ir.IssueSeverity.WARNING, - translation_key="simulated_deprecation", - translation_placeholders={"integration": DOMAIN}, - learn_more_url="https://www.home-assistant.io/integrations/simulated", - ) - - name = config.get(CONF_NAME) - unit = config.get(CONF_UNIT) - amp = config.get(CONF_AMP) - mean = config.get(CONF_MEAN) - period = config.get(CONF_PERIOD) - phase = config.get(CONF_PHASE) - fwhm = config.get(CONF_FWHM) - seed = config.get(CONF_SEED) - relative_to_epoch = config.get(CONF_RELATIVE_TO_EPOCH) - - sensor = SimulatedSensor( - name, unit, amp, mean, period, phase, fwhm, seed, relative_to_epoch - ) - async_add_entities([sensor], True) - - -class SimulatedSensor(SensorEntity): - """Class for simulated sensor.""" - - _attr_icon = "mdi:chart-line" - - def __init__( - self, name, unit, amp, mean, period, phase, fwhm, seed, relative_to_epoch - ): - """Init the class.""" - self._name = name - self._unit = unit - self._amp = amp - self._mean = mean - self._period = period - self._phase = phase # phase in degrees - self._fwhm = fwhm - self._seed = seed - self._random = Random(seed) # A local seeded Random - self._start_time = ( - datetime(1970, 1, 1, tzinfo=dt_util.UTC) - if relative_to_epoch - else dt_util.utcnow() - ) - self._relative_to_epoch = relative_to_epoch - self._state = None - - def time_delta(self): - """Return the time delta.""" - dt0 = self._start_time - dt1 = dt_util.utcnow() - return dt1 - dt0 - - def signal_calc(self): - """Calculate the signal.""" - mean = self._mean - amp = self._amp - time_delta = self.time_delta().total_seconds() * 1e6 # to milliseconds - period = self._period * 1e6 # to milliseconds - fwhm = self._fwhm / 2 - phase = math.radians(self._phase) - if period == 0: - periodic = 0 - else: - periodic = amp * (math.sin((2 * math.pi * time_delta / period) + phase)) - noise = self._random.gauss(mu=0, sigma=fwhm) - return round(mean + periodic + noise, 3) - - async def async_update(self) -> None: - """Update the sensor.""" - self._state = self.signal_calc() - - @property - def name(self): - """Return the name of the sensor.""" - return self._name - - @property - def native_value(self): - """Return the state of the sensor.""" - return self._state - - @property - def native_unit_of_measurement(self): - """Return the unit this state is expressed in.""" - return self._unit - - @property - def extra_state_attributes(self): - """Return other details about the sensor state.""" - return { - "amplitude": self._amp, - "mean": self._mean, - "period": self._period, - "phase": self._phase, - "spread": self._fwhm, - "seed": self._seed, - "relative_to_epoch": self._relative_to_epoch, - } diff --git a/homeassistant/components/simulated/strings.json b/homeassistant/components/simulated/strings.json deleted file mode 100644 index d25a84f48a54f4..00000000000000 --- a/homeassistant/components/simulated/strings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "issues": { - "simulated_deprecation": { - "description": "The {integration} integration is deprecated", - "title": "The {integration} integration has been deprecated and will be removed in 2025.1. Please remove the {integration} from your configuration.yaml settings and restart Home Assistant to fix this issue." - } - } -} diff --git a/homeassistant/generated/integrations.json b/homeassistant/generated/integrations.json index c87218cb1b16a0..9494ab2e201b11 100644 --- a/homeassistant/generated/integrations.json +++ b/homeassistant/generated/integrations.json @@ -5599,12 +5599,6 @@ "integration_type": "virtual", "supported_by": "overkiz" }, - "simulated": { - "name": "Simulated", - "integration_type": "hub", - "config_flow": false, - "iot_class": "local_polling" - }, "sinch": { "name": "Sinch SMS", "integration_type": "hub", diff --git a/tests/components/simulated/__init__.py b/tests/components/simulated/__init__.py deleted file mode 100644 index 501fbab603aefb..00000000000000 --- a/tests/components/simulated/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Tests for the simulated component.""" diff --git a/tests/components/simulated/test_sensor.py b/tests/components/simulated/test_sensor.py deleted file mode 100644 index b167147367ae26..00000000000000 --- a/tests/components/simulated/test_sensor.py +++ /dev/null @@ -1,50 +0,0 @@ -"""The tests for the simulated sensor.""" - -from homeassistant.components.simulated.sensor import ( - CONF_AMP, - CONF_FWHM, - CONF_MEAN, - CONF_PERIOD, - CONF_PHASE, - CONF_RELATIVE_TO_EPOCH, - CONF_SEED, - CONF_UNIT, - DEFAULT_AMP, - DEFAULT_FWHM, - DEFAULT_MEAN, - DEFAULT_NAME, - DEFAULT_PHASE, - DEFAULT_RELATIVE_TO_EPOCH, - DEFAULT_SEED, - DOMAIN, -) -from homeassistant.const import CONF_FRIENDLY_NAME -from homeassistant.core import HomeAssistant -from homeassistant.helpers import issue_registry as ir -from homeassistant.setup import async_setup_component - - -async def test_simulated_sensor_default_config( - hass: HomeAssistant, issue_registry: ir.IssueRegistry -) -> None: - """Test default config.""" - config = {"sensor": {"platform": "simulated"}} - assert await async_setup_component(hass, "sensor", config) - await hass.async_block_till_done() - - assert len(hass.states.async_entity_ids()) == 1 - state = hass.states.get("sensor.simulated") - - assert state.attributes.get(CONF_FRIENDLY_NAME) == DEFAULT_NAME - assert state.attributes.get(CONF_AMP) == DEFAULT_AMP - assert state.attributes.get(CONF_UNIT) is None - assert state.attributes.get(CONF_MEAN) == DEFAULT_MEAN - assert state.attributes.get(CONF_PERIOD) == 60.0 - assert state.attributes.get(CONF_PHASE) == DEFAULT_PHASE - assert state.attributes.get(CONF_FWHM) == DEFAULT_FWHM - assert state.attributes.get(CONF_SEED) == DEFAULT_SEED - assert state.attributes.get(CONF_RELATIVE_TO_EPOCH) == DEFAULT_RELATIVE_TO_EPOCH - - issue = issue_registry.async_get_issue(DOMAIN, DOMAIN) - assert issue.issue_id == DOMAIN - assert issue.translation_key == "simulated_deprecation"