From eaec5e357163338a01d3a625c8c9cd68c4711a5a Mon Sep 17 00:00:00 2001 From: Matthieu Bourgain Date: Wed, 22 Jun 2022 23:51:20 +0200 Subject: [PATCH] remove wrong old code --- CHANGELOG.md | 4 ++++ custom_components/ecodevices/manifest.json | 2 +- custom_components/ecodevices/sensor.py | 12 ++++++------ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0066992..20a3cbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 4.2.2 + +- Remove wrong old code + ## 4.2.1 - Fix incrementation diff --git a/custom_components/ecodevices/manifest.json b/custom_components/ecodevices/manifest.json index db2c229..4e96f2b 100644 --- a/custom_components/ecodevices/manifest.json +++ b/custom_components/ecodevices/manifest.json @@ -7,6 +7,6 @@ "config_flow": true, "requirements": ["xmltodict==0.12.0", "pyecodevices==1.4.0"], "dependencies": [], - "version": "4.2.1", + "version": "4.2.2", "iot_class": "local_polling" } diff --git a/custom_components/ecodevices/sensor.py b/custom_components/ecodevices/sensor.py index cc21faf..759649e 100644 --- a/custom_components/ecodevices/sensor.py +++ b/custom_components/ecodevices/sensor.py @@ -194,7 +194,8 @@ async def async_setup_entry(hass, config_entry, async_add_entities): input_name="c1", name=DEFAULT_C1_NAME, unit=options.get( - CONF_C1_UNIT_OF_MEASUREMENT, config.get(CONF_C1_UNIT_OF_MEASUREMENT) + CONF_C1_UNIT_OF_MEASUREMENT, config.get( + CONF_C1_UNIT_OF_MEASUREMENT) ), device_class=options.get( CONF_C1_DEVICE_CLASS, config.get(CONF_C1_DEVICE_CLASS) @@ -210,7 +211,8 @@ async def async_setup_entry(hass, config_entry, async_add_entities): input_name="c1_daily", name=DEFAULT_C1_NAME + " Daily", unit=options.get( - CONF_C1_UNIT_OF_MEASUREMENT, config.get(CONF_C1_UNIT_OF_MEASUREMENT) + CONF_C1_UNIT_OF_MEASUREMENT, config.get( + CONF_C1_UNIT_OF_MEASUREMENT) ), device_class=options.get( CONF_C1_DEVICE_CLASS, config.get(CONF_C1_DEVICE_CLASS) @@ -262,7 +264,8 @@ async def async_setup_entry(hass, config_entry, async_add_entities): input_name="c2_daily", name=DEFAULT_C2_NAME + " Daily", unit=options.get( - CONF_C2_UNIT_OF_MEASUREMENT, config.get(CONF_C2_UNIT_OF_MEASUREMENT) + CONF_C2_UNIT_OF_MEASUREMENT, config.get( + CONF_C2_UNIT_OF_MEASUREMENT) ), device_class=options.get( CONF_C2_DEVICE_CLASS, config.get(CONF_C2_DEVICE_CLASS) @@ -575,9 +578,6 @@ class C2TotalEdDevice(EdDevice): def native_value(self) -> float: """Return the total value if it's greater than 0.""" value = float(self.coordinator.data["count1"]) - old_state = await self.async_get_last_state() - if old_state is not None: - self._state = old_state.state if value > 0: return value / 1000 raise EcoDevicesIncorrectValueError("Total value not greater than 0.")