TapHome
Community Beta Sensors

MSpa Mono Eco

Community template for the MSpa Mono Eco (F-MO062WE) inflatable hot tub, connected through the MSpa cloud over signed HTTPS requests. Needs TapHome Core 2026.1.40991 or later (TapHome Next channel) and an MSpa Link account bound to the spa over 2.4 GHz Wi-Fi; the password can be entered as is. Water temperature thermostat, heater, filtration, three-level bubbles, UVC sanitizer, heating rate, time to heat, filter life, fault alert, safety lock and online status, plus estimated power and energy.

Packet Parser → HTTP24 devicesRevision 1.5 Last updated: November 25, 2026

Submitted by Tomáš Ďurkech

MSpa Mono Eco

Import into the TapHome appHardware › Packet Parser › Add from template

Download Template
On this page

Integration guide

The MSpa Mono Eco (model F-MO062WE) is a round inflatable hot tub of the MSpa FRAME series for up to 6 persons (930 L). Its external control box contains a 2200 W heater, a three-level air bubble blower, a filter pump and a UVC sanitizer, and connects over 2.4 GHz Wi-Fi to the MSpa cloud, which the MSpa Link mobile app uses for remote control.

This community template connects TapHome to the same MSpa cloud over HTTPS (api.iot.the-mspa.com, port 443). There is no local connection between the TapHome Control Unit and the spa: the template logs in at /api/enduser/get_token/, reads the spa state from /api/device/thing_shadow/ every 15 seconds and sends changes to /api/device/command. Every request is signed with an MD5 signature built from a random nonce and a timestamp. It is not an official MSpa integration.

1
[Spa control box] --2.4 GHz Wi-Fi--> [router] --internet--> [MSpa cloud] <--HTTPS 443-- [TapHome Control Unit]
Hardware connection

The spa is not wired to TapHome. The only electrical connection is the mains supply of the control box:

  • Plug the spa directly into a grounded (earthed) socket. The MSpa manual forbids extension cords, timers, plug adaptors and converter plugs in the supply, so the spa is controlled through the cloud only, not by switching its power.
  • Use the spa only with the RCD (residual current device) on its power cord, rated residual operating current not exceeding 30 mA. Test the RCD before each use: press RESET (the indicator turns red), press TEST (the red indicator must disappear), then press RESET again.
  • After power-up and RCD reset, the LED display shows the current water temperature.
All-in-one control panel of the MSpa Mono Eco: LED display, Heater, Filter, Bubble, Timer, UVC buttons, Up and Down buttons, safety lock.
Configuration

The template needs TapHome Core version 2026.1.40991 or later, available in the TapHome Next channel. The request signature uses script functions (HASH, RANDBYTES) that earlier Core versions do not have.

Network requirements
  • The control box supports 2.4 GHz Wi-Fi only (2412–2472 MHz). Do not use a network with the _5G suffix; if the router does not show a 2.4 GHz network, enable it in the router settings.
  • Set the router security to WPA2. The MSpa Link app may reject a network whose SSID contains special (non-alphanumeric) characters.
  • Keep the spa, the router and the phone used for pairing as close to each other as possible for a strong Wi-Fi signal.
  • The spa and the TapHome Control Unit do not have to be in the same local network, but the Control Unit needs internet access (outgoing HTTPS, port 443) to api.iot.the-mspa.com.
  • api.iot.the-mspa.com is the MSpa cloud for Europe and the rest of the world. Spas registered in the US and Canada region (api.usiot.the-mspa.com) or in the China region use a different cloud address than the one set in the template.

The spa must first be bound to an account in the MSpa Link app (iOS 9.0 or later, Android 7.0 or later; search for “MSpa Link” in the app store).

MSpa Link app, getting ready: 2.4 GHz Wi-Fi check and account sign-up screens (email, verification code, password).
  1. Open the app and tap Sign Up. Do not continue as Visitor — TapHome needs the email address and password of a registered account.
  2. Select your country and enter your email address.
  3. Enter the verification code from the email (valid for 15 minutes; it can be resent after 60 seconds).
  4. Set a password of 6–15 letters or numbers.
Binding the spa to the account
  1. Make sure the spa is turned on and the phone is connected to the 2.4 GHz Wi-Fi network with Bluetooth on.
  2. In the app, tap ADD DEVICE and choose the controller type (CONTROL BOX).
  3. Long-press the UP button on the control box until the Wi-Fi icon starts to flash, then tap CONFIRM.
  4. Enter the password of the Wi-Fi network.
  5. Choose the found spa (MSPA MONO); this step needs Bluetooth authorization.
  6. Wait until the binding process is completed.
MSpa Link app, binding the spa: Add Device, choose Control Box, long-press UP button until the Wi-Fi icon flashes, enter 2.4 GHz Wi-Fi password.

To unbind the spa, press the HEATER and TIMER buttons at the same time.

One spa can be paired with only one main user at a time. If another account pairs the spa, the previous user is disconnected from it. Do not pair the spa a second time from the account intended for TapHome.

Account used by TapHome

The MSpa cloud keeps one valid login token per account — a new login with the same account invalidates the previous one. When TapHome and the MSpa Link app use the same account, they log each other out: the template logs in again automatically at the next read, but the TapHome connection is interrupted briefly every time the app logs in. Use a separate guest account with its own email address and password for TapHome; registered MSpa Link users can share the spa with other users.

Import parameters

The template asks for four parameters when it is imported:

ParameterMeaningHow to fill in
EmailEmail address of the MSpa Link account used by TapHomeThe address used at sign-up
PasswordPassword of the account, readable or as its MD5 hashA 32-character value is taken as the MD5 hash; any other value is taken as the readable password and the template computes its MD5 hash itself
DeviceIdIdentifier of the spa in the MSpa cloud (optional)Leave empty to use the first spa in the account; fill in only when the account has several spas (see Several spas in one account)
ProductIdIdentifier of the spa product in the MSpa cloud (optional)Leave empty; when it is empty, the template takes it from the first spa in the device list of the account, also when DeviceId is filled in

The parameters are stored in module variables of the same names, where they can be changed later; after changing Email or Password, run the module service action Log in again. After a failed login, the template waits 5 minutes before it tries to log in again, so that repeated attempts with a wrong password do not burden the account; Log in again does not shorten this wait. After the first successful read, the module service attributes Device ID and Product ID show the identifiers of the spa in use.

Password as MD5 hash (optional)

If you do not want the readable password stored in TapHome, enter its MD5 hash in Password instead — 32 characters, lowercase hexadecimal, as the commands below print it:

1
2
3
4
5
6
# Windows (PowerShell)
$p = "YourPassword"
-join ([Security.Cryptography.MD5]::Create().ComputeHash([Text.Encoding]::UTF8.GetBytes($p)) | % { $_.ToString("x2") })

# Linux
printf '%s' 'YourPassword' | md5sum

Use printf, not echo: echo adds a newline to the end of the password, the hash is then different and the login fails with the wrong-password code 16019. Do not use online MD5 generators — they would receive the password.

In TapHome, import the template on the Control Unit, fill in Email and Password in the import dialog and leave DeviceId and ProductId empty unless the account has several spas.

Device capabilities

The template reads the spa state every 15 seconds. The cloud confirms a change only a few seconds after a command, so for 30 seconds after a command TapHome keeps the new value and ignores older values read from the cloud. A command that the cloud does not accept raises an error on the device with the cloud response.

While the spa reports a fault (device Fault), the template does not switch on Heater, Filtration, Bubbles, UVC sterilization or Jets and does not switch Temperature unit to °F: the command ends with an error naming the fault code, and the device can be switched on only after the fault is cleared on the control box. Switching off works during a fault.

