TV
Power, channel, and volume controls.
Built from capabilities, not assumptions.
TV is a canonical HomeAutoPro entertainment template. The same production capability schema drives validation, controls, reported state, telemetry, scenes and automations. Undeclared keys are rejected.
Controls
powerbooleanON / OFFWritable through validated owner commands and automations.volumenumber · %0–100Writable through validated owner commands and automations.channelnumber0–999Writable through validated owner commands and automations.Feedback / state
Every connected device also reports online state and last-seen time. Applied values remain distinct from requested values until the device acknowledges them.
powerboolean. Report the value actually applied after each command.
volumenumber · %. Report the value actually applied after each command.
channelnumber. Report the value actually applied after each command.
Telemetry
This template declares no telemetry-only values. Report readable applied values as state.
Automations
State/telemetry changes for power, volume, channel, plus online and offline events.
Validated commands for power, volume, channel. Applied state is reported as ACK.
Payloads and acknowledgement
Authenticate
{"type":"auth","device_secret":"YOUR_DEVICE_SECRET"}Command
{
"event": "command",
"state": {
"channel": 499.5,
"power": true,
"volume": 50.0
}
}State ACK
{
"state": {
"channel": 499.5,
"power": true,
"volume": 50.0
},
"type": "state"
}Sample code
Choose one platform. All examples use the production protocol and placeholders; no stored secret is retrieved.
#include <ESP8266WiFi.h>
#include <ArduinoJson.h>
#include <WebSocketsClient.h>
const char* DEVICE_CODE = "YOUR_DEVICE_ID";
const char* DEVICE_SECRET = "YOUR_DEVICE_SECRET";
WebSocketsClient socket;
// Handle only: power, volume, channel
// Connect: socket.beginSSL("api.homeautopro.in", 443, path);
// First message: {"type":"auth","device_secret":DEVICE_SECRET}
// After a command, publish {"type":"state","state":applied}.#include <WiFi.h>
#include <ArduinoJson.h>
#include <WebSocketsClient.h>
const char* DEVICE_CODE = "YOUR_DEVICE_ID";
const char* DEVICE_SECRET = "YOUR_DEVICE_SECRET";
// Use TLS port 443 and the same authenticated command/state ACK lifecycle.
// Generate handlers only for: power, volume, channelimport requests
url = "https://homeautopro.in/api/device-ingest/DEVICE_CODE/state"
headers = {"X-Device-Secret": "YOUR_DEVICE_SECRET"}
payload = {"state": {"channel": 499.5, "power": true, "volume": 50.0}}
response = requests.post(url, headers=headers, json=payload, timeout=10)
response.raise_for_status()const response = await fetch(
"https://homeautopro.in/api/device-ingest/DEVICE_CODE/state",
{ method: "POST", headers: { "X-Device-Secret": "YOUR_DEVICE_SECRET", "Content-Type": "application/json" },
body: JSON.stringify({"state": {"channel": 499.5, "power": true, "volume": 50.0}}) }
);
if (!response.ok) throw new Error(`HomeAutoPro ${response.status}`);curl --fail-with-body -X POST \
-H "X-Device-Secret: YOUR_DEVICE_SECRET" \
-H "Content-Type: application/json" \
-d '{"state": {"channel": 499.5, "power": true, "volume": 50.0}}' \
https://homeautopro.in/api/device-ingest/DEVICE_CODE/stateTroubleshooting
401 authentication
Use the current Device Secret locally. Rotate it in Device Details if it was lost.
422 validation
Compare every key, type and range with the capability schema above.
No command ACK
Publish the value actually applied after handling event=command.