Skip to content

Commit

Permalink
remove wrong old code
Browse files Browse the repository at this point in the history
  • Loading branch information
Aohzan committed Jun 22, 2022
1 parent 80f76c9 commit eaec5e3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 4.2.2

- Remove wrong old code

## 4.2.1

- Fix incrementation
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ecodevices/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
12 changes: 6 additions & 6 deletions custom_components/ecodevices/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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.")
Expand Down

0 comments on commit eaec5e3

Please sign in to comment.