When the spa is switched off or offline, the template keeps the state reported by the cloud: Online status shows the connection state from the cloud, values the spa does not send stay empty, Power is 0 and the module shows a warning that the spa did not send the water temperature. The login is kept; the template logs in again only when the cloud reports the login token as no longer valid (code 10001).

Water temperature and heating
  • Water temperature (thermostat) — shows the current water temperature and sets the target temperature in the range 20–40 °C. The cloud transfers temperatures in half-degree steps (value × 2), the template converts them to °C.
  • Water temperature sensor — read-only current water temperature.
  • Heater — switches heating on and off. Without water flow the spa refuses heating, so when filtration is off, switching the heater on first switches on filtration and checks after 4 and again after 10 seconds that the cloud reports the filter pump running; only then is the heater switched on. When the pump is not confirmed, the heater stays off and the device shows an error that the pump did not start.
  • Heating state — heating phase reported by the spa: 0 = off, 2 = preheating, 3 = heating, 4 = heated (keeping the temperature).
  • Heating rate (°C/h) — the heating rate the template uses for its estimates. While the water is heating, it is the rate measured since the heating started, available after 60 minutes of heating; measurements below 0.2 or above 6 °C per hour (for example after refilling water) are ignored. Otherwise it is the learned rate: after each heating, the measured rate is added to the learned rate as a weighted average (60 % previous value, 40 % new measurement). Until a rate is learned, the heating rate reported by the spa is used (cloud value device_heat_perhour in tenths of °C per hour, limited to 0.5–2.0 °C per hour); when the spa does not report it, the module variable HeatRate is used (default 1.8 °C per hour). The template counts the water as heating when the heater is on and the spa reports the heating state 3 (heating); when the spa does not report the heating state, it counts the water as heating when the heater is on and the water temperature is below the target. A gap of more than 10 minutes between reads ends the measurement.
  • Time to heat (min) — estimated minutes until the water reaches the target temperature, calculated from the temperature difference and the heating rate shown by Heating rate. Zero when the heater is off or the target is reached.
  • Heated by — time of day at which the water is expected to reach the target temperature, calculated in the same way as Time to heat and shown as a time (for example 18:45); when the heating ends after midnight, the time refers to the next day. No value when the heater is off or the target is reached.
  • Heating time (h) — heater timer of the control box: hours remaining until the heating switches on (1–99 h), read-only value heat_time from the cloud.
  • Heating time switch — read-only state of the heater timer: 1 = timer on, 0 = timer off.
Filtration and water care
  • Filtration — switches the filter pump on and off. Switching filtration off also switches the heater off.
  • UVC sterilization — switches the UVC sanitizer on and off. It does not switch filtration on; when filtration is running and the heater is off, the command also confirms filtration, so that the spa does not stop the filter pump when UVC is switched.
  • Filter remaining and Filter usage — remaining filter life and filter operating hours, in hours.
  • Replace filter — read-only contact with the states OK and Clean/replace; it switches to Clean/replace when the spa reports the warning A0 (clean or replace the filter cartridge).
Massage
  • Bubbles — multi-value switch with the states Off, Low, Medium and High; level and on/off state are sent in one command. Levels above 3 are sent and shown as High; when the spa reports the bubbles on without a level, the switch shows Medium. According to MSpa, the blower draws 300 W, 500 W or 720 W depending on the level and switches off automatically after 20 minutes of operation.
  • Jets — switch for MSpa models with hydro jets. The Mono Eco control panel has no jet function; the device can be deleted after import.

MSpa warns not to turn on the bubble massage while the cover is attached — air can accumulate inside the spa and cause damage and injury. Keep this in mind for remote control and automations that switch the bubbles.

Status and settings
  • Online status — Online or Offline connection of the spa to the MSpa cloud, read-only.
  • Fault — read-only contact with the states OK and Fault; it switches to Fault when the spa reports a fault code. The code and its meaning are shown in the module service attribute error code (see Fault codes of the spa).
  • Safety lock — state of the control panel lock (Locked / Unlocked), read-only in TapHome.
  • Temperature unit — switches the unit used by the spa between °C and °F.
  • Auto-inflate — read-only auto-inflation value reported by the spa.
  • Wi-Fi firmware version — firmware version of the spa Wi-Fi module.
  • Module service attributes: error code with its meaning (no error, or the code with a short description), warning (none, or the code; A0 = clean or replace the filter), heating state, learned heating rate (°C/h, “not yet” until the first heating has been measured), filter remaining (h), filter usage (h), MCU firmware, Device ID, Product ID and logged in (yes / no).
  • Module service actions: Log in again clears the login token, the template logs in at the next read; Reset consumption sets the energy estimate to zero; Forget heating rate clears the learned heating rate, which is learned again at the next heating.
Power and energy estimate

The template does not measure electricity. Power (W) is an estimate calculated at each read from the states of filtration, the bubble level and heating and from nominal values stored in module variables:

VariableDefaultAdded when
PumpW60 Wfiltration is on
BubbleL1W300 Wbubbles are on at level Low
BubbleL2W500 Wbubbles are on at level Medium, or the spa does not report the level
BubbleL3W720 Wbubbles are on at level High
HeaterPreheatW1500 Wheater is on and the spa reports the heating state 2 (preheating)
HeaterHeatW2200 Wheater is on and the spa reports the heating state 3 (heating); when the spa does not report the heating state, heater is on and the water temperature is below the target

Energy (kWh) adds up the power estimate over time in the module variable kWhTotal; gaps between reads longer than 10 minutes are not counted. It is not a meter reading; the module service action Reset consumption sets it to zero.

The MSpa manual lists for the Mono Eco a heater of 2200 W, a bubble blower of 300 / 500 / 720 W per level and a rated power of 2300 W. The defaults of HeaterHeatW and BubbleL1W–BubbleL3W follow these values.

Troubleshooting
The app does not find the spa during binding
  • Check that Bluetooth is on and the MSpa Link app is allowed to use it.
  • If the previous steps took too long, the spa may have left the pairing mode. Stay on the search page and long-press the UP button on the control box again.
Binding fails
  • Failure to connect the device — usually a weak signal; move the phone, the spa and the router closer together.
  • Failure to connect the device to the Wi-Fi network — check the Wi-Fi password and set the router security to WPA2; use a 2.4 GHz network.
  • Failure to bind the device to the account — make sure the Wi-Fi network is stable and try again.
Error messages of the module

The module error text contains the response of the MSpa cloud. Codes in the login response:

CodeMeaning
16019Wrong password — check Password, or the MD5 hash if you entered one
16025The account does not exist — check Email
403The request signature was rejected — check that the Core version is 2026.1.40991 or later
11000Too many requests — the template tries again after 5 minutes

After any failed login, the module shows an error and the template waits 5 minutes before the next login attempt; correct Email or Password in the meantime. When a state read is rejected with code 10001, the login token is no longer valid (usually after a login with the same account in the MSpa Link app) and the template logs in again at the next read; code 11000 in a state read keeps the login and the template tries again at the next read.

A command sent right after import, before the first module read has logged in, ends with an error; repeat it after the first read.

A command that switches a device on while the spa reports a fault ends with an error naming the fault code; clear the fault on the control box first (see Fault codes of the spa). When Heater ends with the error that the pump did not start, the cloud did not report the filter pump running within 10 seconds and the heater stays off; check Filtration and switch the heater on again.

Fault codes of the spa

The module service attribute error code and the device Fault show the fault reported by the spa. The template adds these descriptions to the code:

CodeMeaning
F0Water below 0 °C or above 50 °C, or a fault of the temperature sensor
F1Water flow — fill water above the MIN mark, clean the filter and the hoses; if F1 appears right after power-on, contact MSpa service
EEP, 888Communication of the control box (loose cable)

