lloydw / hass-spanet

HomeAssistant integration for SpaNET
MIT License
9 stars 1 forks source link

Thanks! And some questions/sugestions #4

Open radionut50 opened 3 weeks ago

radionut50 commented 3 weeks ago

Many thanks for the SpaNet integration, I have been looking for this function for a while (mosty because the native app is really clunky). I am pleased to confirm I have installed it successfully. I am a recent convert to Home Assistant from Openhab, and slowly getting used to the different data point structures. A question (and maybe suggestion for development). I note the entities are provided as sensors only. Is there a way to deploy a service to set the temperature from an automation? Further to this, is it possible to extend the integration to enable monitoring, and (even better) control the spa operating mode, pump on/off, powersave mode etc? Cheers

lloydw commented 3 weeks ago

Hey,

Thanks for trying it out and giving feedback, pleased to hear you got it to work.

Yes, I plan to add more features like turning on and off pumps, operating mode etc. This is just the first release to ensure the basics are operational. You can set the temperature with an automation like this (in this case "Spa" is the name of my spa in the official app):

Screen Shot 2024-06-11 at 11 26 17 PM

Hope that helps!

radionut50 commented 2 weeks ago

Many thanks for the quick response Lloyd, and the pointer to how to set the temperature. I am a fellow Kiwi, and a control systems design engineer by trade (slowly moving to retirement) . I would happy to assist with testing or comments any time. The pool is in our second home in Ohakune, so remote control of temperature and mode settings are vital, and automating this is a goal.

radionut50 commented 2 weeks ago

An issue arose today while I was setting up some values in dashboards. All entities suddenly become unavailable, and I spent a while poking around, including reinitialising the Integration a few times with no improvement, then magically the values came on line again.

It happened again later in the day, and this time I was more attenuative to logs, and found the following line: _“customcomponents.spanet.spanet.SpaNetAuthFailed: API Error 429: API calls quota exceeded! maximum admitted 60 per 1h.”

Clearly the SpaNet servers limit activity. It appears that the integration does not try to restore itself once it has been blocked. I assume the call count is controlled by the total of the dashboard setup, or maybe deeper within the core? Is it practical to set a limit within the Integration that avoids hitting the server limit, and/or include a re-initialise function within the integration if/when the limit get reached?

Cheers Alan

lloydw commented 2 weeks ago

Thanks for the bug report, that's really helpful. I've noticed this on my connection too, but wasn't sure the cause. 429 code is a great lead. Clearly I need to optimise the queries a bit to fit in the 60 calls an hour window.

I've got pump information working locally and should be straight forward to integrate operation mode too as a drop down selector - you would then be able to automate it too.

Is there anything else specific you want that I can prioritize?

radionut50 commented 2 weeks ago

My priority list for development would look something like this:

  1. Pump on/off (already stated)
  2. Operating mode - Normal/Econ/Away/weekend (of which I only use Normal and Away)
  3. Sleep Timers on-off (there are two, timer 1 and 2, I only ever use 1)
  4. Power Save Low/High/Off (I only ever use High / Off)
  5. Heat pump Mode - Auto/Heat/Cool/Disable and additional buttons on that screen for Element Boost On/Off (actually I only ever use the Element Boost function on this screen, for fast-heat up).

