Lay-Z-Spa Hot Tub wi-fi pump automation

I have had trouble trying to get the set temp option into hassio but I had the working curl command so I have setup some bits in node red instead if it is any use to anyone.

[{"id":"37d01ae9.869d66","type":"change","z":"6414843e.b4e3dc","name":"Set Hottub 42C","rules":[{"t":"set","p":"headers","pt":"msg","to":"{\"Content-Type\":\"application/json\",\"Accept\":\"application/json\",\"X-Gizwits-User-token\":\"*********\",\"X-Gizwits-Application-Id\":\"***********\"}","tot":"json"},{"t":"set","p":"payload","pt":"msg","to":"{\"attrs\":{\"Temperature_setup\":42}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":140,"wires":[["dea77fd.b480f8"]]},{"id":"dea77fd.b480f8","type":"http request","z":"6414843e.b4e3dc","name":"","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://api.gizwits.com/app/control/***********","tls":"","persist":false,"proxy":"","authType":"","x":590,"y":140,"wires":[["3dcdb20.e1f894e"]]}]

I can then easily automate the temps for me offpeak and onpeak tariffs.

Hi Bruce,

first of all big thanks for all your work and great stuff which I really like. I got all your code in my home assistant and it’s working fine so far. But one thing wouldn’t work.
“HotTub Pump on every 30 minutes”

I also created the 4 helpers, but in my log I always get this:

homeassistant.components.automation.hottub_pump_on_every_30
Source: components/automation/init.py:454
Integration: Automatisierung (documentation, issues)
First occurred: 23. August 2021, 23:30:05 (21 occurrences)
Last logged: 7:30:05

Error rendering variables: TypeError: unsupported operand type(s) for -: ‘NoneType’ and ‘float’

Would be great if you could solve this problem.

Are you using the bestway code or the lay-z-spa code?

the bestway

If you take the two variables lines in the code and put them into the template editor in home assistant, do they show results or an error?

HoursLeft: "{{ ((as_timestamp(states.sensor.date.state + ' ' + states('input_datetime.hottub_ready_by')) - as_timestamp(now())) / 3600) }}"
DegreesLeft: "{{ (states('input_number.hottub_water_target') | int - states('input_number.hottub_water_temp') | int) }}"

I suspect you are missing the date sensor.


sensor:
  - platform: time_date
    display_options:
      #- 'time'
      - 'date'
      #- 'date_time'
      #- 'date_time_utc'
      #- 'date_time_iso'
      #- 'time_date'
      #- 'time_utc

the template editor gives:

TypeError: unsupported operand type(s) for -: ‘NoneType’ and ‘float’

is it ok to put this in configuration.yaml ?

  - platform: time_date`
    display_options:`
     #- 'time'`
     - 'date'`
      #- 'date_time'`
      #- 'date_time_utc'
      #- 'date_time_iso'
      #- 'time_date'
      #- 'time_utc

now the template editor gives me:

UndefinedError: ‘None’ has no attribute ‘state’

Do I see correctly that you have ` all over the place? You don’t need that.

Otherwise your example is misformated, the - ‘date’ should be one more space to the right.

yes I have corrected that, but still get the error:

UndefinedError: ‘None’ has no attribute ‘state’

Hi, I’m following this topic with great interest.
I just recently bought a Bestway Lay-Z Spa Havana.
The app works perfectly, but I’m trying to get the token.
I added the sensor to retrieve the token but response is: unknown

I noticed that there are multiple regions to which the app should respond.
After registering my account, I got a link for USA, but I did not succeed in completing the registration process (failed).
Link: App User Registration Activation Failed

How do I find the correct link?

I tried the CURL commands posted above, this was the response:
{“error_message”:“username or password error!”,“error_code”:9020,“detail_message”:null}

I know for sure that the username and password are correct.

Hi, after half year of brilliant workig I got the same problem and I don’t know why. Did you find the solution?

Look here for the answer:

Thank you, that was the solution!

1 Like

First of all thanks for this, I stumbled across this after I upgraded my pump today.

I use the layz spa integration and got it “~working” well I can turn on the power,bubbles, heater and filter - the filter and power turns off after 5 when the heater is off but I dont get any water temperature reading.

Looking at the status ```
“temp_set_unit: 华氏” and
“temp_now: 59”,
“temp_set: 68”

the app itself is set to Celsius and when I try to switch it to Fahrenheit it immediately switches back to Celsius which is the desired temperature scale anyway s- not sure what is going on here.

Further how would I set the desired temperature and schedule - I have read about helpers but neither in this thread nor in the github can I find any explanation - unless I have missed it the few times I scrolled all the way through and searched for it - anyone who could provide some assistance please?

Anything mentioned in the scripts like…

input_boolean.hottub_scheduled
input_number.hottub_water_temp
input_datetime.hottub_ready_by
input_number.hottub_standard_temp
input_number.hottub_water_temp

etc.

need to be setup in home assistant as “helpers”

configuration → Helpers

They are basically “local variables” you can control, like what temp you want the tub to be at, when you want it to be hot etc.

Ok I’ll go through them to identify them - would be good to get an understanding of the different files, components and how they interact so its no necessary to reverse engineer them as well as get clear instructions on the install what is needed and what isnt - I know perfect world :rofl: - so far I only cloned your packages and added 4 inputs as mentioned above

I may attempt it if I get everything to work as just adding the 4 inputs doesnt seem to change anything … eg the actions dont cause anything though temp is set by slider expected behaviour to cause the heater to start …

Sadly, I don’t even have a lay-z-spa any more, so difficult to get too much motivation to work on documentation etc.
It’s probably a bit over complicated for many people as it includes intelligence based around the Octopus Agile electric tariff.
As well as on demand scheduling etc.

If I have some spare time I’ll try and write something up, or put some more comments in.
Or at least a list of helpers required etc.

no worries mate I got it to work I think but do I see it correctly that the input_number.hottub_standard_temp is not actually used? cant find any traces in any of your files

Potentially it isn’t, I have several different hot tub packages.
Lay-Z-Spa, Bestway (Lay-Z-Spa new app).
CleverSpa - unused, but someone else made it.
Balboa Spa - my current hot tub.

It’s possibly used in one of them.

1 Like

doesnt look too bad - apart from the heating weekly not seeming to work properly…

2 Likes