For other codes, see the MSpa manual or contact MSpa service.

No values in TapHome
  • Check that the TapHome Core version is 2026.1.40991 or later.
  • Check Email and Password in the module variables and read the module error text (see Error messages of the module).
  • If the module error text shows an empty device list, the spa is not bound to the account used by TapHome or shared with it.
  • If the account has several spas, check DeviceId and ProductId (see Several spas in one account).
  • Check that the spa is registered in the Europe / rest of world region of the MSpa cloud.
  • Check Online status and the Wi-Fi connection of the spa. If the module warns that the spa did not send the water temperature, the spa is switched off or offline.
TapHome connection drops while the app is in use

The app and TapHome are logged in with the same account and invalidate each other’s login. The template logs in again at the next read, so TapHome recovers after a short interruption, but the app and TapHome keep logging each other out. Use a separate account for TapHome (see Account used by TapHome).

Several spas in one account

With DeviceId empty, the template uses the first spa in the account. To use another spa, fill in its DeviceId (field device_id in the device list of the account). The template keeps a filled-in DeviceId, but with ProductId empty it takes ProductId from the first spa in the device list, not from the spa with the filled-in DeviceId. When the spas in the account have different product_id values, fill in ProductId of the selected spa too (field product_id).

Water heats slowly or the temperature differs

According to MSpa, heating is slower at an ambient temperature below 10 °C, at wind speeds above 3.5–5.4 m/s, with the bubbles running during heating, or without the cover properly in place. The displayed water temperature may differ from the actual one by about 1 °C.

Available devices 24

These devices appear in TapHome after import.

MSpa Mono Eco Module
Service Attributes
Chybový kód
Upozornenie
Stav ohrevu
Naučená rýchlosť ohrevu (°C/h)
Zostatok filtra (h)
Využitie filtra (h)
Firmvér MCU
Device ID
Product ID
Prihlásené
Service Actions
Prihlásiť znova
Vynulovať spotrebu
Zabudnúť rýchlosť ohrevu
Custom Variables
Email (string)
Password (string)
DeviceId (string)
ProductId (string)
AppId (string) = e1c8e068f9ca11eba4dc0242ac120002
AppSecret (string) = 87025c9ecd18906d27225fe79cb68349
Token (string)
LoginFailTs (numeric)
status (string) = {}
HeatRate (numeric) = 1.8
PumpW (numeric) = 60
BubbleL1W (numeric) = 300
BubbleL2W (numeric) = 500
BubbleL3W (numeric) = 720
HeaterPreheatW (numeric) = 1500
HeaterHeatW (numeric) = 2200
PowerW (numeric)
kWhTotal (numeric)
LastTs (numeric)
HeatRateLearned (numeric)
HeatStartTs (numeric)
HeatStartWt (numeric)
HeatSessionRate (numeric)

MSpa Mono Eco

Read (module)
# MSpa cloud: 1) prihlásenie  2) zariadenie  3) stav do premennej status  5) odhad príkonu a spotreby  6) naučená rýchlosť ohrevu
# Podpis každej požiadavky: sign = MD5("AppId,AppSecret,nonce,ts") veľkými písmenami, ts = Unix sekundy, nonce = 32 hex znakov.
datetime n;
string ts;
string nonce;
string podpis;
string hesloMd5;
string telo;

IF LENGTH(Email) = 0 OR LENGTH(Password) = 0
  ADDERROR("MSpa: vyplň Email a Password v premenných modulu");
  RETURN(NaN);
END

# ---- 1) prihlásenie, keď nie je token ----
IF LENGTH(Token) = 0
  n := NOW();
  # po neúspešnom prihlásení (zlé heslo, podpis) počkať 5 min, aby MSpa účet nezablokovalo
  IF LoginFailTs > 0 AND 300 > n.UNIXTIME - LoginFailTs
    ADDERROR("MSpa: prihlásenie zlyhalo, ďalší pokus o pár minút (skontroluj Email a Password)");
    RETURN(NaN);
  END
  # MSpa heslo má 6–15 znakov, takže 32 znakov = už je to MD5
  hesloMd5 := Password;
  IF LENGTH(Password) != 32
    hesloMd5 := TOHEX(HASH(TOBYTES(Password, "utf-8"), "MD5"));
  END
  n := NOW();
  ts := TOSTRING(FLOOR(n.UNIXTIME), "F0");
  nonce := TOHEX(RANDBYTES(16));
  podpis := TOHEX(HASH(AppId + "," + AppSecret + "," + nonce + "," + ts, "MD5"));
  podpis := REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(podpis, "a", "A"), "b", "B"), "c", "C"), "d", "D"), "e", "E"), "f", "F");
  telo := "{\"account\":\"" + Email + "\",\"app_id\":\"" + AppId + "\",\"password\":\"" + hesloMd5 + "\",\"brand\":\"\",\"registration_id\":\"\",\"push_type\":\"android\",\"lan_code\":\"EN\",\"country\":\"\"}";
  VAR rLogin := SENDHTTPREQUEST("/api/enduser/get_token/", "POST", telo, "push_type: Android", "authorization: token", "appid: " + AppId, "nonce: " + nonce, "ts: " + ts, "lan_code: EN", "sign: " + podpis, "Content-Type: application/json; charset=UTF-8", "User-Agent: okhttp/4.9.0");
  VAR noveToken := PARSEJSON(rLogin.Content, "$.data.token", true);
  IF ISNULL(noveToken)
    # 16019 = zlé heslo, 16025 = účet neexistuje, 403 = podpis
    LoginFailTs := n.UNIXTIME;
    ADDERROR("MSpa prihlásenie: " + rLogin.Content);
    RETURN(NaN);
  END
  Token := noveToken;
  LoginFailTs := 0;
END

# ---- 2) zariadenie: prvá vírivka v účte, ak Device ID nie je zadané ----
IF LENGTH(DeviceId) = 0 OR LENGTH(ProductId) = 0
  n := NOW();
  ts := TOSTRING(FLOOR(n.UNIXTIME), "F0");
  nonce := TOHEX(RANDBYTES(16));
  podpis := TOHEX(HASH(AppId + "," + AppSecret + "," + nonce + "," + ts, "MD5"));
  podpis := REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(podpis, "a", "A"), "b", "B"), "c", "C"), "d", "D"), "e", "E"), "f", "F");
  VAR rList := SENDHTTPREQUEST("/api/enduser/devices/", "GET", "", "push_type: Android", "authorization: token " + Token, "appid: " + AppId, "nonce: " + nonce, "ts: " + ts, "lan_code: EN", "sign: " + podpis, "Content-Type: application/json; charset=UTF-8", "User-Agent: okhttp/4.9.0");
  # zadané Device ID sa nechá, inak prvá vírivka v účte
  VAR noveId := PARSEJSON(rList.Content, "$.data.list[0].device_id", true);
  IF ISNULL(noveId)
    # 10001 = token neplatí -> nové prihlásenie; prázdny zoznam = vírivka nie je v účte (nazdieľať ju)
    VAR kodList := PARSEJSON(rList.Content, "$.code", true);
    IF !ISNULL(kodList) AND TOSTRING(kodList) = "10001"
      Token := "";
    END
    ADDERROR("MSpa zoznam zariadení: " + rList.Content);
    RETURN(NaN);
  END
  VAR novePid := PARSEJSON(rList.Content, "$.data.list[0].product_id", true);
  IF LENGTH(DeviceId) = 0
    DeviceId := noveId;
  END
  IF !ISNULL(novePid)
    ProductId := novePid;
  END
END

