Skip to content

Commit 1c45d3c

Browse files
committed
* Support for fahrenheit temperature unit
* Usage of temperature min. and max. values from geckolib
1 parent ecc5362 commit 1c45d3c

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

.vscode/settings.json

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"cSpell.words": [
33
"asyncio",
4+
"Bromi",
5+
"cjson",
46
"cmnd",
57
"gazoodle",
68
"geckoclient",
@@ -11,10 +13,14 @@
1113
"NOTSET",
1214
"OZONEMODE",
1315
"paho",
16+
"PUMPNUMBER",
17+
"Setpoint",
1418
"signum",
1519
"SIGTERM",
1620
"SMARTWINTERMODE",
1721
"spaman",
22+
"SPAXX",
23+
"userdata",
1824
"watercare",
1925
"WATERHEAT"
2026
]

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Since version 0.6.x the SPA is controlled by only one control topic `%prefix%/co
106106
| Item | JSON String | Comment |
107107
| ---- |-------------------------------------------------------| --- |
108108
| Lights | {"lights":"off|on"} |
109-
| Temperature | {"temp":TEMP} | TEMP is between 15.0 and 40.0 in steps of 0.5 |
109+
| Temperature | {"temp":TEMP} | TEMP is in steps of 0.5 |
110110
| Pumps | {"pump":"off|low|high","number":PUMPNUMBER} | Not all SPA support 'low' value |
111111
| Blower | {"blower":"off|high"} |
112112
| Watercare | {"watercare":"MODE"} | See below for possible MODE values |
@@ -178,6 +178,10 @@ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
178178

179179
# History
180180

181+
### v0.6.1
182+
* Support for fahrenheit temperature unit
183+
* Usage of temperature min. and max. values from geckolib
184+
181185
### v0.6.0
182186
* Breaking change
183187
* Switch to one command topic and change value to json format

src/const.py

+4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
# GeckoClient version
77
GECKO_CLIENT_VERSION = "0.6.0"
88

9+
#############
910
# internal constants, please do not change
11+
#######
12+
13+
# topics sub-names
1014
TOPIC_CONTROL = TOPIC+"/control"
1115
TOPIC_LIGHTS = TOPIC+"/lights"
1216
TOPIC_REMINDERS = TOPIC+"/reminders"

src/mySpa.py

+14-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from geckolib import (GeckoSpaEvent, GeckoSpaState)
1313
from geckolib import GeckoAsyncSpaMan
1414

15-
from geckolib import (GeckoWaterCare, GeckoReminders, GeckoStructAccessor)
15+
from geckolib import (GeckoWaterCare, GeckoReminders, GeckoStructAccessor, GeckoWaterHeater)
1616

1717
from geckolib import GeckoConstants
1818

@@ -47,11 +47,13 @@ async def handle_event(self, event: GeckoSpaEvent, **kwargs) -> None:
4747
if event == GeckoSpaEvent.CLIENT_FACADE_IS_READY:
4848

4949
logger.info("SPA facade is ready.")
50-
self._can_use_facade = True
5150

5251
# at least publish once all values once
5352
await self._refreshAll()
5453

54+
# now we can use the facade
55+
self._can_use_facade = True
56+
5557
# add the watcher to see all changes
5658
self._facade.watch(OnChange(self))
5759

@@ -380,7 +382,13 @@ async def controls(self, client, userdata, message):
380382
except Exception as ex:
381383
logger.warning(f"Wrong temperature value received")
382384
return
383-
if temp < 6 and temp > 40:
385+
check_failed = False
386+
if self._facade.water_heater.temperature_unit == GeckoWaterHeater.TEMP_CELCIUS:
387+
if temp < GeckoWaterHeater.MIN_TEMP_C or temp > GeckoWaterHeater.MAX_TEMP_C:
388+
check_failed = True
389+
elif temp < GeckoWaterHeater.MIN_TEMP_F or temp > GeckoWaterHeater.MAX_TEMP_F:
390+
check_failed = True
391+
if check_failed:
384392
logger.warning(f"Temperature {temp} outside allowed values")
385393
return
386394
await self._facade.water_heater.set_target_temperature(temp)
@@ -445,6 +453,9 @@ def __call__(self, sender, old_value, new_value):
445453
elif sender.tag == "Clean" or sender.tag == "Purge":
446454
self._mySpa.refreshFilters()
447455

456+
elif sender.tag == "TempUnits":
457+
self._mySpa.refreshHeater()
458+
448459
else:
449460
logger.warning(f"Not handled GeckoStructAccessor sender tag received: {sender.tag}")
450461
logger.warning(f" --> {sender} changed from {old_value} to {new_value}")

0 commit comments

Comments
 (0)