diff --git a/homeassistant/components/energyzero/sensor.py b/homeassistant/components/energyzero/sensor.py index 54cbb7c8195..75b5fa6fea6 100644 --- a/homeassistant/components/energyzero/sensor.py +++ b/homeassistant/components/energyzero/sensor.py @@ -44,7 +44,6 @@ SENSORS: tuple[EnergyZeroSensorEntityDescription, ...] = ( key="current_hour_price", name="Current hour", service_type="today_gas", - device_class=SensorDeviceClass.MONETARY, state_class=SensorStateClass.MEASUREMENT, native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfVolume.CUBIC_METERS}", value_fn=lambda data: data.gas_today.current_price if data.gas_today else None, @@ -53,7 +52,6 @@ SENSORS: tuple[EnergyZeroSensorEntityDescription, ...] = ( key="next_hour_price", name="Next hour", service_type="today_gas", - device_class=SensorDeviceClass.MONETARY, native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfVolume.CUBIC_METERS}", value_fn=lambda data: get_gas_price(data, 1), ), @@ -61,7 +59,6 @@ SENSORS: tuple[EnergyZeroSensorEntityDescription, ...] = ( key="current_hour_price", name="Current hour", service_type="today_energy", - device_class=SensorDeviceClass.MONETARY, state_class=SensorStateClass.MEASUREMENT, native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfEnergy.KILO_WATT_HOUR}", value_fn=lambda data: data.energy_today.current_price, @@ -70,7 +67,6 @@ SENSORS: tuple[EnergyZeroSensorEntityDescription, ...] = ( key="next_hour_price", name="Next hour", service_type="today_energy", - device_class=SensorDeviceClass.MONETARY, native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfEnergy.KILO_WATT_HOUR}", value_fn=lambda data: data.energy_today.price_at_time( data.energy_today.utcnow() + timedelta(hours=1) @@ -80,7 +76,6 @@ SENSORS: tuple[EnergyZeroSensorEntityDescription, ...] = ( key="average_price", name="Average - today", service_type="today_energy", - device_class=SensorDeviceClass.MONETARY, native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfEnergy.KILO_WATT_HOUR}", value_fn=lambda data: data.energy_today.average_price, ), @@ -88,7 +83,6 @@ SENSORS: tuple[EnergyZeroSensorEntityDescription, ...] = ( key="max_price", name="Highest price - today", service_type="today_energy", - device_class=SensorDeviceClass.MONETARY, native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfEnergy.KILO_WATT_HOUR}", value_fn=lambda data: data.energy_today.extreme_prices[1], ), @@ -96,7 +90,6 @@ SENSORS: tuple[EnergyZeroSensorEntityDescription, ...] = ( key="min_price", name="Lowest price - today", service_type="today_energy", - device_class=SensorDeviceClass.MONETARY, native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfEnergy.KILO_WATT_HOUR}", value_fn=lambda data: data.energy_today.extreme_prices[0], ), diff --git a/tests/components/energyzero/test_sensor.py b/tests/components/energyzero/test_sensor.py index f5ab1f5822b..ed9b87db73e 100644 --- a/tests/components/energyzero/test_sensor.py +++ b/tests/components/energyzero/test_sensor.py @@ -56,7 +56,7 @@ async def test_energy_today( == f"{CURRENCY_EURO}/{ENERGY_KILO_WATT_HOUR}" ) assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT - assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.MONETARY + assert ATTR_DEVICE_CLASS not in state.attributes assert ATTR_ICON not in state.attributes # Average price sensor @@ -74,7 +74,7 @@ async def test_energy_today( state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == f"{CURRENCY_EURO}/{ENERGY_KILO_WATT_HOUR}" ) - assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.MONETARY + assert ATTR_DEVICE_CLASS not in state.attributes assert ATTR_ICON not in state.attributes # Highest price sensor @@ -92,7 +92,7 @@ async def test_energy_today( state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == f"{CURRENCY_EURO}/{ENERGY_KILO_WATT_HOUR}" ) - assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.MONETARY + assert ATTR_DEVICE_CLASS not in state.attributes assert ATTR_ICON not in state.attributes # Highest price time sensor @@ -144,7 +144,7 @@ async def test_gas_today( == f"{CURRENCY_EURO}/{VOLUME_CUBIC_METERS}" ) assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT - assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.MONETARY + assert ATTR_DEVICE_CLASS not in state.attributes assert ATTR_ICON not in state.attributes assert entry.device_id