Skip to content

Commit

Permalink
fix(LWxx): resolution time for days sensors (#74)
Browse files Browse the repository at this point in the history
Resolves #70
  • Loading branch information
Michsior14 authored Dec 9, 2024
1 parent 9d6d2f9 commit 570e8de
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
16 changes: 8 additions & 8 deletions custom_components/venta/devices/106.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
ATTR_TIME_TO_SERVICE,
ATTR_WARNINGS,
ATTR_WATER_LEVEL,
CLEAN_TIME_DAYS,
FIVE_MINUTES_RESOLUTION,
ION_DISC_REPLACE_TIME_DAYS,
LED_STRIP_MODES_EXTERNAL,
LED_STRIP_MODES_EXTERNAL_NO_WATER,
LED_STRIP_MODES_INTERNAL,
Expand Down Expand Up @@ -61,6 +58,9 @@
FILTER_WARNING = 8
SERVICE_WARNING = 16

ION_DISC_REPLACE_TIME_DAYS = 122
CLEAN_TIME_DAYS = 183


async def async_setup_humidifier(
coordinator: VentaDataUpdateCoordinator, async_add_entities: AddEntitiesCallback
Expand Down Expand Up @@ -120,7 +120,7 @@ async def async_setup_sensor(
value_func=lambda coordinator: venta_time_to_days_left(
coordinator.data.info.get("DiscIonT"),
ION_DISC_REPLACE_TIME_DAYS,
FIVE_MINUTES_RESOLUTION,
TEN_MINUTES_RESOLUTION,
),
),
VentaSensorEntityDescription(
Expand All @@ -132,7 +132,7 @@ async def async_setup_sensor(
value_func=lambda coordinator: venta_time_to_days_left(
coordinator.data.info.get("CleaningT"),
CLEAN_TIME_DAYS,
FIVE_MINUTES_RESOLUTION,
TEN_MINUTES_RESOLUTION,
),
),
VentaSensorEntityDescription(
Expand Down Expand Up @@ -189,7 +189,7 @@ async def async_setup_sensor(
native_unit_of_measurement=UnitOfTime.MINUTES,
entity_category=EntityCategory.DIAGNOSTIC,
value_func=lambda coordinator: venta_time_to_minutes(
coordinator.data.info.get("OperationT"), FIVE_MINUTES_RESOLUTION
coordinator.data.info.get("OperationT"), TEN_MINUTES_RESOLUTION
),
),
VentaSensorEntityDescription(
Expand All @@ -199,7 +199,7 @@ async def async_setup_sensor(
native_unit_of_measurement=UnitOfTime.MINUTES,
entity_category=EntityCategory.DIAGNOSTIC,
value_func=lambda coordinator: venta_time_to_minutes(
coordinator.data.info.get("DiscIonT"), FIVE_MINUTES_RESOLUTION
coordinator.data.info.get("DiscIonT"), TEN_MINUTES_RESOLUTION
),
),
VentaSensorEntityDescription(
Expand All @@ -209,7 +209,7 @@ async def async_setup_sensor(
native_unit_of_measurement=UnitOfTime.MINUTES,
entity_category=EntityCategory.DIAGNOSTIC,
value_func=lambda coordinator: venta_time_to_minutes(
coordinator.data.info.get("CleaningT"), FIVE_MINUTES_RESOLUTION
coordinator.data.info.get("CleaningT"), TEN_MINUTES_RESOLUTION
),
),
VentaSensorEntityDescription(
Expand Down
16 changes: 8 additions & 8 deletions custom_components/venta/devices/107.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
ATTR_TIME_TO_SERVICE,
ATTR_WARNINGS,
ATTR_WATER_LEVEL,
CLEAN_TIME_DAYS,
FIVE_MINUTES_RESOLUTION,
ION_DISC_REPLACE_TIME_DAYS,
LED_STRIP_MODES_EXTERNAL,
LED_STRIP_MODES_EXTERNAL_NO_WATER,
LED_STRIP_MODES_INTERNAL,
Expand Down Expand Up @@ -61,6 +58,9 @@
FILTER_WARNING = 8
SERVICE_WARNING = 16

ION_DISC_REPLACE_TIME_DAYS = 122
CLEAN_TIME_DAYS = 183


async def async_setup_humidifier(
coordinator: VentaDataUpdateCoordinator, async_add_entities: AddEntitiesCallback
Expand Down Expand Up @@ -120,7 +120,7 @@ async def async_setup_sensor(
value_func=lambda coordinator: venta_time_to_days_left(
coordinator.data.info.get("DiscIonT"),
ION_DISC_REPLACE_TIME_DAYS,
FIVE_MINUTES_RESOLUTION,
TEN_MINUTES_RESOLUTION,
),
),
VentaSensorEntityDescription(
Expand All @@ -132,7 +132,7 @@ async def async_setup_sensor(
value_func=lambda coordinator: venta_time_to_days_left(
coordinator.data.info.get("CleaningT"),
CLEAN_TIME_DAYS,
FIVE_MINUTES_RESOLUTION,
TEN_MINUTES_RESOLUTION,
),
),
VentaSensorEntityDescription(
Expand Down Expand Up @@ -189,7 +189,7 @@ async def async_setup_sensor(
native_unit_of_measurement=UnitOfTime.MINUTES,
entity_category=EntityCategory.DIAGNOSTIC,
value_func=lambda coordinator: venta_time_to_minutes(
coordinator.data.info.get("OperationT"), FIVE_MINUTES_RESOLUTION
coordinator.data.info.get("OperationT"), TEN_MINUTES_RESOLUTION
),
),
VentaSensorEntityDescription(
Expand All @@ -199,7 +199,7 @@ async def async_setup_sensor(
native_unit_of_measurement=UnitOfTime.MINUTES,
entity_category=EntityCategory.DIAGNOSTIC,
value_func=lambda coordinator: venta_time_to_minutes(
coordinator.data.info.get("DiscIonT"), FIVE_MINUTES_RESOLUTION
coordinator.data.info.get("DiscIonT"), TEN_MINUTES_RESOLUTION
),
),
VentaSensorEntityDescription(
Expand All @@ -209,7 +209,7 @@ async def async_setup_sensor(
native_unit_of_measurement=UnitOfTime.MINUTES,
entity_category=EntityCategory.DIAGNOSTIC,
value_func=lambda coordinator: venta_time_to_minutes(
coordinator.data.info.get("CleaningT"), FIVE_MINUTES_RESOLUTION
coordinator.data.info.get("CleaningT"), TEN_MINUTES_RESOLUTION
),
),
VentaSensorEntityDescription(
Expand Down
3 changes: 3 additions & 0 deletions resources/parameters/106.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"name": "OperationT",
"type": "long",
"description": "Total operating time in 5min resolution e.g. 1 = 5min, 12 = 60min",
"notes": "It seams to by 10mins resolution",
"minimum": 0,
"maximum": 4294967295,
"increment": 1
Expand All @@ -51,6 +52,7 @@
"name": "DiscIonT",
"type": "integer",
"description": "Operation time since last change of Silber-Ionen-Rades in 5min resolution.",
"notes": "It seams to by 10mins resolution and 122 days max",
"minimum": 0,
"maximum": 65535,
"increment": 1
Expand All @@ -59,6 +61,7 @@
"name": "CleaningT",
"type": "integer",
"description": "Operation time since last cleaning in 5min resolution.",
"notes": "It seams to by 10mins resolution and 183 days max",
"minimum": 0,
"maximum": 65535,
"increment": 1
Expand Down
3 changes: 3 additions & 0 deletions resources/parameters/107.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"name": "OperationT",
"type": "long",
"description": "Total operating time in 5min resolution e.g. 1 = 5min, 12 = 60min",
"notes": "It seams to by 10mins resolution",
"minimum": 0,
"maximum": 4294967295,
"increment": 1
Expand All @@ -51,6 +52,7 @@
"name": "DiscIonT",
"type": "integer",
"description": "Operation time since last change of Silber-Ionen-Rades in 5min resolution.",
"notes": "It seams to by 10mins resolution and 122 days max",
"minimum": 0,
"maximum": 65535,
"increment": 1
Expand All @@ -59,6 +61,7 @@
"name": "CleaningT",
"type": "integer",
"description": "Operation time since last cleaning in 5min resolution.",
"notes": "It seams to by 10mins resolution and 183 days max",
"minimum": 0,
"maximum": 65535,
"increment": 1
Expand Down

0 comments on commit 570e8de

Please sign in to comment.