Skip to content

Instantly share code, notes, and snippets.

@devbobo
Last active December 6, 2023 05:11
Show Gist options
  • Save devbobo/b82134291d96f384137e01f39a7f2a01 to your computer and use it in GitHub Desktop.
Save devbobo/b82134291d96f384137e01f39a7f2a01 to your computer and use it in GitHub Desktop.

SpaNet API and Client Socket

1. Logging into SpaNet

POST https://api.spanet.net.au/api/MemberLogin

Request:

{
    "login": [Username],
    "api_key": "4a483b9a-8f02-4e46-8bfa-0cf5732dbbd5",
    "password": [Password]
}

Response:

{
    "data": {
        "email": null,
        "id_member": [MemberId],
        "login": [Username],
        "name": null,
        "password": null,
        "notification_enabled": 1,
        "id_session": [SessionId]
    },
    "error": null,
    "error_code": null,
    "message": null,
    "success": true
}

2. Get Client Socket

GET https://api.spanet.net.au/api/membersockets?id_member=[MemberId]&id_session=[SessionId]

Response:

{
    "data": {
        "email": null,
        "id_member": 0,
        "login": null,
        "name": null,
        "password": null,
        "notification_enabled": 0,
        "id_session": null
    },
    "sockets": [{
        "id": [SocketId],
        "active": "1",
        "id_member": [MemberId],
        "id_sockets": [SocketId],
        "mac_addr": [MacAddress],
        "moburl": [WebSocketUrl]:9090,
        "name": [SpaName],
        "spaurl": [WebSocketUrl]:9090,
        "signalStrength": -69,
        "error": false
    }],
    "error": null,
    "error_code": null,
    "message": "",
    "success": true
}

3. Connect Client Socket

Open TCP Socket to [WebUrl] port 9090, then send..

Request:

<connect--[SocketId]--[MemberId]>

Response:

Successfully connected

4. Status

Get the current status of the spa.

Request:

RF\n

Sample Response:

RF:
,R2,18,250,51,70,4,13,50,55,19,6,2020,376,9999,1,0,490,207,34,6000,602,23,20,0,0,0,0,44,35,45,:
,R3,32,1,4,4,4,SW V5 17 05 31,SV3,18480001,20000826,1,0,0,0,0,0,NA,7,0,470,Filtering,4,0,7,7,0,0,:
,R4,NORM,0,0,0,1,0,3547,4,20,4500,7413,567,1686,0,8388608,0,0,5,0,98,0,10084,4,80,100,0,0,4,:
,R5,0,1,0,1,0,0,0,0,0,0,1,0,1,0,376,0,3,4,0,0,0,0,0,1,2,6,:
,R6,1,5,0,2,5,8,1,360,1,0,3584,5120,127,128,5632,5632,2304,1792,0,30,0,0,0,0,2,3,0,:
,R7,2304,0,1,1,1,0,1,0,0,0,253,191,253,240,483,125,77,1,0,0,0,23,200,1,0,1,31,32,35,100,5,:
,R9,F1,255,0,0,0,0,0,0,0,0,0,0,:
,RA,F2,0,0,0,0,0,0,255,0,0,0,0,:
,RB,F3,0,0,0,0,0,0,0,0,0,0,0,:
,RC,0,1,1,0,0,0,0,0,0,2,0,0,1,0,:
,RE,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,-4,13,30,8,5,1,0,0,0,0,0,:*
,RG,1,1,1,1,1,1,1-1-014,1-1-01,1-1-01,0-,0-,0,:*

5. Commands

5.1 Spa

Temperature

Set the target temperature for the spa.

Request:

W40:nnn

Response:

nnn

where nnn denotes temperature in celsius * 10 between 5.0-41.0c (ie: for 35.6c, nnn = 356)

Clean/Santise

Start (or cancel) a Clean cycle.

Request:

W12

Response:

W12

5.2 Pumps

Pump 1

Control Pump 1.

Request:

S22:n

Response:

S22-OK

where n denotes

  • 0 - Off
  • 1 - On
  • 4 - Auto
Pump 2

Control Pump 2.

Request:

S23:n

Response:

S23-OK

where n denotes

  • 0 - Off
  • 1 - On
Pump 3

Control Pump 3.

Request:

S24:n

Response:

S24-OK

where n denotes

  • 0 - Off
  • 1 - On

5.3 Blower

Blower

Control the Blower.

Request:

S28:n

Response:

S28-OK

where n denotes

  • 0 - Variable
  • 1 - Ramp
  • 2 - Off
Blower Variable Speed

Set the variable speed of the blower.

Request:

S13:n

Response:

n  S13

where n denotes speed 1-5

5.4 Lights

TODO

5.5 Settings

5.5.1 Operation Mode

Set the Operation mode.

Request:

W66:n

Response:

n

where n denotes

  • 0 - Norm
  • 1 - Econ
  • 2 - Away
  • 3 - Week
5.5.2 Filtration
Filtration Runtime

Set the filtration runtime.

Request:

W60:n

Response:

n

where n denotes hours between 1-24.

Time Between Filtration Cycles

Set the time between filtration cycles.

Request:

W90:n

Response:

n

where n denotes hours as

  • 1 - 1 hr
  • 2 - 2 hr
  • 3 - 3 hr
  • 4 - 4 hr
  • 6 - 6 hr
  • 8 - 8 hr
  • 12 - 12 hr
  • 24 - 24 hr
5.5.3 Sleep Timers

TODO

5.5.4 Power Save

Set the Power Save option.

Request:

W63:n

Response:

n

where n denotes

  • 0 - Off
  • 1 - Low
  • 2 - High
5.5.5 Auto Santise

TODO

5.5.6 Time Out Mode

TODO

5.5.7 Heat Pump Mode

TODO

5.5.8 Set Time/Date

TODO

5.5.9 Support Mode

TODO

5.5.10 Lock Mode

Set the Lock Mode.

Request:

S21:n

Response:

n

where n denotes

  • 0 - Off
  • 1 - Partial
  • 2 - Full
5.5.11 Notification

TODO

@spudooli
Copy link

spudooli commented May 2, 2022

@JonathanGiles I ordered 5 PCBs of @shanekuz's design, I can mail you one. Also have the power bucks in stock too if needed. Will join your discord to get an address

@spammenotinoz
Copy link

Hi Blake, can you please advise how to obtain the API key? I didn't see anything obvious, assume I may need to inspect the traffic.
Not as smart as you guys, so really just thinking of a basic Python script to change the spa into away mode when Solar generation is low.
Just had a massive power bill, after someone (myself) left the temp set way to high during winter...:)
I am now better using the "sleep mode" to avoid heating at night.

@JohanAlvedal
Copy link

Hi This is an embarrassing question but how do you program this into an esp?

@shanekuz
Copy link

shanekuz commented Aug 6, 2023

I use the arduino application

@JohanAlvedal
Copy link

Excuse my ignorance but I have it but don't really know how to do it as it can only open .ino files and I can't find any.

@shanekuz
Copy link

shanekuz commented Aug 8, 2023

I use VSS but if you google change from VSS to Arduino its pretty much just a file name change to .ino i think.

@JohanAlvedal
Copy link

ok so you mean i can basically rename master.cpp to .ino?

@shanekuz
Copy link

shanekuz commented Aug 8, 2023

Yes I think so, give it a go

@JohanAlvedal
Copy link

Hi Tried but it's too hard for me as I get loads of errors all the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment