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

Hi,
I just both a pool and I’m using Bestway app. I don’t like it. :slight_smile: But I’m beginner at HA, so I need some help.

I would like to have all the files BruceH5200 made in one map “packages/pool” (I already have a map package/carheater).

What code do I need to add in configuration?
I have:

Homeassistant:
  Packages: !include_dir_named_packes

I use “secrets” also. What do I need to start adding there?

Thanks a lot!

You have a mix of folder names. packages, package and packes? Not sure if those are correct or typos.

If you have package/carheater set up and working then I think you can put your spa files in package/pool

And you should already have this in your configuration.yaml

homeassistant:
 packages: !include_dir_named package

In secrets you should put your api did and token and email address / password you use with the official app. The details are a few posts up the thread.

Thanks Patrocks, I was typing on the phone so I did not se that it was spelled wrong. All are like you wright.
I will add the other.
Thanks agin, Maria

I have been reading all the text a lot of time, but I dont understand the start. I guess that DID and API token is my own and not the same for everyone?
I downloaded Fiddler Everywhere on my computer, but after that, what to do? Im using Bestway app on iphone, in Sweden.

Hey,

I’ve been trying all day to get my uid and did, with no luck. No matter what I do i get form_invalid as response from the server.

I tried the initial_login sensor from Bruce’s github, where the entity card just shows up empty. I tried using both euapi and usapi in here, but nothing shows up.
I also tried in both curl and postman, both with eu and us api, with “@” and “%40” in emain, but nothing works.
My original account was for Norway, so I tried to make another one for UK, as i saw someone had problems with Finland account, but this did not change anything either, still I get form_invalid response.
I also tried packet sniffing on my iPhone, where it would not log in while i was sniffing, but I could read packets when I tried to turn on or off heating for example. In the request payload I did find uid and did, tried to set these values in secrets.yaml, but they did not seem to work either.
I also tried using both Android and iOS app secret in the headers, with no luck.

By the way I am using Bestway app.

Does someone have any idea what I might be doing wrong?

Thanks

It’s probably worth noting that the token will expire every six months and you’ll need to re-run the process to get one and update your secrets file/scripts.

This is a silent failure, HA will continue to update anything you are monitoring on the tub (temp, power, filter etc) but you will not be able to control any of them. This will show up in HA logs as a 400 error when calling the gizwits URL, so you might want to put some alerting in (or at least a date in your Calendar) to note that this is what is happening.

4 Likes

Hello, why HotTub Heating This Week is always 0 ?
and why HotTube Water temp is 0 ?
what did I do wrong ?
Overview-Home-Assistant (1)

Thank you for posting, I realised this happened to me a few days ago was just starting to mess around with config thinking it was a hassio update causing the issue.

All sorted now, cheers.

Hello,

I haven’t been able to make any changes to the hot tub for a few days.

The Bestway app works without any problems and also the status in the home assistant (temperature, status, whether the filter is on / off, …)

But if I want to switch the filter off manually via the home assistant, it jumps back on after a few seconds. Even the automations (every 30m) no longer work as a result …

Anyone have any idea how i can fix this?

Edit:
fixed: i have a New token … must renew them in the Secrets.

Hi,
I have a Lay-Z-Spa Milan about to be delivered. I’m hoping to integrate it with my HA setup. I’ve noticed that there are options for either the Lay-Z-Spa app or the Bestway app but once you are registered to one you cannot change.

My question is for the best functionality in HA which app should I register my hot tub with - Lay-Z-Spa or Bestway? (I’m in the UK if that makes a difference)

Many Thanks

I started with the La-Z-Spa app, then tried the Bestway App and couldn’t go back.
I think the BestWay app is the newer app.

You can automate either with Home Assistant, so it probably doesn’t matter that much.

2 Likes

Hi, I found hottub_online. But got the message that I don’t have any unique ID.

I have add in sensor.yaml:

##
  - platform: rest
    name: hottub_online
    resource: "https://mobileapi.lay-z-spa.co.uk/v1/gizwits/is_online"
    headers:
      Content-Type: application/x-www-form-urlencoded
    method: POST
    payload: !secret hottub_api_did
    value_template: "{{ value_json.data }}"
#####

And in secrets.yaml

hottub_api_did: did=AAaAaAAAAAAaaaaAAA9A9b&api_token=a1a1a1a1a2a2a2a2a12a1a1a1a2a2a2a2
#
hotstub_email_password: email=XXX%40gmail.com&password=XXX
# 

(XXX change to my email and password)

If I don’t have “hottub_api_did:…” I got wrong message. But it is the one I found here, not my own.

Thanks for help,
Maria

Thanks for your work, just implemented my Spa!

How can I adjust the target temperature? Its just a simple “Number” for me which I can’t change from GUI. Any hint?

Hi,
When I add the sensor part in configuration.yaml or in sensor.yaml I got " This entity does not have a unique ID". I change to my username and my password. I have not change anything els.

My acount is in Sweden, is it becuse of that?
Thanks.

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