# ---- 3) stav ----
n := NOW();
ts := TOSTRING(FLOOR(n.UNIXTIME), "F0");
nonce := TOHEX(RANDBYTES(16));
podpis := TOHEX(HASH(AppId + "," + AppSecret + "," + nonce + "," + ts, "MD5"));
podpis := REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(podpis, "a", "A"), "b", "B"), "c", "C"), "d", "D"), "e", "E"), "f", "F");
telo := "{\"device_id\":\"" + DeviceId + "\",\"product_id\":\"" + ProductId + "\"}";
VAR rStav := SENDHTTPREQUEST("/api/device/thing_shadow/", "POST", telo, "push_type: Android", "authorization: token " + Token, "appid: " + AppId, "nonce: " + nonce, "ts: " + ts, "lan_code: EN", "sign: " + podpis, "Content-Type: application/json; charset=UTF-8", "User-Agent: okhttp/4.9.0");
# 10001 = token neplatí (prihlásenie v appke s tým istým účtom) -> nové prihlásenie pri ďalšom čítaní
VAR kodStav := PARSEJSON(rStav.Content, "$.code", true);
IF !ISNULL(kodStav) AND TOSTRING(kodStav) = "10001"
  Token := "";
  ADDERROR("MSpa: token neplatí, prihlási sa znova");
  RETURN(NaN);
END
IF ISNULL(PARSEJSON(rStav.Content, "$.data", true))
  # chyba alebo 11000 (príliš rýchlo) – token sa nechá, skúsi sa pri ďalšom čítaní
  ADDERROR("MSpa stav: " + rStav.Content);
  RETURN(NaN);
END
# uložiť aj pri vypnutej vírivke (Online stav = Offline, chýbajúce hodnoty sú NaN)
status := rStav.Content;
IF ISNULL(PARSEJSON(status, "$.data.water_temperature", true))
  PowerW := 0;
  ADDWARNING("MSpa: vírivka neposlala teplotu (je vypnutá alebo offline?)");
  RETURN(NaN);
END

# ---- 4) hodnoty pre výpočty (chýbajúci kľúč = 0) ----
double filtr := 0;
double bubliny := 0;
# úroveň bublín: chýba = 2 (predvolená úroveň ovládača, 500 W)
double uroven := 2;
double ohrev := 0;
double wtC := PARSEJSON(status, "$.data.water_temperature", true) / 2;
double spC := wtC;
VAR x0 := PARSEJSON(status, "$.data.temperature_setting", true);
IF !ISNULL(x0)
  spC := x0 / 2;
END
VAR x1 := PARSEJSON(status, "$.data.filter_state", true);
IF !ISNULL(x1)
  filtr := x1;
END
VAR x2 := PARSEJSON(status, "$.data.bubble_state", true);
IF !ISNULL(x2)
  bubliny := x2;
END
VAR x3 := PARSEJSON(status, "$.data.bubble_level", true);
IF !ISNULL(x3) AND x3 >= 1
  uroven := x3;
END
VAR x4 := PARSEJSON(status, "$.data.heater_state", true);
IF !ISNULL(x4)
  ohrev := x4;
END
# fáza ohrevu (ako integrácia MSpa v HA): 2 = predohrev, 3 = ohrev, 4 = vykúrené/udržiava, 0 = vypnutý
double faza := -1;
VAR x5 := PARSEJSON(status, "$.data.heat_state", true);
IF !ISNULL(x5)
  faza := x5;
END
VAR teraz := n.UNIXTIME;
# medzera v čítaní dlhšia ako 10 min (výpadok) sa do spotreby ani do merania ohrevu nepočíta
VAR spojite := LastTs > 0 AND teraz > LastTs AND 600 > teraz - LastTs;
# špirála hreje: fáza 3 (ohrev); ak vírivka fázu neposiela, tak ohrev zapnutý a voda pod žiadanou teplotou
VAR kuri := (ohrev = 1) AND ((faza = 3) OR (faza = -1 AND spC > wtC));

# ---- 5) odhad príkonu (W) a spotreby (kWh) z nominálnych hodnôt v premenných modulu (manuál Mono Eco) ----
double p := 0;
IF filtr = 1
  p += PumpW;
END
IF bubliny = 1
  p += SWITCH(uroven, 1, BubbleL1W, 3, BubbleL3W, BubbleL2W);
END
IF kuri
  p += HeaterHeatW;
ELSEIF ohrev = 1 AND faza = 2
  p += HeaterPreheatW;
END
PowerW := p;
IF spojite
  kWhTotal += p * (teraz - LastTs) / 3600000;
END

# ---- 6) rýchlosť ohrevu (°C/h): počas ohrevu sa meria od jeho začiatku (HeatSessionRate, po 60 min),
#          po skončení ohrevu sa meranie pridá do naučenej rýchlosti (HeatRateLearned)
IF kuri AND spojite
  IF HeatStartTs = 0 OR HeatStartWt > wtC
    HeatStartTs := teraz;
    HeatStartWt := wtC;
    HeatSessionRate := 0;
  ELSEIF teraz - HeatStartTs >= 3600 AND wtC > HeatStartWt
    double namerane := (wtC - HeatStartWt) / ((teraz - HeatStartTs) / 3600);
    # nezmyselné merania (doliatie vody a pod.) sa ignorujú
    IF namerane >= 0.2 AND 6 >= namerane
      HeatSessionRate := namerane;
    END
  END
ELSE
  IF HeatSessionRate > 0
    HeatRateLearned := IF(HeatRateLearned > 0, HeatRateLearned * 0.6 + HeatSessionRate * 0.4, HeatSessionRate);
  END
  HeatStartTs := 0;
  HeatSessionRate := 0;
END
LastTs := teraz;
Service Attributes
Chybový kód
VAR f := PARSEJSON(status, "$.data.fault", true);
IF ISNULL(f)
  RETURN("");
END
VAR k := TOSTRING(f);
IF k = "" OR k = "0"
  RETURN("bez chyby");
END
RETURN(k + " – " + SWITCH(k, "F0", "voda pod 0 °C alebo nad 50 °C, alebo chyba snímača teploty", "F1", "prietok vody: doplň vodu nad MIN, vyčisti filter a hadice; hneď po zapnutí = servis MSpa", "EEP", "komunikácia ovládača (voľný kábel)", "888", "komunikácia ovládača (voľný kábel)", "pozri manuál / servis MSpa"));
Upozornenie
VAR w := PARSEJSON(status, "$.data.warning", true);
IF ISNULL(w) OR TOSTRING(w) = ""
  RETURN("žiadne");
END
RETURN(IF(INDEXOF(TOSTRING(w), "A0") >= 0, TOSTRING(w) + " – vyčistiť/vymeniť filter", TOSTRING(w)));
Stav ohrevu
PARSEJSON(status, "$.data.heat_state", true)
Naučená rýchlosť ohrevu (°C/h)
IF(HeatRateLearned > 0, TOSTRING(HeatRateLearned, "F1"), "zatiaľ nie")
Zostatok filtra (h)
PARSEJSON(status, "$.data.filter_life", true)
Využitie filtra (h)
PARSEJSON(status, "$.data.filter_current", true)
Firmvér MCU
PARSEJSON(status, "$.data.mcuversion", true)
Device ID
DeviceId
Product ID
ProductId
Prihlásené
IF(LENGTH(Token) > 0, "áno", "nie")
Service Actions
Prihlásiť znova
Token := "";
RETURN("Prihlási sa pri ďalšom čítaní");
Vynulovať spotrebu
kWhTotal := 0;
RETURN("OK");
Zabudnúť rýchlosť ohrevu
HeatRateLearned := 0;
HeatStartTs := 0;
RETURN("OK – znova sa naučí pri ďalšom ohreve");
Teplota vody Thermostat