but of course – any of these functions would be a bonus compared with perpetually fiddling with the annoying app (although since they went over to their new servers, at least the spa does not need to be re-connected every few months.

ellyse18 commented 2 weeks ago

“custom_components.spanet.spanet.SpaNetAuthFailed: API Error 429: API calls quota exceeded! maximum admitted 60 per 1h.”

This is new since last Friday. Spanet have been making noticeable changes to the API in the last week. I am now having issues with setting the spa temperature and filtration.

lloydw commented 2 weeks ago

Thank you, yes I have some changes in the works to address this and make things more stable which should drop later this week with a stop gap solution and pump support.

I’ll then improve things further with a more long term solution.

lloydw commented 2 weeks ago

Status update:

I now have fully functional pump switches and greatly reduced api calls.

I’m going to let it run overnight to make sure I haven’t broken anything else, otherwise will push up for you to try tomorrow

lloydw commented 1 week ago

Alright v0.3.0 is here and ready for testing.

It should be a lot more stable with regards to the API and Pumps are now visible. Let me know how it goes.

radionut50 commented 1 week ago

Many thanks for the update.

Unfortunately I am away from the house at the moment, on a trip in the South Island for 2 weeks. I was brave though, and installed the update to v0.3.0 remotely, then watched on the SpaNet app and HA to see what happened. I have a load monitor on the supply to spa also, so can verify whether the pump (and/ or heater) are actually running, independantly from the SpaNet app.

Firstly, the update installed without breaking anything that I can see from here. My SPA has only 1 pump, with two different speed settings. The SpaNet app displays pump 2 which I can switch on and off, but that does not do anything on the spa.

The original version had set up Pump 1 as a sensor. Installing this version 0.3.0 set up a new Pump 2 as a switch, and toggling does what is expected expected. The new version did not, however, change the pump 1 sensor to a switch though, and the sensor continues to operate as that, a monitor of what the SpaNet app has told the controller to do, but I could not actually control the pump from HA as I did not have a HA switch entity to do this.

I am still not very experienced with HA, and found that I could not delete the pump 1 sensor, or manually set up a pump 1 switch while it is there. I tried several combinations of uninstalling the integration, restarting, and re-installing, (including removing all dashboard and automation references to the entity, and a full server restart progressively on each try) but the pump 1 sensor came back every time.

What is the secret to getting this work?

radionut50 commented 1 week ago

Hmm.. I thought I would sort this out, so this time in Settings > Devices I deleted the SpaNet integration.

Then I browsed to the custom_components directory and deleted the spanet directory with all its contents and restarted HA.

Then in HACS I re-downloaded version 0.3.0 and restarted HA.

Then in Settings > Devices I reinstalled the integration, and gosh darn – the pump1 sensor came back, (as well as the pump2 switch), so I am no further forward (no pump1 switch).

...help!

lloydw commented 1 week ago

hey, sorry I meant to get back to you last night but ran out of time.

This is somewhat expected based on how my Spa works, but maybe yours is different. How many pumps do you see in the official app? My Pump 1 is the circulation pump and is basically locked on "auto" all the time and cannot be manually switched in the official app. So I built it that any Pump that says its an auto pump cannot be toggled and just shows up as a sensor.

Pump 2 should be your jets, which it sounds like it does? On my Spa I see a Pump 3 as well, but that doesn't do anything.

If you can toggle your Pump 1 in the Official app I'll likely need a bit more debug info so I can see how to detect your Pump 1 vs my Pump 1.

If you open your config/configuration.yaml in homeassistant and add (or edit if you already have log settings defined):

logger:
  default: error # You may want to set this to something else
  logs:
    custom_components.spanet: debug

You will then see more detailed SpaNET logs in your logs, and you should look for a line that starts with:

DEBUG (MainThread) [custom_components.spanet.coordinator] Update Pumps

It will contain a json blob that it retrieved from the server, for example mine looks like:

{'pumpAndBlower': {'pumps': [{'id': 17834, 'pumpNumber': 1, 'pumpSpeed': 1, 'pumpStatus': 'auto', 'hasAuto': True, 'isCirc': False, 'pumpVariableSpeed': 0, 'canSwitchOn': True}, {'id': 17835, 'pumpNumber': 2, 'pumpSpeed': 1, 'pumpStatus': 'off', 'hasAuto': False, 'isCirc': False, 'pumpVariableSpeed': 0, 'canSwitchOn': True}, {'id': 17836, 'pumpNumber': 3, 'pumpSpeed': 1, 'pumpStatus': 'off', 'hasAuto': False, 'isCirc': False, 'pumpVariableSpeed': 0, 'canSwitchOn': True}], 'blower': {'id': 8227, 'blowerStatus': 'off', 'blowerVariableSpeed': 1, 'canSwitchOn': True}, 'loadLimit': 4, 'lastUpdatedDateTime': '21/06/2024 04:58:45 AM', 'hasOxy': False, 'oxy': False, 'rg': 'RG,1,1,1,1,1,1,0-,1-1-4,1-1-01,1-1-01,0-,0,0,0,1476'}}

If you need anymore details, let me know

radionut50 commented 1 week ago

OK – thanks for the info (I will stop trying to fix things and await your attention to the problem 😊 ).

Confirming my pool has one pump, which can go slow or fast. My app, however, shows two pump buttons, the second one does nothing to the pool.

To switch on the pump with the app, I press the button for “pump 1”, and a second sub-window pops up with 4 options: low/high/off/auto. When I exit this sub-window after switching the pump to any of the non-off modes the pump button on the main screen stays bold to indicate the pump is running. To turn the pump off, I select the pump, and on the sub-window select off. The main screen returns with the pump 1 button no longer highlighted When I press the pump 2 button, it does not bring up the sub-window, but does highlight itself (and does nothing on the spa). Here is what the screens look like.

Main-window Sub-window

I have made log captures, each with brief headings - hopefully they will insert here OK, and be useful. If not, I am happy to email them to you. I note that there are some errors in the pump 1 switching also, however that seems to work OK (note again, I am over 400km from my pool right now, just looking at the current it is drawing each time I switch and assuming the pump is doing what it says – almost certainly correct though, as there are not other obvious ways for it to draw the amount of current it is showing)

Select Pump 1 - bring up low/ high/off/auto screen:

2024-06-21 18:59:21.177 DEBUG (MainThread) [custom_components.spanet.coordinator] Update Dashboard {'deviceName': 'Tirohanga ', 'currentTemperature': 306, 'setTemperature': 254, 'dateTime': '20/06/2024 06:58:00 PM', 'lastUpdatedDateTime': '21/06/2024 06:57:52 AM', 'statusList': [''], 'warningStatusList': [], 'hasError': False, 'sanitiseOn': False, 'updateAvailableVersion': 'v7.3'} 2024-06-21 18:59:21.473 DEBUG (MainThread) [custom_components.spanet.coordinator] Update Pumps {'pumpAndBlower': {'pumps': [{'id': 15030, 'pumpNumber': 1, 'pumpSpeed': 2, 'pumpStatus': 'low', 'hasAuto': True, 'isCirc': False, 'pumpVariableSpeed': 0, 'canSwitchOn': True}, {'id': 15031, 'pumpNumber': 2, 'pumpSpeed': 1, 'pumpStatus': 'off', 'hasAuto': False, 'isCirc': False, 'pumpVariableSpeed': 0, 'canSwitchOn': True}], 'blower': {'id': 7020, 'blowerStatus': 'off', 'blowerVariableSpeed': 5, 'canSwitchOn': True}, 'loadLimit': 4, 'lastUpdatedDateTime': '21/06/2024 06:57:52 AM', 'hasOxy': False, 'oxy': False, 'rg': 'RG,1,1,1,1,1,1,0-,1-2-0324,1-1-01,0-,0-,0,0,0,2464'}} 2024-06-21 18:59:21.473 DEBUG (MainThread) [custom_components.spanet.coordinator] Spa 8307 Status: {'setTemperature': 254, 'currentTemperature': 306, 'statusList': [''], 'heat': 0, 'sleep': 0, 'sanitise': 0, 'pumps': {'1': {'apiId': '15030', 'auto': True, 'hasSwitch': False, 'status': 'low'}, '2': {'apiId': '15031', 'auto': False, 'hasSwitch': True, 'status': 'off'}}} 2024-06-21 18:59:21.473 DEBUG (MainThread) [custom_components.spanet.coordinator] Finished fetching Tirohanga data in 0.619 seconds (success: True) 2024-06-21 18:59:21.473 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval await self._async_refresh(log_failures=True, scheduled=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 414, in _async_refresh self.async_update_listeners() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners update_callback() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 492, in _handle_coordinator_update self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1009, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1015, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/binary_sensor/init.py", line 296, in state if (is_on := self.is_on) is None: ^^^^^^^^^^ File "/config/custom_components/spanet/sensor.py", line 80, in is_on return int(value) == 1 ^^^^^^^^^^ ValueError: invalid literal for int() with base 10: 'low'

Select "Low" on app - pump goes on in low position:

2024-06-21 19:02:20.854 DEBUG (MainThread) [custom_components.spanet.coordinator] Spa 8307 Status: {'setTemperature': 254, 'currentTemperature': 306, 'statusList': [''], 'heat': 0, 'sleep': 0, 'sanitise': 0, 'pumps': {'1': {'apiId': '15030', 'auto': True, 'hasSwitch': False, 'status': 'low'}, '2': {'apiId': '15031', 'auto': False, 'hasSwitch': True, 'status': 'off'}}} 2024-06-21 19:02:20.855 DEBUG (MainThread) [custom_components.spanet.coordinator] Finished fetching Tirohanga data in 0.000 seconds (success: True) 2024-06-21 19:02:27.572 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval await self._async_refresh(log_failures=True, scheduled=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 414, in _async_refresh self.async_update_listeners() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners update_callback() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 492, in _handle_coordinator_update self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1009, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1015, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/binary_sensor/init.py", line 296, in state if (is_on := self.is_on) is None: ^^^^^^^^^^ File "/config/custom_components/spanet/sensor.py", line 80, in is_on return int(value) == 1 ^^^^^^^^^^ ValueError: invalid literal for int() with base 10: 'low'

Select Higgh - pump correctly goe son high:

File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1015, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/binary_sensor/init.py", line 296, in state if (is_on := self.is_on) is None: ^^^^^^^^^^ File "/config/custom_components/spanet/sensor.py", line 80, in is_on return int(value) == 1 ^^^^^^^^^^ ValueError: invalid literal for int() with base 10: 'low' 2024-06-21 19:04:21.263 DEBUG (MainThread) [custom_components.spanet.coordinator] Update Dashboard {'deviceName': 'Tirohanga ', 'currentTemperature': 306, 'setTemperature': 254, 'dateTime': '20/06/2024 07:04:00 PM', 'lastUpdatedDateTime': '21/06/2024 07:03:45 AM', 'statusList': [''], 'warningStatusList': [], 'hasError': False, 'sanitiseOn': False, 'updateAvailableVersion': 'v7.3'} 2024-06-21 19:04:21.264 DEBUG (MainThread) [custom_components.spanet.coordinator] Spa 8307 Status: {'setTemperature': 254, 'currentTemperature': 306, 'statusList': [''], 'heat': 0, 'sleep': 0, 'sanitise': 0, 'pumps': {'1': {'apiId': '15030', 'auto': True, 'hasSwitch': False, 'status': 'low'}, '2': {'apiId': '15031', 'auto': False, 'hasSwitch': True, 'status': 'off'}}} 2024-06-21 19:04:21.264 DEBUG (MainThread) [custom_components.spanet.coordinator] Finished fetching Tirohanga data in 0.410 seconds (success: True) 2024-06-21 19:04:21.264 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval await self._async_refresh(log_failures=True, scheduled=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 414, in _async_refresh self.async_update_listeners() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners update_callback() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 492, in _handle_coordinator_update self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1009, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1015, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/binary_sensor/init__.py", line 296, in state if (is_on := self.is_on) is None: ^^^^^^^^^^ File "/config/custom_components/spanet/sensor.py", line 80, in is_on return int(value) == 1 ^^^^^^^^^^ ValueError: invalid literal for int() with base 10: 'low'

Select Off, pump goes off:

2024-06-21 19:06:20.853 DEBUG (MainThread) [custom_components.spanet.coordinator] Spa 8307 Status: {'setTemperature': 254, 'currentTemperature': 306, 'statusList': [''], 'heat': 0, 'sleep': 0, 'sanitise': 0, 'pumps': {'1': {'apiId': '15030', 'auto': True, 'hasSwitch': False, 'status': 'high'}, '2': {'apiId': '15031', 'auto': False, 'hasSwitch': True, 'status': 'off'}}} 2024-06-21 19:06:20.854 DEBUG (MainThread) [custom_components.spanet.coordinator] Finished fetching Tirohanga data in 0.000 seconds (success: True)

Select pump 2 on app (nothing happens on the spa):

2024-06-21 19:06:30.241 ERROR (Recorder) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval await self._async_refresh(log_failures=True, scheduled=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 414, in _async_refresh self.async_update_listeners() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners update_callback() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 492, in _handle_coordinator_update self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1009, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1015, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/binary_sensor/init.py", line 296, in state if (is_on := self.is_on) is None: ^^^^^^^^^^ File "/config/custom_components/spanet/sensor.py", line 80, in is_on return int(value) == 1 ^^^^^^^^^^ ValueError: invalid literal for int() with base 10: 'high'

One minute later (no buttons pressed):

2024-06-21 19:07:21.279 DEBUG (MainThread) [custom_components.spanet.coordinator] Update Dashboard {'deviceName': 'Tirohanga ', 'currentTemperature': 306, 'setTemperature': 254, 'dateTime': '20/06/2024 07:07:00 PM', 'lastUpdatedDateTime': '21/06/2024 07:07:04 AM', 'statusList': [''], 'warningStatusList': [], 'hasError': False, 'sanitiseOn': False, 'updateAvailableVersion': 'v7.3'} 2024-06-21 19:07:21.279 DEBUG (MainThread) [custom_components.spanet.coordinator] Spa 8307 Status: {'setTemperature': 254, 'currentTemperature': 306, 'statusList': [''], 'heat': 0, 'sleep': 0, 'sanitise': 0, 'pumps': {'1': {'apiId': '15030', 'auto': True, 'hasSwitch': False, 'status': 'high'}, '2': {'apiId': '15031', 'auto': False, 'hasSwitch': True, 'status': 'off'}}} 2024-06-21 19:07:21.279 DEBUG (MainThread) [custom_components.spanet.coordinator] Finished fetching Tirohanga data in 0.425 seconds (success: True) 2024-06-21 19:07:21.280 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval await self._async_refresh(log_failures=True, scheduled=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 414, in _async_refresh self.async_update_listeners() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners update_callback() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 492, in _handle_coordinator_update self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1009, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1015, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/binary_sensor/init.py", line 296, in state if (is_on := self.is_on) is None: ^^^^^^^^^^ File "/config/custom_components/spanet/sensor.py", line 80, in is_on return int(value) == 1 ^^^^^^^^^^ ValueError: invalid literal for int() with base 10: 'high'

lloydw commented 1 week ago

Oh wow, yes I have not seen a pump like that before. So my code doesn't handle a pump that reports "low" and "high", only "on", "off" and "auto".

This is very helpful, thank you for the detailed logs. I shall extend the code to detect this new kind of pump and show a drop down list.

radionut50 commented 1 week ago

A further fact that may help (or just confuse the situation). My spa controller is actually in a swim spa. The pool operates like a 'normal' spa, with seats and jets, but has an additional larger jet at one end (the pool is around 4m long) that provides a flow to gently swim against. There is a mechanical tap on the rim accessed from in the pool allowing variable flow to either the traditional seat jets, or the bigger swim jet.

The only involvement in the swim operation for the controller is that you need to switch the pump to high for the swim jet to be useful.

There is a more expensive option for this same pool that has 2 pumps, one for the swim jet and another for the traditional jets, allowing them to be controlled independently from the swim jet. I have not actually seen an example of this more expensive version though.

lloydw commented 1 week ago

hey @radionut50, I have a branch (https://github.com/lloydw/hass-spanet/tree/variable-speed-pumps) that would be great for you to try when you have some time.

It now detects pumps with multiple speeds and will present a selector instead of a toggle. It should correctly understand the display the state of off, auto, low and high if you set via the official app. However to send a command to the spa I need to know which integer values these 4 modes map to.

I know ON is 1 and OFF is 2 for a toggle switch, but I'm not sure what AUTO, LOW and HIGH map to. So what I have done is made the selector have OFF, AUTO, LOW and HIGH as well as 0, 1,2,3,-1. If you could try selecting those integer values in home assistant then open the official app and see what they map to? So for example if you hit 0, does that make it switch to AUTO? What happens when you press 3 etc.

I just need to complete the table of: Mode Value
AUTO ?
ON 1 (for a single speed)
OFF 2
LOW ?
HIGH ?
radionut50 commented 1 week ago

Hi Lloyd,

I am keen to help, but can't work out how to test the branch - how do I load that version?

On Mon, Jun 24, 2024 at 4:34 PM Lloyd Weehuizen @.***> wrote:

hey @radionut50 https://github.com/radionut50, I have a branch ( https://github.com/lloydw/hass-spanet/tree/variable-speed-pumps) that would be great for you to try when you have some time.

It now detects pumps with multiple speeds and will present a selector instead of a toggle. It should correctly understand the display the state of off, auto, low and high if you set via the official app. However to send a command to the spa I need to know which integer values these 4 modes map to.

I know ON is 1 and OFF is 2 for a toggle switch, but I'm not sure what AUTO, LOW and HIGH map to. So what I have done is made the selector have OFF, AUTO, LOW and HIGH as well as 0, 1,2,3,-1. If you could try selecting those integer values in home assistant then open the official app and see what they map to? So for example if you hit 0, does that make it switch to AUTO? What happens when you press 3 etc.

I just need to complete the table of: Mode Value AUTO ? ON 1 (for a single speed) OFF 2 LOW ? HIGH ?

— Reply to this email directly, view it on GitHub https://github.com/lloydw/hass-spanet/issues/4#issuecomment-2185586425, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABP77BYMOQMCGGBFKWMK3OTZI6OUFAVCNFSM6AAAAABJD6PSHOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBVGU4DMNBSGU . You are receiving this because you were mentioned.Message ID: @.***>

lloydw commented 1 week ago

Cool, what do you normally use to load it from GitHub? I was assuming you were just downloading a zip and copying into HA, but maybe you’re doing something else?

radionut50 commented 1 week ago

I am still pretty much 'faking it' when adding stuff outside the box to HA.
I am using HACS, click on 3 dots on top right, add the Github url as a custom repository, then download the integration.
In this case I don’t seem to be able to add the longer url with the fork address that you provided, it does not see that as a new repository. I deleted the original spanet repository entry, added the longer one for the fork, and downloaded the offered spanet integration – but it shows as vn 0.3.0 still, nothing to indicate it is the forked version (maybe that is actually correct?).

I do see the files in my system under custom_components/spanet. Would it be simpler to just download the new files from github and dump them there and restart?

lloydw commented 1 week ago

Ok cool, I've tagged it as v0.3.1-test1 if you toggle enable beta releases in HACS you should be able to see it.

radionut50 commented 1 week ago

Ahh.. My HACS was immediately saying there was an update. It shows your new version now. I willd o some tests for you next.

radionut50 commented 1 week ago

I have run some tests, and sent the log outcome with notes as an email to your shift address. Cheers

JulianDHall commented 6 days ago

Just downloaded beta version and appears to be working. I will test on site in a few weeks and report any issues. Thank you. Julian (UK)

lloydw commented 6 days ago

Hey Julian,

Thanks for trying the integration. v0.3.0 is likely the best option for now, the the 0.3.1 beta was just an internal test

lloydw commented 5 days ago

Just pushed 0.3.1 that adds Operation Mode support