mdz / python-smarttub

Python API for SmartTub enabled hot tubs
MIT License
6 stars 9 forks source link

PrimaryFiltrationMode isn't TrueWater aware #45

Closed smatsmats closed 3 months ago

smatsmats commented 3 months ago

TrueWater (TM :) is a newer filtration mechanism. It uses 'nano bubbles', hence the nano* keys and values.

Probably the only value for node was NORMAL previously , but now we have NANO_MODE.

cheers, steve

Results of python3 -m smarttub -u YOUR_SMARTTUB_EMAIL -p YOUR_SMARTTUB_PASSWORD -vv info -a

" DEBUG:smarttub.api:login successful, username=steve@matsmats.com DEBUG:smarttub.api:GET accounts/3902c368-d524-4a9e-aac6-d429297178bf successful: {'id': '3902c368-d524-4a9e-aac6-d429297178bf', 'email': 'steve@matsmats.com', 'notificationOptIn': True, 'termsOptIn': True, 'emailVerified': False, 'name': {'first': 'S', 'last': 'M'}, 'phone': None, 'language': 'en_US', 'lastUpdated': '2024-06-18T01:43:44.793151Z', 'voiceEnabledSpaId': None, 'sutroNotifications': True, 'atEaseEnabled': True} DEBUG:smarttub.api:get_account successful: {'id': '3902c368-d524-4a9e-aac6-d429297178bf', 'email': 'steve@matsmats.com', 'notificationOptIn': True, 'termsOptIn': True, 'emailVerified': False, 'name': {'first': 'S', 'last': 'M'}, 'phone': None, 'language': 'en_US', 'lastUpdated': '2024-06-18T01:43:44.793151Z', 'voiceEnabledSpaId': None, 'sutroNotifications': True, 'atEaseEnabled': True} DEBUG:smarttub.api:GET spas?ownerId=3902c368-d524-4a9e-aac6-d429297178bf successful: {'content': [{'id': '100986607', 'dealerId': '0010f00002JiIDrAAN', 'ownerId': '3902c368-d524-4a9e-aac6-d429297178bf', 'name': None, 'dealer': {'id': '0010f00002JiIDrAAN', 'name': 'Aqua Quip', 'phone': '6120339', 'email': 'clarson@aquaquip.com', 'address': {'street': '16205 NW BETHANY CT STE 106', 'city': 'BEAVERTON', 'state': 'Oregon', 'zip': '97006', 'country': 'United States'}, 'website': None, 'dealerNumber': '300-2662-1', 'activeDealerAccount': True, 'createdAt': '2020-10-30T23:01:33.769484', 'updatedAt': '2024-04-02T21:06:06.903226'}, 'owner': {'id': '3902c368-d524-4a9e-aac6-d429297178bf', 'email': 'steve@matsmats.com', 'notificationOptIn': True, 'termsOptIn': True, 'emailVerified': False, 'name': {'first': 'S', 'last': 'M'}, 'phone': None, 'language': 'en_US', 'lastUpdated': '2024-06-18T01:43:44.793151Z', 'voiceEnabledSpaId': None, 'sutroNotifications': True, 'atEaseEnabled': True}, 'deviceId': '0a10aced202194944a04d8e4', 'device': {'id': '0a10aced202194944a04d8e4', 'barcode': 'P054AF40104D8E4', 'mobileSecret': 'UDRWG5B9HEU7F2U'}, 'selfTest': {'status': 'FAIL', 'current': {'heaterAndCirculationPump': 24.0, 'jets': [], 'blower': -99.9, 'circulationPump': -11.1, 'ozone': None, 'ultraviolet': None}, 'frequency': 'DAILY', 'startTime': None, 'lastTestTime': '2024-07-07T12:07:00Z'}, 'brand': 'Jacuzzi', 'series': 'J-400', 'modelNumber': 'Y112SDLDM', 'model': 'J-445', 'stereo': False, 'tubColor': 12, 'cabinetColor': 'D', 'equipmentOption': 'S', 'revision': 'L', 'ecomode': False, 'volume': 380, 'pairedAt': '2024-06-15T12:58:03.887228Z', 'subscriptionExpiredAt': '2024-12-15T12:58:03.887228Z', 'subscriptions': None, 'deviceOptIn': False, 'deviceOnline': False, 'powerResetRequired': False, 'voltage': 240, 'warrantyDate': None, 'createdAt': '2024-05-08T18:39:50.448399', 'createdSource': 'MANUFACTURING', 'adapter': 'OFF', 'productIdOrSlug': 'smarttub-multiwifi-ble-na-24464', 'us3G': False, '_b402Upgrade': False, 'sutro': None, 'location': None, 'signal': None, 'coupon': [], 'heaterWatts': 4945, 'coolingRate': 5.53e-07, 'avgAmbientTemp': None, 'ir': True, 'appSettings': None, 'nano': True, 'smEnable': None, 'current': {'value': 0.6, 'min': 0.6, 'max': 0.7, 'average': 0.6, 'kwh': 0.447}, 'water': {'oxidationReductionPotential': None, 'ph': None, 'temperature': 37.8, 'turbidity': None, 'temperatureLastUpdated': '2024-07-07T19:15:28.040Z'}, 'bp100': False, 'lastUpdated': '2024-07-07T22:51:19.755466Z'}], 'pageable': {'sort': {'sorted': True, 'unsorted': False, 'empty': False}, 'offset': 0, 'pageSize': 10, 'pageNumber': 0, 'paged': True, 'unpaged': False}, 'totalPages': 1, 'totalElements': 1, 'last': True, 'size': 10, 'number': 0, 'sort': {'sorted': True, 'unsorted': False, 'empty': False}, 'first': True, 'numberOfElements': 1, 'empty': False} DEBUG:smarttub.api:GET spas/100986607 successful: {'id': '100986607', 'dealerId': '0010f00002JiIDrAAN', 'ownerId': '3902c368-d524-4a9e-aac6-d429297178bf', 'name': None, 'dealer': {'id': '0010f00002JiIDrAAN', 'name': 'Aqua Quip', 'phone': '6120339', 'email': 'clarson@aquaquip.com', 'address': {'street': '16205 NW BETHANY CT STE 106', 'city': 'BEAVERTON', 'state': 'Oregon', 'zip': '97006', 'country': 'United States'}, 'website': None, 'dealerNumber': '300-2662-1', 'activeDealerAccount': True, 'createdAt': '2020-10-30T23:01:33.769484', 'updatedAt': '2024-04-02T21:06:06.903226'}, 'owner': {'id': '3902c368-d524-4a9e-aac6-d429297178bf', 'email': 'steve@matsmats.com', 'notificationOptIn': True, 'termsOptIn': True, 'emailVerified': False, 'name': {'first': 'S', 'last': 'M'}, 'phone': None, 'language': 'en_US', 'lastUpdated': '2024-06-18T01:43:44.793151Z', 'voiceEnabledSpaId': None, 'sutroNotifications': True, 'atEaseEnabled': True}, 'deviceId': '0a10aced202194944a04d8e4', 'device': {'id': '0a10aced202194944a04d8e4', 'barcode': 'P054AF40104D8E4', 'mobileSecret': 'UDRWG5B9HEU7F2U'}, 'selfTest': {'status': 'FAIL', 'current': {'heaterAndCirculationPump': 24.0, 'jets': [], 'blower': -99.9, 'circulationPump': -11.1, 'ozone': None, 'ultraviolet': None}, 'frequency': 'DAILY', 'startTime': None, 'lastTestTime': '2024-07-07T12:07:00Z'}, 'brand': 'Jacuzzi', 'series': 'J-400', 'modelNumber': 'Y112SDLDM', 'model': 'J-445', 'stereo': False, 'tubColor': 12, 'cabinetColor': 'D', 'equipmentOption': 'S', 'revision': 'L', 'ecomode': False, 'volume': 380, 'pairedAt': '2024-06-15T12:58:03.887228Z', 'subscriptionExpiredAt': '2024-12-15T12:58:03.887228Z', 'subscriptions': None, 'deviceOptIn': True, 'deviceOnline': True, 'powerResetRequired': False, 'voltage': 240, 'warrantyDate': None, 'createdAt': '2024-05-08T18:39:50.448399', 'createdSource': 'MANUFACTURING', 'adapter': 'OFF', 'productIdOrSlug': 'smarttub-multiwifi-ble-na-24464', 'us3G': False, '_b402Upgrade': False, 'sutro': None, 'location': None, 'signal': None, 'coupon': [], 'heaterWatts': 4945, 'coolingRate': 5.53e-07, 'avgAmbientTemp': None, 'ir': True, 'appSettings': None, 'nano': True, 'smEnable': None, 'current': {'value': 0.6, 'min': 0.6, 'max': 0.7, 'average': 0.6, 'kwh': 0.447}, 'bp100': False, 'lastUpdated': '2024-07-07T22:51:19.755466Z', 'water': {'oxidationReductionPotential': None, 'ph': None, 'temperature': 37.8, 'turbidity': None, 'temperatureLastUpdated': '2024-07-07T19:15:28.040Z'}} = Spa 'Jacuzzi J-445' =