Teplota vody

Read temperature
VAR v := PARSEJSON(status, "$.data.water_temperature", true);
IF ISNULL(v)
  RETURN(NaN);
END
RETURN(v / 2);
Read desired temperature
VAR v := PARSEJSON(status, "$.data.temperature_setting", true);
IF ISNULL(v)
  RETURN(NaN);
END
RETURN(v / 2);
Write desired temperature
# Príkaz do cloudu MSpa: posiela sa len to, čo sa mení
IF LENGTH(Token) = 0 OR LENGTH(DeviceId) = 0
  ADDERROR("MSpa ešte nie je prihlásená, počkaj na čítanie modulu");
  RETURN(NaN);
END
# MSpa berie teplotu v polstupňoch (°C × 2), rozsah 20–40 °C
VAR d := "{\"temperature_setting\":" + TOSTRING(ROUND(MAX(20, MIN(40, Se)) * 2), "F0") + "}";
datetime n;
string ts;
string nonce;
string podpis;
n := NOW();
ts := TOSTRING(FLOOR(n.UNIXTIME), "F0");
nonce := TOHEX(RANDBYTES(16));
podpis := TOHEX(HASH(AppId + "," + AppSecret + "," + nonce + "," + ts, "MD5"));
podpis := REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(podpis, "a", "A"), "b", "B"), "c", "C"), "d", "D"), "e", "E"), "f", "F");
VAR body := "{\"device_id\":\"" + DeviceId + "\",\"product_id\":\"" + ProductId + "\",\"desired\":\"" + REPLACE("{\"state\":{\"desired\":" + d + "}}", "\"", "\\\"") + "\"}";
VAR r := SENDHTTPREQUEST("/api/device/command", "POST", body, "push_type: Android", "authorization: token " + Token, "appid: " + AppId, "nonce: " + nonce, "ts: " + ts, "lan_code: EN", "sign: " + podpis, "Content-Type: application/json; charset=UTF-8", "User-Agent: okhttp/4.9.0");
VAR m := PARSEJSON(r.Content, "$.message", true);
IF ISNULL(m) OR m != "SUCCESS"
  ADDERROR("MSpa príkaz: " + r.Content);
  RETURN(NaN);
END
# cloud potvrdí zmenu až o pár sekúnd – dovtedy ignorovať staré čítané hodnoty
DEBOUNCE(Se, 30000);
Ohrev Switch
Values / States: ON · OFF

Ohrev

Read switch state
VAR v := PARSEJSON(status, "$.data.heater_state", true);
IF ISNULL(v)
  RETURN(NaN);
END
VAR t := TOSTRING(v);
RETURN(IF(t = "1" OR t = "true" OR t = "True", 1, 0));
Write switch state
# Zapnutie ohrevu: najprv čerpadlo a jeho potvrdenie (bez prietoku vírivka ohrev odmietne), potom ohrev
IF LENGTH(Token) = 0 OR LENGTH(DeviceId) = 0
  ADDERROR("MSpa ešte nie je prihlásená, počkaj na čítanie modulu");
  RETURN(NaN);
END
VAR porucha := PARSEJSON(status, "$.data.fault", true);
IF St > 0 AND !ISNULL(porucha) AND TOSTRING(porucha) != "" AND TOSTRING(porucha) != "0"
  ADDERROR("MSpa hlási poruchu " + TOSTRING(porucha) + " – zapnúť sa dá až po jej odstránení na ovládači");
  RETURN(NaN);
END
IF St > 0 AND TOSTRING(PARSEJSON(status, "$.data.filter_state", true)) != "1"
  VAR dF := "{\"filter_state\":1}";
  datetime nF;
  string tsF;
  string nonceF;
  string podpisF;
  nF := NOW();
  tsF := TOSTRING(FLOOR(nF.UNIXTIME), "F0");
  nonceF := TOHEX(RANDBYTES(16));
  podpisF := TOHEX(HASH(AppId + "," + AppSecret + "," + nonceF + "," + tsF, "MD5"));
  podpisF := REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(podpisF, "a", "A"), "b", "B"), "c", "C"), "d", "D"), "e", "E"), "f", "F");
  VAR bodyF := "{\"device_id\":\"" + DeviceId + "\",\"product_id\":\"" + ProductId + "\",\"desired\":\"" + REPLACE("{\"state\":{\"desired\":" + dF + "}}", "\"", "\\\"") + "\"}";
  VAR rF := SENDHTTPREQUEST("/api/device/command", "POST", bodyF, "push_type: Android", "authorization: token " + Token, "appid: " + AppId, "nonce: " + nonceF, "ts: " + tsF, "lan_code: EN", "sign: " + podpisF, "Content-Type: application/json; charset=UTF-8", "User-Agent: okhttp/4.9.0");
  VAR mF := PARSEJSON(rF.Content, "$.message", true);
  IF ISNULL(mF) OR mF != "SUCCESS"
    ADDERROR("MSpa príkaz: " + rF.Content);
    RETURN(NaN);
  END
  VAR telo := "{\"device_id\":\"" + DeviceId + "\",\"product_id\":\"" + ProductId + "\"}";
  VAR potvrdene := FALSE;
  IF !potvrdene
    SLEEP(4000);
    datetime nS1;
    string tsS1;
    string nonceS1;
    string podpisS1;
    nS1 := NOW();
    tsS1 := TOSTRING(FLOOR(nS1.UNIXTIME), "F0");
    nonceS1 := TOHEX(RANDBYTES(16));
    podpisS1 := TOHEX(HASH(AppId + "," + AppSecret + "," + nonceS1 + "," + tsS1, "MD5"));
    podpisS1 := REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(podpisS1, "a", "A"), "b", "B"), "c", "C"), "d", "D"), "e", "E"), "f", "F");
    VAR odpS1 := SENDHTTPREQUEST("/api/device/thing_shadow/", "POST", telo, "push_type: Android", "authorization: token " + Token, "appid: " + AppId, "nonce: " + nonceS1, "ts: " + tsS1, "lan_code: EN", "sign: " + podpisS1, "Content-Type: application/json; charset=UTF-8", "User-Agent: okhttp/4.9.0");
    IF TOSTRING(PARSEJSON(odpS1.Content, "$.data.filter_state", true)) = "1"
      potvrdene := TRUE;
    END
  END
  IF !potvrdene
    SLEEP(6000);
    datetime nS2;
    string tsS2;
    string nonceS2;
    string podpisS2;
    nS2 := NOW();
    tsS2 := TOSTRING(FLOOR(nS2.UNIXTIME), "F0");
    nonceS2 := TOHEX(RANDBYTES(16));
    podpisS2 := TOHEX(HASH(AppId + "," + AppSecret + "," + nonceS2 + "," + tsS2, "MD5"));
    podpisS2 := REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(podpisS2, "a", "A"), "b", "B"), "c", "C"), "d", "D"), "e", "E"), "f", "F");
    VAR odpS2 := SENDHTTPREQUEST("/api/device/thing_shadow/", "POST", telo, "push_type: Android", "authorization: token " + Token, "appid: " + AppId, "nonce: " + nonceS2, "ts: " + tsS2, "lan_code: EN", "sign: " + podpisS2, "Content-Type: application/json; charset=UTF-8", "User-Agent: okhttp/4.9.0");
    IF TOSTRING(PARSEJSON(odpS2.Content, "$.data.filter_state", true)) = "1"
      potvrdene := TRUE;
    END
  END
  IF !potvrdene
    ADDERROR("MSpa: čerpadlo sa nespustilo, ohrev sa nezapol");
    RETURN(NaN);
  END
