Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare Release 1.0.0 #134

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8bf4f8b
Updated devcontainer to python 3.12
p0l0 Feb 23, 2024
71fe59e
Added additional select config parameters
p0l0 Feb 23, 2024
147b7cf
Languages can not be changed through API
p0l0 Mar 2, 2024
2c40f19
Added all realtime sensors
p0l0 Mar 2, 2024
0af2e33
Merge branch 'main' into next
p0l0 Apr 8, 2024
0f0cf4d
Merge branch 'main' into next
p0l0 May 30, 2024
4dc44cd
Merge branch 'main' into next
p0l0 Sep 21, 2024
0c55ea5
Added TEXT sensors
p0l0 Oct 1, 2024
a8ba4ec
Added missing libturbojpeg0 HA dependency
p0l0 Oct 1, 2024
2f3b672
Fixed incorrect unit_of_measurement (Fixes: #121)
p0l0 Oct 1, 2024
2105cba
Fixed typo
p0l0 Oct 1, 2024
b0ca894
Fixed device_class for sensor
p0l0 Oct 1, 2024
a52b9e3
Raise error if unable to update parameter
p0l0 Oct 1, 2024
9672d6e
Added number sensor
p0l0 Oct 1, 2024
f7a7f11
Fixed class name
p0l0 Oct 1, 2024
2294375
Optimized Unit Of Measurement
p0l0 Oct 2, 2024
272e018
Added Switch sensor
p0l0 Oct 2, 2024
b3d2b2c
Added Time sensor
p0l0 Oct 2, 2024
47ecc59
Prepare beta release
p0l0 Oct 2, 2024
1298c43
Merge branch 'main' into next
p0l0 Oct 2, 2024
52cd03a
Updated README with new sensors
p0l0 Oct 3, 2024
1b6b023
Updated README
p0l0 Oct 3, 2024
1f66094
Update README
p0l0 Oct 3, 2024
98b1877
Updated README
p0l0 Oct 3, 2024
a35d91a
Formatted README and added German translation
p0l0 Oct 3, 2024
2dc3d18
Updated README
p0l0 Oct 3, 2024
5c06312
Bump pygruenbeck_cloud to 1.1.0 (Adds SE Device Support - #117)
p0l0 Oct 6, 2024
945f081
Merge branch 'main' into next
p0l0 Oct 18, 2024
ab3bf14
Fixed error with missing field for SE Series #117
p0l0 Oct 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Optimized Unit Of Measurement
  • Loading branch information
p0l0 committed Oct 2, 2024
commit 2294375296c32c1f6388cceefa2e840d938ab73c
9 changes: 6 additions & 3 deletions custom_components/gruenbeck_cloud/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
# Polling update interval
UPDATE_INTERVAL: Final = timedelta(seconds=360)

# Custom Device classes
DEVICE_CLASS_DH: Final = "°dH"
DEVICE_CLASS_DAYS: Final = "days" # @TODO - We need to translate this!
# Custom Unit of Measurement
UNIT_OF_DH: Final = "°dH"
UNIT_OF_MA_MIN: Final = "mAmin"
UNIT_OF_L_IMP: Final = "l/Imp"
UNIT_OF_M3_X_DH: Final = "m³x°dH"
UNIT_OF_L_HOUR: Final = "l/h"

# Services
SERVICE_UPDATE_DEVICE_PARAMETERS: Final = "change_settings"
Expand Down
60 changes: 37 additions & 23 deletions custom_components/gruenbeck_cloud/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@
NumberMode,
)
from homeassistant.const import (
PERCENTAGE,
EntityCategory,
UnitOfElectricCurrent,
UnitOfFrequency,
UnitOfTime,
UnitOfVolume,
UnitOfVolumeFlowRate,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from .const import DOMAIN
from .const import DOMAIN, UNIT_OF_DH, UNIT_OF_L_IMP, UNIT_OF_M3_X_DH, UNIT_OF_MA_MIN
from .coordinator import GruenbeckCloudCoordinator
from .models import GruenbeckCloudEntity

Expand All @@ -50,7 +52,7 @@ class GruenbeckCloudEntityDescription(NumberEntityDescription):
translation_key="raw_water_hardness",
entity_category=EntityCategory.CONFIG,
mode=NumberMode.BOX,
unit_of_measurement="°dH",
native_unit_of_measurement=UNIT_OF_DH,
value_fn=lambda device: device.parameters.raw_water_hardness,
update_fn=lambda device, value: {"raw_water_hardness": value},
),
Expand All @@ -59,10 +61,15 @@ class GruenbeckCloudEntityDescription(NumberEntityDescription):
translation_key="soft_water_hardness",
entity_category=EntityCategory.CONFIG,
mode=NumberMode.BOX,
unit_of_measurement="°dH",
native_unit_of_measurement=UNIT_OF_DH,
value_fn=lambda device: device.parameters.soft_water_hardness,
update_fn=lambda device, value: {"soft_water_hardness": value},
),
#################################################################
# #
# Disabled Entities - Need to be activated manually in Frontend #
# #
#################################################################
# Maintenance information [days]
GruenbeckCloudEntityDescription(
key="maintenance_interval",
Expand All @@ -73,7 +80,8 @@ class GruenbeckCloudEntityDescription(NumberEntityDescription):
native_min_value=1,
native_max_value=365,
native_step=1,
unit_of_measurement="days",
native_unit_of_measurement=UnitOfTime.DAYS,
# device_class=SensorDeviceClass.DURATION,
value_fn=lambda device: device.parameters.maintenance_interval,
# We get currently a 500 error from API if we try to change it
update_fn=lambda device, value: {"maintenance_interval": value},
Expand All @@ -85,7 +93,7 @@ class GruenbeckCloudEntityDescription(NumberEntityDescription):
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
mode=NumberMode.SLIDER,
unit_of_measurement="%",
native_unit_of_measurement=PERCENTAGE,
native_min_value=1,
native_max_value=100,
native_step=1,
Expand All @@ -101,7 +109,7 @@ class GruenbeckCloudEntityDescription(NumberEntityDescription):
mode=NumberMode.SLIDER,
native_min_value=1,
native_max_value=100,
unit_of_measurement="%",
native_unit_of_measurement=PERCENTAGE,
native_step=1,
value_fn=lambda device: device.parameters.residual_capacity_limit,
# We get currently a 500 error from API if we try to change it
Expand All @@ -127,7 +135,7 @@ class GruenbeckCloudEntityDescription(NumberEntityDescription):
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
mode=NumberMode.BOX,
unit_of_measurement="mAmin",
native_unit_of_measurement=UNIT_OF_MA_MIN,
value_fn=lambda device: device.parameters.charge,
# We get currently a 500 error from API if we try to change it
update_fn=lambda device, value: {"charge": value},
Expand All @@ -142,7 +150,8 @@ class GruenbeckCloudEntityDescription(NumberEntityDescription):
native_min_value=1,
native_max_value=365,
native_step=1,
unit_of_measurement="days",
native_unit_of_measurement=UnitOfTime.DAYS,
# device_class=SensorDeviceClass.DURATION,
value_fn=lambda device: device.parameters.interval_forced_regeneration,
# We get currently a 500 error from API if we try to change it
update_fn=lambda device, value: {"interval_forced_regeneration": value},
Expand Down Expand Up @@ -205,7 +214,7 @@ class GruenbeckCloudEntityDescription(NumberEntityDescription):
translation_key="soft_water_meter_pulse_rate",
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
native_unit_of_measurement="l/Imp",
native_unit_of_measurement=UNIT_OF_L_IMP,
mode=NumberMode.BOX,
value_fn=lambda device: device.parameters.soft_water_meter_pulse_rate,
# We get currently a 500 error from API if we try to change it
Expand All @@ -217,7 +226,7 @@ class GruenbeckCloudEntityDescription(NumberEntityDescription):
translation_key="blending_water_meter_pulse_rate",
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
native_unit_of_measurement="l/Imp",
native_unit_of_measurement=UNIT_OF_L_IMP,
mode=NumberMode.BOX,
value_fn=lambda device: device.parameters.blending_water_meter_pulse_rate,
# We get currently a 500 error from API if we try to change it
Expand All @@ -229,7 +238,7 @@ class GruenbeckCloudEntityDescription(NumberEntityDescription):
translation_key="regeneration_water_meter_pulse_rate",
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
native_unit_of_measurement="l/Imp",
native_unit_of_measurement=UNIT_OF_L_IMP,
mode=NumberMode.BOX,
value_fn=lambda device: device.parameters.regeneration_water_meter_pulse_rate,
# We get currently a 500 error from API if we try to change it
Expand All @@ -241,7 +250,7 @@ class GruenbeckCloudEntityDescription(NumberEntityDescription):
translation_key="capacity_figure_monday",
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
native_unit_of_measurement="m³x°dH",
native_unit_of_measurement=UNIT_OF_M3_X_DH,
mode=NumberMode.BOX,
value_fn=lambda device: device.parameters.capacity_figure_monday,
# We get currently a 500 error from API if we try to change it
Expand All @@ -252,7 +261,7 @@ class GruenbeckCloudEntityDescription(NumberEntityDescription):
translation_key="capacity_figure_tuesday",
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
native_unit_of_measurement="m³x°dH",
native_unit_of_measurement=UNIT_OF_M3_X_DH,
mode=NumberMode.BOX,
value_fn=lambda device: device.parameters.capacity_figure_tuesday,
# We get currently a 500 error from API if we try to change it
Expand All @@ -263,7 +272,7 @@ class GruenbeckCloudEntityDescription(NumberEntityDescription):
translation_key="capacity_figure_wednesday",
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
native_unit_of_measurement="m³x°dH",
native_unit_of_measurement=UNIT_OF_M3_X_DH,
mode=NumberMode.BOX,
value_fn=lambda device: device.parameters.capacity_figure_wednesday,
# We get currently a 500 error from API if we try to change it
Expand All @@ -274,7 +283,7 @@ class GruenbeckCloudEntityDescription(NumberEntityDescription):
translation_key="capacity_figure_thursday",
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
native_unit_of_measurement="m³x°dH",
native_unit_of_measurement=UNIT_OF_M3_X_DH,
mode=NumberMode.BOX,
value_fn=lambda device: device.parameters.capacity_figure_thursday,
# We get currently a 500 error from API if we try to change it
Expand All @@ -285,7 +294,7 @@ class GruenbeckCloudEntityDescription(NumberEntityDescription):
translation_key="capacity_figure_friday",
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
native_unit_of_measurement="m³x°dH",
native_unit_of_measurement=UNIT_OF_M3_X_DH,
mode=NumberMode.BOX,
value_fn=lambda device: device.parameters.capacity_figure_friday,
# We get currently a 500 error from API if we try to change it
Expand All @@ -296,7 +305,7 @@ class GruenbeckCloudEntityDescription(NumberEntityDescription):
translation_key="capacity_figure_saturday",
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
native_unit_of_measurement="m³x°dH",
native_unit_of_measurement=UNIT_OF_M3_X_DH,
mode=NumberMode.BOX,
value_fn=lambda device: device.parameters.capacity_figure_saturday,
# We get currently a 500 error from API if we try to change it
Expand All @@ -307,7 +316,7 @@ class GruenbeckCloudEntityDescription(NumberEntityDescription):
translation_key="capacity_figure_sunday",
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
native_unit_of_measurement="m³x°dH",
native_unit_of_measurement=UNIT_OF_M3_X_DH,
mode=NumberMode.BOX,
value_fn=lambda device: device.parameters.capacity_figure_sunday,
# We get currently a 500 error from API if we try to change it
Expand All @@ -332,7 +341,8 @@ class GruenbeckCloudEntityDescription(NumberEntityDescription):
translation_key="regeneration_monitoring_time",
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
native_unit_of_measurement="min",
native_unit_of_measurement=UnitOfTime.MINUTES,
# device_class=SensorDeviceClass.DURATION,
mode=NumberMode.BOX,
value_fn=lambda device: device.parameters.regeneration_monitoring_time,
# We get currently a 500 error from API if we try to change it
Expand All @@ -344,7 +354,8 @@ class GruenbeckCloudEntityDescription(NumberEntityDescription):
translation_key="salting_monitoring_time",
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
native_unit_of_measurement="min",
native_unit_of_measurement=UnitOfTime.MINUTES,
# device_class=SensorDeviceClass.DURATION,
mode=NumberMode.BOX,
value_fn=lambda device: device.parameters.salting_monitoring_time,
# We get currently a 500 error from API if we try to change it
Expand All @@ -356,7 +367,8 @@ class GruenbeckCloudEntityDescription(NumberEntityDescription):
translation_key="slow_rinse",
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
native_unit_of_measurement="min",
native_unit_of_measurement=UnitOfTime.MINUTES,
# device_class=SensorDeviceClass.DURATION,
mode=NumberMode.BOX,
value_fn=lambda device: device.parameters.slow_rinse,
# We get currently a 500 error from API if we try to change it
Expand Down Expand Up @@ -446,7 +458,8 @@ class GruenbeckCloudEntityDescription(NumberEntityDescription):
translation_key="longest_switch_on_time_chlorine_cell",
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
native_unit_of_measurement="min",
native_unit_of_measurement=UnitOfTime.MINUTES,
# device_class=SensorDeviceClass.DURATION,
mode=NumberMode.BOX,
value_fn=lambda device: device.parameters.longest_switch_on_time_chlorine_cell,
# We get currently a 500 error from API if we try to change it
Expand All @@ -458,7 +471,8 @@ class GruenbeckCloudEntityDescription(NumberEntityDescription):
translation_key="maximum_remaining_time_regeneration",
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
native_unit_of_measurement="min",
native_unit_of_measurement=UnitOfTime.MINUTES,
# device_class=SensorDeviceClass.DURATION,
mode=NumberMode.BOX,
value_fn=lambda device: device.parameters.maximum_remaining_time_regeneration,
# We get currently a 500 error from API if we try to change it
Expand Down
34 changes: 20 additions & 14 deletions custom_components/gruenbeck_cloud/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import logging

from pygruenbeck_cloud.const import (
PARAMETER_LANGUAGES,
PARAMETER_LED_MODES,
PARAMETER_OPERATION_MODES,
PARAMETER_REGENERATION_MODES,
Expand Down Expand Up @@ -65,19 +66,6 @@ class GruenbeckCloudEntityDescription(SelectEntityDescription):
]
},
),
# We get a 500 error from API if we try to change it
# GruenbeckCloudEntityDescription(
# key="language",
# translation_key="language",
# options=list(PARAMETER_LANGUAGES.values()),
# entity_category=EntityCategory.CONFIG,
# value_fn=lambda device: PARAMETER_LANGUAGES[device.parameters.language], # type: ignore[index] # noqa: E501
# update_fn=lambda device, option: {
# "language": list(PARAMETER_LANGUAGES.keys())[
# list(PARAMETER_LANGUAGES.values()).index(option)
# ]
# },
# ),
GruenbeckCloudEntityDescription(
key="mode",
translation_key="mode",
Expand All @@ -89,7 +77,11 @@ class GruenbeckCloudEntityDescription(SelectEntityDescription):
]
},
),
# Disabled Entities
#################################################################
# #
# Disabled Entities - Need to be activated manually in Frontend #
# #
#################################################################
GruenbeckCloudEntityDescription(
key="led_ring_mode",
translation_key="led_ring_mode",
Expand All @@ -103,6 +95,20 @@ class GruenbeckCloudEntityDescription(SelectEntityDescription):
]
},
),
GruenbeckCloudEntityDescription(
key="language",
translation_key="language",
options=list(PARAMETER_LANGUAGES.values()),
entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False,
value_fn=lambda device: PARAMETER_LANGUAGES[device.parameters.language], # type: ignore[index] # noqa: E501
# We get a 500 error from API if we try to change it
update_fn=lambda device, option: {
"language": list(PARAMETER_LANGUAGES.keys())[
list(PARAMETER_LANGUAGES.values()).index(option)
]
},
),
GruenbeckCloudEntityDescription(
key="mode_individual_monday",
translation_key="mode_individual_monday",
Expand Down
Loading