DEBUG:smarttub.api:GET spas/100986607/status successful: {'ambientTemperature': 65.6, 'blowoutCycle': 'INACTIVE', 'cleanupCycle': 'INACTIVE', 'date': '2024-07-07', 'demoMode': 'DISABLED', 'dipSwitches': 292, 'displayTemperatureFormat': 'FAHRENHEIT', 'errorCode': 0, 'error': {'code': 0, 'title': 'All Clear', 'description': None}, 'flowSwitch': 'OPEN', 'heater': 'OFF', 'heatMode': 'AUTO', 'highTemperatureLimit': 41.1, 'lastUpdated': '2024-07-07T22:51:19.755466Z', 'state': 'NORMAL', 'ozone': 'OFF', 'setTemperature': 38.3, 'time': '15:51:00', 'timeFormat': 'HOURS_24', 'timezone': None, 'uv': 'OFF', 'uvOnDemand': 'OFF', 'current': {'value': 0.6, 'min': 0.6, 'max': 0.7, 'average': 0.6, 'kwh': 0.447}, 'primaryFiltration': {'mode': 'NANO_MODE', 'status': 'INACTIVE', 'startHour': 16, 'duration': 2, 'cycle': 6, 'startMinute': 0, 'durationMinute': 0, 'lastUpdated': '2024-07-07T20:58:32.203Z'}, 'secondaryFiltration': {'mode': 'AWAY', 'status': 'INACTIVE', 'enabled': False, 'startHour': 0, 'startMinute': 0, 'durationHour': 0, 'durationMinute': 0, 'lastUpdated': '2024-07-07T19:15:29.104Z'}, 'water': {'oxidationReductionPotential': None, 'ph': None, 'temperature': 37.8, 'turbidity': None, 'temperatureLastUpdated': '2024-07-07T19:15:28.040Z'}, 'versions': {'balboa': '0.05', 'controller': '2.09', 'jacuzziLink': '90'}, 'locks': {'temperature': 'UNLOCKED', 'spa': 'UNLOCKED', 'access': 'UNLOCKED', 'maintenance': 'UNLOCKED'}, 'location': {'latitude': 47.7010918, 'longitude': -122.3832016, 'accuracy': 1729.0}, 'fieldsLastUpdated': {'heatMode': '2024-07-07T19:15:28.040Z', 'setTemperature': '2024-07-07T19:15:28.040Z', 'uv': '2024-07-07T19:15:28.040Z', 'uvOnDemand': '2024-07-07T19:15:28.040Z', 'online': None, 'errEvent': None, 'locEvent': None, 'rpstEvent': '2024-07-07T22:51:17.933Z', 'spstEvent': '2024-07-07T22:34:53.649Z', 'cfstEvent': '2024-07-07T07:33:23.819Z', 'sp2stEvent': '2024-07-07T07:33:25.740Z', 'wcstEvent': None}, 'watercare': 'AWAY_FROM_HOME', 'online': None, 'pumps': None, 'lights': None, 'sensors': None, 'lowRangeLowTemp': None, 'lowRangeHighTemp': None, 'highRangeLowTemp': None, 'highRangeHighTemp': None, 'tempRange': None, 'heater1Present': None, 'heater2Present': None, 'ozoneSystemPresent': None, 'primingMode': None, 'heater2On': None, 'heatPumpStatus': None, 'heatPumpMode': None, 'heatPumpEfficiency': None, 'electricHeaterMode': None, 'czStatus': None, 'chromazon3Present': None, 'chromazon3Zone1': None, 'chromazon3Zone2': None, 'chromazon3Zone3': None, 'heatCanWait': 4, 'heatVacation': False, 'signal': None, 'errors': None, 'nanoMode': 'MEDIUM', 'nanoStatus': 'OFF', 'nanoSummerMode': 'FILTRATION_INACTIVE', 'nanoSmodeOverride': 'ENABLED', 'nanoPressure': -1.0, 'nanoPressureAlert': 'OK', 'nanoBattery': 'OK', 'nanoAccumulation': 302, 'lastWifi': None, 'timeSet': None} Traceback (most recent call last): File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/home/willey/.local/lib/python3.10/site-packages/smarttub/main.py", line 199, in asyncio.run(main(sys.argv[1:])) File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete return future.result() File "/home/willey/.local/lib/python3.10/site-packages/smarttub/main.py", line 196, in main await args.func(spas, args) File "/home/willey/.local/lib/python3.10/site-packages/smarttub/main.py", line 17, in info_command status = await spa.get_status() File "/home/willey/.local/lib/python3.10/site-packages/smarttub/api.py", line 184, in get_status return SpaState(self, await self.request("GET", "status")) File "/home/willey/.local/lib/python3.10/site-packages/smarttub/api.py", line 311, in init self._prop( File "/home/willey/.local/lib/python3.10/site-packages/smarttub/api.py", line 358, in _prop constructor(self.properties[json_key]), File "/home/willey/.local/lib/python3.10/site-packages/smarttub/api.py", line 313, in constructor=lambda p: SpaPrimaryFiltrationCycle(self.spa, p), File "/home/willey/.local/lib/python3.10/site-packages/smarttub/api.py", line 397, in init self._prop("mode", constructor=lambda x: self.PrimaryFiltrationMode[x]) File "/home/willey/.local/lib/python3.10/site-packages/smarttub/api.py", line 358, in _prop constructor(self.properties[json_key]), File "/home/willey/.local/lib/python3.10/site-packages/smarttub/api.py", line 397, in self._prop("mode", constructor=lambda x: self.PrimaryFiltrationMode[x]) File "/usr/lib/python3.10/enum.py", line 440, in getitem return cls._membermap[name] KeyError: 'NANO_MODE' willey@nib:~$ willey@nib:~$ "