END
VAR d := IF(St > 0, "{\"heater_state\":1}", "{\"heater_state\":0}");
datetime n;
string ts;
string nonce;
string podpis;
n := NOW();
ts := TOSTRING(FLOOR(n.UNIXTIME), "F0");
nonce := TOHEX(RANDBYTES(16));
podpis := TOHEX(HASH(AppId + "," + AppSecret + "," + nonce + "," + ts, "MD5"));
podpis := REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(podpis, "a", "A"), "b", "B"), "c", "C"), "d", "D"), "e", "E"), "f", "F");
VAR body := "{\"device_id\":\"" + DeviceId + "\",\"product_id\":\"" + ProductId + "\",\"desired\":\"" + REPLACE("{\"state\":{\"desired\":" + d + "}}", "\"", "\\\"") + "\"}";
VAR r := SENDHTTPREQUEST("/api/device/command", "POST", body, "push_type: Android", "authorization: token " + Token, "appid: " + AppId, "nonce: " + nonce, "ts: " + ts, "lan_code: EN", "sign: " + podpis, "Content-Type: application/json; charset=UTF-8", "User-Agent: okhttp/4.9.0");
VAR m := PARSEJSON(r.Content, "$.message", true);
IF ISNULL(m) OR m != "SUCCESS"
  ADDERROR("MSpa príkaz: " + r.Content);
  RETURN(NaN);
END
# cloud potvrdí zmenu až o pár sekúnd – dovtedy ignorovať staré čítané hodnoty
DEBOUNCE(St, 30000);
Filtrácia Switch
Values / States: ON · OFF

Filtrácia

Read switch state
VAR v := PARSEJSON(status, "$.data.filter_state", true);
IF ISNULL(v)
  RETURN(NaN);
END
VAR t := TOSTRING(v);
RETURN(IF(t = "1" OR t = "true" OR t = "True", 1, 0));
Write switch state
# Príkaz do cloudu MSpa: posiela sa len to, čo sa mení
IF LENGTH(Token) = 0 OR LENGTH(DeviceId) = 0
  ADDERROR("MSpa ešte nie je prihlásená, počkaj na čítanie modulu");
  RETURN(NaN);
END
VAR porucha := PARSEJSON(status, "$.data.fault", true);
IF St > 0 AND !ISNULL(porucha) AND TOSTRING(porucha) != "" AND TOSTRING(porucha) != "0"
  ADDERROR("MSpa hlási poruchu " + TOSTRING(porucha) + " – zapnúť sa dá až po jej odstránení na ovládači");
  RETURN(NaN);
END
VAR d := IF(St > 0, "{\"filter_state\":1}", "{\"filter_state\":0,\"heater_state\":0}");
datetime n;
string ts;
string nonce;
string podpis;
n := NOW();
ts := TOSTRING(FLOOR(n.UNIXTIME), "F0");
nonce := TOHEX(RANDBYTES(16));
podpis := TOHEX(HASH(AppId + "," + AppSecret + "," + nonce + "," + ts, "MD5"));
podpis := REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(podpis, "a", "A"), "b", "B"), "c", "C"), "d", "D"), "e", "E"), "f", "F");
VAR body := "{\"device_id\":\"" + DeviceId + "\",\"product_id\":\"" + ProductId + "\",\"desired\":\"" + REPLACE("{\"state\":{\"desired\":" + d + "}}", "\"", "\\\"") + "\"}";
VAR r := SENDHTTPREQUEST("/api/device/command", "POST", body, "push_type: Android", "authorization: token " + Token, "appid: " + AppId, "nonce: " + nonce, "ts: " + ts, "lan_code: EN", "sign: " + podpis, "Content-Type: application/json; charset=UTF-8", "User-Agent: okhttp/4.9.0");
VAR m := PARSEJSON(r.Content, "$.message", true);
IF ISNULL(m) OR m != "SUCCESS"
  ADDERROR("MSpa príkaz: " + r.Content);
  RETURN(NaN);
END
# cloud potvrdí zmenu až o pár sekúnd – dovtedy ignorovať staré čítané hodnoty
DEBOUNCE(St, 30000);
Bubliny Multi-value Switch
Values / States: Vypnuté · Nízka · Stredná · Vysoká

Bubliny

Read switch state
VAR bs := PARSEJSON(status, "$.data.bubble_state", true);
IF ISNULL(bs)
  RETURN(NaN);
END
IF bs = 0
  RETURN(0);
END
VAR lvl := PARSEJSON(status, "$.data.bubble_level", true);
IF ISNULL(lvl) OR lvl = 0
  RETURN(2);
END
RETURN(MIN(3, lvl));
Write switch state
# Príkaz do cloudu MSpa: posiela sa len to, čo sa mení
IF LENGTH(Token) = 0 OR LENGTH(DeviceId) = 0
  ADDERROR("MSpa ešte nie je prihlásená, počkaj na čítanie modulu");
  RETURN(NaN);
END
VAR porucha := PARSEJSON(status, "$.data.fault", true);
IF Mu > 0 AND !ISNULL(porucha) AND TOSTRING(porucha) != "" AND TOSTRING(porucha) != "0"
  ADDERROR("MSpa hlási poruchu " + TOSTRING(porucha) + " – zapnúť sa dá až po jej odstránení na ovládači");
  RETURN(NaN);
END
IF ISNAN(Mu)
  RETURN(NaN);
END
# úroveň aj zapnutie idú jedným príkazom; MSpa bubliny po 20 min sama vypne
VAR d := IF(Mu > 0, "{\"bubble_state\":1,\"bubble_level\":" + TOSTRING(MIN(3, Mu), "F0") + "}", "{\"bubble_state\":0}");
datetime n;
string ts;
string nonce;
string podpis;
n := NOW();
ts := TOSTRING(FLOOR(n.UNIXTIME), "F0");
nonce := TOHEX(RANDBYTES(16));
podpis := TOHEX(HASH(AppId + "," + AppSecret + "," + nonce + "," + ts, "MD5"));
podpis := REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(podpis, "a", "A"), "b", "B"), "c", "C"), "d", "D"), "e", "E"), "f", "F");
VAR body := "{\"device_id\":\"" + DeviceId + "\",\"product_id\":\"" + ProductId + "\",\"desired\":\"" + REPLACE("{\"state\":{\"desired\":" + d + "}}", "\"", "\\\"") + "\"}";
VAR r := SENDHTTPREQUEST("/api/device/command", "POST", body, "push_type: Android", "authorization: token " + Token, "appid: " + AppId, "nonce: " + nonce, "ts: " + ts, "lan_code: EN", "sign: " + podpis, "Content-Type: application/json; charset=UTF-8", "User-Agent: okhttp/4.9.0");
VAR m := PARSEJSON(r.Content, "$.message", true);
IF ISNULL(m) OR m != "SUCCESS"
  ADDERROR("MSpa príkaz: " + r.Content);
  RETURN(NaN);
END
# cloud potvrdí zmenu až o pár sekúnd – dovtedy ignorovať staré čítané hodnoty
DEBOUNCE(Mu, 30000);
Jet trysky Switch
Values / States: ON · OFF

Jet trysky

Read switch state
VAR v := PARSEJSON(status, "$.data.jet_state", true);
IF ISNULL(v)
  RETURN(NaN);
END
VAR t := TOSTRING(v);
RETURN(IF(t = "1" OR t = "true" OR t = "True", 1, 0));
Write switch state
# Príkaz do cloudu MSpa: posiela sa len to, čo sa mení
IF LENGTH(Token) = 0 OR LENGTH(DeviceId) = 0
  ADDERROR("MSpa ešte nie je prihlásená, počkaj na čítanie modulu");
  RETURN(NaN);
