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

Not yet. I need to try that! Have a example how i should put this in to postman?

I’m not at a computer right now.
I’ll post something tomorrow.

Got it working. i needed to use fiddler to find my application-id first, then i needed to also create new account as i was getting incorrect user/pass messages with postman. could be because my previous account was made for finland, altought i tried to use on login lang: “fi” but it didnt work. i made new account to uk so now it worked.

Fantastic thread!

I unfortunately bought the wrong hot tub and have a clever spa!

Hoping I can adapt what is here to make it integrate with home assistant, ideally via MQTT.

Best get started with Fiddler!

Does the Clever Spa have a wifi controlled pump / heater ?
If it does, then there is a reasonable chance that the control will be similar.

What application ID did you get?
What app are you running on what type of phone.
The App ID should be the same for everyone on a particular device type I think.

Ios. AppID is same as here before but for some reason it didnt accept my login which was create for finland even that i changed language to “fi” so i create New account, chose location to be uk and then i got it working.

It does indeed!

Is it a case of cracking out fiddler first and seeing what goes on when I change things on the phone app.

I’ve approached clever spa for the API and they say they won’t publish it!

Yes, put some kind of ssl proxy between your phone and the web and see what kind of calls it is making when you press the buttons in the App.

Managed to get the status to report by modifying the json attributes straight from your code.

Pretty simple really as it uses the same Gizwits platform so once i’d worked out all the different app id/did it was simple!

Code below for reference

sensor:
  - platform: rest
    name: hottub_status
    resource: "https://api.gizwits.com/app/devdata/***my did***/latest"  
    # xxxxxxxxxxxx is the did from the bindings sensor
    headers:
      Content-Type: application/json
      X-Gizwits-Application-Id: 805cc6a3f41b48aeae471e2fcb6ebc73
    method: GET
    value_template: "{% if value_json.attr.Temperature_setup > 0%}online{% else %}offline{%endif%}"    
    json_attributes_path: "$.attr"
    json_attributes:
      - Heater
      - 03
      - Undercooling
      - Current_temperature
      - Filter
      - Temperature_setup
      - Superheat

The process to get the app id and did was slightly different.

It requested from a google server?

great, have you found the controls to switch it on / off etc. I’d be interested in the code to put into my github for completeness.

I’ve got the fiddler bits of code sorted. Just need to transpose over to your list of code.

I quickly tried the POST bit of code and it didn’t seem to work, but I was rushing and ran out of time!

Once I’ve got it all going I’ll do a code dump!

Might need a bit of 1-1 if I get stuck!

Thanks again!

Ahh! Less haste, more speed!

I’d not changed the control Api URL fully! I’d only edited the did!

Got the POST bit working and the heater switch, so I assume my thinking is now correct and i’ll add all the other bits!

rest_command:
  hottub_command: 
    method: POST
    headers:
      content_type: "application/json"
      X-Gizwits-Application-Id: "805cc6a3f41b48aeae471e2fcb6ebc73"
      X-Gizwits-User-token: *My Token*
    url: "https://api.gizwits.com/app/control/*my did*"    
    payload: "{{hottub_command}}"
switch:
  - platform: template
    switches:
      hottub_heat:
        availability_template: "{{ states('binary_sensor.hottub_online') }}"
        unique_id: Heater
        friendly_name: Heater      
        value_template: "{% if state_attr('sensor.hottub_status', 'Heater') == 1 %}on{% else %}off{% endif %}"
        turn_on:
          - service: rest_command.hottub_command
            data_template: 
              hottub_command: >
                {"attrs": {"Heater": 1} }   
          - delay: 00:00:05
          - service: homeassistant.update_entity
            entity_id: sensor.hottub_status
        turn_off:
          - service: rest_command.hottub_command
            data_template: 
              hottub_command: >
                {"attrs": {"Heater": 0} }   
          - delay: 00:00:05
          - service: homeassistant.update_entity
            entity_id: sensor.hottub_status
1 Like

Bruce, why disabled all of your yaml file on github?

I don’t have that hot tub any more. I’ve got a new one.
I’ve left the files there in case anyone needs them but I don’t use them anymore.

Ohh, I see. I was little bit shocked that your solution is not working anymore because my new hot tube is on the way and I want to integrate to my HA via your solution :slight_smile:

I hope that will be work.

Do you have step by step solution how can I integrate it?

The code on @BruceH5200’s github works fine (it is working with my hot tub right now).

Bruce has simply moved to a new hot tub brand which uses different software and APIs (hope it’s lovely Bruce!) and will be sorely missed when we next need something done :slight_smile:

As for step-by-step: There isn’t anything I’m aware of and it would take a while take a while to put together. I’ve promised many things on here that I’ve not delivered so I won’t promise now but I can assure you if you take your time and research what your trying to do this will likely work for you.

Give it a go and come back here with any questions. To get you started this post (#67 in this thread) should help: Lay-Z-Spa Hot Tub wi-fi pump automation

2 Likes

Thank you! For me it’s not clear how can I get the token from gizwits.

Same here. How do I get the token?

1 Like

Use the login script that is in the folder.
Then check the state and attributes of the HotTub_login entity. You should find the tokens you need.