END
VAR porucha := PARSEJSON(status, "$.data.fault", true);
IF St > 0 AND !ISNULL(porucha) AND TOSTRING(porucha) != "" AND TOSTRING(porucha) != "0"
  ADDERROR("MSpa hlási poruchu " + TOSTRING(porucha) + " – zapnúť sa dá až po jej odstránení na ovládači");
  RETURN(NaN);
END
VAR d := IF(St > 0, "{\"jet_state\":1}", "{\"jet_state\":0}");
datetime n;
string ts;
string nonce;
string podpis;
n := NOW();
ts := TOSTRING(FLOOR(n.UNIXTIME), "F0");
nonce := TOHEX(RANDBYTES(16));
podpis := TOHEX(HASH(AppId + "," + AppSecret + "," + nonce + "," + ts, "MD5"));
podpis := REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(podpis, "a", "A"), "b", "B"), "c", "C"), "d", "D"), "e", "E"), "f", "F");
VAR body := "{\"device_id\":\"" + DeviceId + "\",\"product_id\":\"" + ProductId + "\",\"desired\":\"" + REPLACE("{\"state\":{\"desired\":" + d + "}}", "\"", "\\\"") + "\"}";
VAR r := SENDHTTPREQUEST("/api/device/command", "POST", body, "push_type: Android", "authorization: token " + Token, "appid: " + AppId, "nonce: " + nonce, "ts: " + ts, "lan_code: EN", "sign: " + podpis, "Content-Type: application/json; charset=UTF-8", "User-Agent: okhttp/4.9.0");
VAR m := PARSEJSON(r.Content, "$.message", true);
IF ISNULL(m) OR m != "SUCCESS"
  ADDERROR("MSpa príkaz: " + r.Content);
  RETURN(NaN);
END
# cloud potvrdí zmenu až o pár sekúnd – dovtedy ignorovať staré čítané hodnoty
DEBOUNCE(St, 30000);
UVC sterilizácia Switch
Values / States: ON · OFF

UVC sterilizácia

Read switch state
VAR v := PARSEJSON(status, "$.data.uvc_state", true);
IF ISNULL(v)
  RETURN(NaN);
END
VAR t := TOSTRING(v);
RETURN(IF(t = "1" OR t = "true" OR t = "True", 1, 0));
Write switch state
# UVC: keď filter beží a ohrev nie, pošle sa aj filter_state 1, aby vírivka pri prepnutí UVC čerpadlo nezastavila
IF LENGTH(Token) = 0 OR LENGTH(DeviceId) = 0
  ADDERROR("MSpa ešte nie je prihlásená, počkaj na čítanie modulu");
  RETURN(NaN);
END
VAR porucha := PARSEJSON(status, "$.data.fault", true);
IF St > 0 AND !ISNULL(porucha) AND TOSTRING(porucha) != "" AND TOSTRING(porucha) != "0"
  ADDERROR("MSpa hlási poruchu " + TOSTRING(porucha) + " – zapnúť sa dá až po jej odstránení na ovládači");
  RETURN(NaN);
END
VAR drzFilter := TOSTRING(PARSEJSON(status, "$.data.filter_state", true)) = "1" AND TOSTRING(PARSEJSON(status, "$.data.heater_state", true)) != "1";
VAR d := "{\"uvc_state\":" + IF(St > 0, "1", "0") + IF(drzFilter, ",\"filter_state\":1", "") + "}";
datetime n;
string ts;
string nonce;
string podpis;
n := NOW();
ts := TOSTRING(FLOOR(n.UNIXTIME), "F0");
nonce := TOHEX(RANDBYTES(16));
podpis := TOHEX(HASH(AppId + "," + AppSecret + "," + nonce + "," + ts, "MD5"));
podpis := REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(podpis, "a", "A"), "b", "B"), "c", "C"), "d", "D"), "e", "E"), "f", "F");
VAR body := "{\"device_id\":\"" + DeviceId + "\",\"product_id\":\"" + ProductId + "\",\"desired\":\"" + REPLACE("{\"state\":{\"desired\":" + d + "}}", "\"", "\\\"") + "\"}";
VAR r := SENDHTTPREQUEST("/api/device/command", "POST", body, "push_type: Android", "authorization: token " + Token, "appid: " + AppId, "nonce: " + nonce, "ts: " + ts, "lan_code: EN", "sign: " + podpis, "Content-Type: application/json; charset=UTF-8", "User-Agent: okhttp/4.9.0");
VAR m := PARSEJSON(r.Content, "$.message", true);
IF ISNULL(m) OR m != "SUCCESS"
  ADDERROR("MSpa príkaz: " + r.Content);
  RETURN(NaN);
END
# cloud potvrdí zmenu až o pár sekúnd – dovtedy ignorovať staré čítané hodnoty
DEBOUNCE(St, 30000);
Snímač teploty vody Temperature Sensor

Snímač teploty vody

Read temperature
VAR v := PARSEJSON(status, "$.data.water_temperature", true);
IF ISNULL(v)
  RETURN(NaN);
END
RETURN(v / 2);
Do vykúrenia Variable

Do vykúrenia

Read
VAR h := PARSEJSON(status, "$.data.heater_state", true);
VAR sp := PARSEJSON(status, "$.data.temperature_setting", true);
VAR wt := PARSEJSON(status, "$.data.water_temperature", true);
IF ISNULL(h) OR ISNULL(sp) OR ISNULL(wt)
  RETURN(NaN);
END
IF h != 1 OR wt >= sp
  RETURN(0);
END
# rýchlosť ohrevu: z prebiehajúceho ohrevu (HeatSessionRate), inak naučená (HeatRateLearned), inak hlásená vírivkou
# (device_heat_perhour v desatinách °C/h, 0,5–2,0 ako v HA), inak HeatRate (manuál Mono Eco 1,5–2,0 °C/h)
VAR rate := MAX(0.1, IF(HeatSessionRate > 0, HeatSessionRate, IF(HeatRateLearned > 0, HeatRateLearned, IF(TODOUBLE(TOSTRING(PARSEJSON(status, "$.data.device_heat_perhour", true))) > 0, MAX(0.5, MIN(2, TODOUBLE(TOSTRING(PARSEJSON(status, "$.data.device_heat_perhour", true))) / 10)), HeatRate))));
RETURN(ROUND((sp - wt) / 2 / rate * 60));
Zostatok filtra Variable

Zostatok filtra

Read
VAR v := PARSEJSON(status, "$.data.filter_life", true);
IF ISNULL(v)
  RETURN(NaN);
END
RETURN(v);
Využitie filtra Variable

Využitie filtra

Read
VAR v := PARSEJSON(status, "$.data.filter_current", true);
IF ISNULL(v)
  RETURN(NaN);
END
RETURN(v);
Detská poistka Reed Contact

Detská poistka

Read
VAR v := PARSEJSON(status, "$.data.safety_lock", true);
IF ISNULL(v)
  RETURN(NaN);
END
VAR t := TOSTRING(v);
RETURN(IF(t = "1" OR t = "true" OR t = "True", 1, 0));
Stav ohrevu Variable

Stav ohrevu

Read
# 0 = vypnutý, 2 = predohrev, 3 = ohrev, 4 = vykúrené, udržiava (podľa integrácie MSpa v HA)
VAR v := PARSEJSON(status, "$.data.heat_state", true);
IF ISNULL(v)
  RETURN(NaN);
END
RETURN(v);
Online stav Reed Contact

Online stav

Read
VAR c := PARSEJSON(status, "$.data.ConnectType", true);
IF ISNULL(c)
  RETURN(NaN);
END
RETURN(IF(TOSTRING(c) = "online", 1, 0));
Príkon Variable

Príkon

Read
# odhad z nominálnych príkonov v premenných modulu (PumpW, BubbleL1W–L3W, HeaterHeatW pri ohreve)
RETURN(PowerW);
Jednotka teploty Switch
Values / States: °F · °C

Jednotka teploty

Read switch state
VAR v := PARSEJSON(status, "$.data.temperature_unit", true);
IF ISNULL(v)
  RETURN(NaN);
END
VAR t := TOSTRING(v);
RETURN(IF(t = "1" OR t = "true" OR t = "True", 1, 0));
Write switch state
# Príkaz do cloudu MSpa: posiela sa len to, čo sa mení
IF LENGTH(Token) = 0 OR LENGTH(DeviceId) = 0
  ADDERROR("MSpa ešte nie je prihlásená, počkaj na čítanie modulu");
  RETURN(NaN);
END
VAR porucha := PARSEJSON(status, "$.data.fault", true);
IF St > 0 AND !ISNULL(porucha) AND TOSTRING(porucha) != "" AND TOSTRING(porucha) != "0"
  ADDERROR("MSpa hlási poruchu " + TOSTRING(porucha) + " – zapnúť sa dá až po jej odstránení na ovládači");
  RETURN(NaN);
END
VAR d := IF(St > 0, "{\"temperature_unit\":1}", "{\"temperature_unit\":0}");
datetime n;
string ts;
string nonce;
string podpis;
n := NOW();
ts := TOSTRING(FLOOR(n.UNIXTIME), "F0");
nonce := TOHEX(RANDBYTES(16));
podpis := TOHEX(HASH(AppId + "," + AppSecret + "," + nonce + "," + ts, "MD5"));
podpis := REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(podpis, "a", "A"), "b", "B"), "c", "C"), "d", "D"), "e", "E"), "f", "F");
VAR body := "{\"device_id\":\"" + DeviceId + "\",\"product_id\":\"" + ProductId + "\",\"desired\":\"" + REPLACE("{\"state\":{\"desired\":" + d + "}}", "\"", "\\\"") + "\"}";
VAR r := SENDHTTPREQUEST("/api/device/command", "POST", body, "push_type: Android", "authorization: token " + Token, "appid: " + AppId, "nonce: " + nonce, "ts: " + ts, "lan_code: EN", "sign: " + podpis, "Content-Type: application/json; charset=UTF-8", "User-Agent: okhttp/4.9.0");
VAR m := PARSEJSON(r.Content, "$.message", true);
IF ISNULL(m) OR m != "SUCCESS"
  ADDERROR("MSpa príkaz: " + r.Content);
  RETURN(NaN);
END
# cloud potvrdí zmenu až o pár sekúnd – dovtedy ignorovať staré čítané hodnoty
DEBOUNCE(St, 30000);
Čas ohrevu Variable

Čas ohrevu

Read
# časovač ohrevu z ovládača: zostáva hodín do zapnutia ohrevu (1–99 h)
VAR v := PARSEJSON(status, "$.data.heat_time", true);
IF ISNULL(v)
  RETURN(NaN);
END
RETURN(v);
Prepínač ohrevu Variable

Prepínač ohrevu

Read
# časovač ohrevu zapnutý (1) / vypnutý (0)
VAR v := PARSEJSON(status, "$.data.heat_time_switch", true);
IF ISNULL(v)
  RETURN(NaN);
END
VAR t := TOSTRING(v);
RETURN(IF(t = "1" OR t = "true" OR t = "True", 1, 0));
Auto-nafúknutie Variable

Auto-nafúknutie

Read
VAR v := PARSEJSON(status, "$.data.auto_inflate", true);
IF ISNULL(v)
  RETURN(NaN);
END
RETURN(v);
Verzia firmvéru WiFi Variable

Verzia firmvéru WiFi

Read
VAR v := PARSEJSON(status, "$.data.wifivertion", true);
IF ISNULL(v)
  RETURN(NaN);
END
RETURN(v);
Spotreba Variable

Spotreba

Read
# súčet odhadu (premenná modulu kWhTotal, nuluje servisná akcia modulu Vynulovať spotrebu)
RETURN(kWhTotal);
Rýchlosť ohrevu Variable

Rýchlosť ohrevu

Read
# rýchlosť ohrevu: z prebiehajúceho ohrevu, inak naučená, inak HeatRate (°C/h)
RETURN(IF(HeatSessionRate > 0, HeatSessionRate, IF(HeatRateLearned > 0, HeatRateLearned, IF(TODOUBLE(TOSTRING(PARSEJSON(status, "$.data.device_heat_perhour", true))) > 0, MAX(0.5, MIN(2, TODOUBLE(TOSTRING(PARSEJSON(status, "$.data.device_heat_perhour", true))) / 10)), HeatRate))));
Porucha Reed Contact

Porucha

Read
VAR f := PARSEJSON(status, "$.data.fault", true);
IF ISNULL(f)
  RETURN(NaN);
END
# text a význam kódu je v servisnom atribúte modulu Chybový kód
RETURN(IF(TOSTRING(f) = "" OR TOSTRING(f) = "0", 0, 1));
Vymeniť filter Reed Contact

Vymeniť filter

Read
VAR w := PARSEJSON(status, "$.data.warning", true);
IF ISNULL(w)
  RETURN(NaN);
END
# A0 = na ovládači bliká FILTER (vyčistiť alebo vymeniť kartuš, potom podržať FILTER 3 s)
RETURN(IF(INDEXOF(TOSTRING(w), "A0") >= 0, 1, 0));
Vykúrené o Variable

Vykúrené o

Read
VAR h := PARSEJSON(status, "$.data.heater_state", true);
VAR sp := PARSEJSON(status, "$.data.temperature_setting", true);
VAR wt := PARSEJSON(status, "$.data.water_temperature", true);
IF ISNULL(h) OR ISNULL(sp) OR ISNULL(wt)
  RETURN(NaN);
END
# nekúri alebo je vykúrené: bez času
IF h != 1 OR wt >= sp
  RETURN(NaN);
END
VAR rate := MAX(0.1, IF(HeatSessionRate > 0, HeatSessionRate, IF(HeatRateLearned > 0, HeatRateLearned, IF(TODOUBLE(TOSTRING(PARSEJSON(status, "$.data.device_heat_perhour", true))) > 0, MAX(0.5, MIN(2, TODOUBLE(TOSTRING(PARSEJSON(status, "$.data.device_heat_perhour", true))) / 10)), HeatRate))));
# čas dňa, kedy bude vykúrené, v sekundách od polnoci (premenná je prevedená na typ SessionDuration = zobrazí sa ako čas;
# v Home Assistante ako entita „time“). Ohrev cez polnoc ukáže čas na druhý deň.
datetime koniec := DATETIMEADD(NOW(), 0, 0, 0, 0, ROUND((sp - wt) / 2 / rate * 60), 0, 0);
RETURN(koniec.HOUR * 3600 + koniec.MINUTE * 60);
Connection: Packet Parser → HTTP

Import parameters

Enter these values when you import the XML.

Asked in the appDefault
Email (MSpa účet)Enter at import
Heslo MSpa (alebo jeho MD5)Enter at import
Device ID (prázdne = prvá vírivka v účte)Enter at import
Product ID (prázdne = zistí sa samo)Enter at import

Found a problem with this device template?

Tell us what's wrong, what's missing, or how the template should behave. We rely on your feedback to keep the catalog accurate.

Template · TapHome portal MSpa Mono Eco Open this template in the Customer Portal to apply it to one of your homes, or to draft a refinement and submit it back to the catalog. Packet Parser → HTTP View in TapHome portal