Czy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie tamWhy cmnd=state does not report energy ?
cmnd/…/State
does not contain ENERGY data because the STATE frame in Tasmota is intentionally limited to general device-status fields (relay state, uptime, Wi-Fi, firmware, etc.). cmnd/…/Status 8
, cmnd/…/Status 10
, or subscribe to tele/…/SENSOR
to obtain voltage, current, power and accumulated energy.Tasmota’s MQTT / command architecture
• stat/…/RESULT – immediate acknowledgement of a command
• tele/…/STATE – periodic or on-demand “system snapshot” (command State
)
• tele/…/SENSOR – periodic sensor/energy block (TelePeriod driven)
• stat/…/STATUS8 / STATUS10 – sensor/energy on-demand (Status 8
/10
)
Composition of a STATE payload
{
"Time":"2024-03-18T14:03:42",
"Uptime":"1T00:17:29",
"Heap":26,
"SleepMode":"Dynamic",
"Wifi":{"AP":1,"RSSI":-66,"SSID":"…"}
}
No ENERGY object is created in this handler, so it never reaches the JSON encoder.
Where ENERGY is generated
The ENERGY block is assembled in the sensor-task code path; that path is called only
• when TelePeriod expires → tele/…/SENSOR
• when Status 8
or Status 10
is parsed → stat/…/STATUS8/10
Result: cmnd State
cannot deliver ENERGY even if a measuring IC (HLW8012, CSE7766, ADE7953, BL0937, PZEM, etc.) is present and calibrated.
tele/…/SENSOR
for continuous metering and only use STATE for liveness checks.Example commands and expected topics:
Action | MQTT command | Device reply topic | Contains ENERGY? |
---|---|---|---|
Quick status | cmnd/MyPlug/State |
tele/MyPlug/STATE |
✗ |
One-shot energy | cmnd/MyPlug/Status 8 |
stat/MyPlug/STATUS8 |
✓ |
Full sensor dump | cmnd/MyPlug/Status 10 |
stat/MyPlug/STATUS10 |
✓ |
Periodic energy | cmnd/MyPlug/TelePeriod 60 |
tele/MyPlug/SENSOR every 60 s |
✓ |
Typical ENERGY block:
"ENERGY":{
"TotalStartTime":"2024-03-01T00:00:00",
"Total":12.345,
"Yesterday":0.811,
"Today":0.375,
"Power": 63,
"Voltage":229,
"Current":0.275,
"ApparentPower": 71,
"ReactivePower": 27,
"Factor":0.89
}
PowerCal
, VoltageCal
, CurrentCal
) for accuracy. TelePeriod
and subscribe to tele/SENSOR
.Status 8
or Status 10
. cmnd State
never shows energy because ENERGY belongs to the sensor subsystem, not to the STATE snapshot. Use Status 8
, Status 10
, or subscribe to tele/…/SENSOR
, and ensure your hardware and configuration support power monitoring.
User question
[WebApp Cmd 'Status 8' Result] Unknown command
Artificial Intelligence Response
Direct answer to the question
• “
[WebApp Cmd 'Status 8' Result] Unknown command
” means the firmware that is currently running on your Tasmota-based device was compiled without the energy-monitoring module (USE_ENERGY_SENSOR) or the command was malformed when it reached the device.• In practice this happens almost exclusively when you flash one of the minimal / lite / display / IR / custom stripped builds or when the WebApp inserts an illegal “ =` ” sign instead of the single space required by Tasmota’s command grammar.
• Flash a build that contains the energy drivers (e.g. tasmota-sensors.bin) and send the command with the exact syntax
over the console, MQTT (
cmnd/<topic>/Status
payload8
) or HTTP (/cm?cmnd=Status%208
).Key points
Detailed problem analysis
Tasmota command registration
• At boot each feature module registers its commands.
•
Status
is always present, but the sub-handler for index 8 is compiled only ifUSE_ENERGY_SENSOR
is enabled.• If absent, the dispatcher returns “Unknown command” the moment you ask for index 8.
Common situations that remove the handler
a. Pre-compiled binaries with reduced footprint
– tasmota-lite, tasmota-minimal, tasmota-ir, tasmota-display, many vendor-specific OTA binaries.
b. DIY custom builds where
#undef USE_ENERGY_SENSOR
(or#define USE_NO_ENERGY_SENSOR
) was set to save flash.c. Builds older than ca. v6.6 where energy code was still optional in the core binary.
Less frequent, but possible
• Transport / syntax error (WebApp silently sends
Status=8
,%20
missing, extra CR LF, etc.).• A proxy-script that strips the space (causes
Status8
which is not a legal command).• Very exotic edge cases: corrupted flash, run-time memory overwrite, but those will usually spam the log with exceptions before the console is ready.
Symptoms that are not “Unknown command”
• “
Energy
shows all zeros” → sensors compiled but no chip found or GPIOs wrong.• “
STATE
command shows no ENERGY block” but 8 works → TelePeriod / retain logic, not compile time.Current information and trends (2024)
• Since v13 the official release set on OTA contains:
–
tasmota.bin
(standard, still includes energy in 2024 but could be dropped in future to fit ESP8285 1 MB)–
tasmota-sensors.bin
(guaranteed energy drivers)–
tasmota-lite.bin
(no energy)• For ESP32-C3/S3 larger flash sizes allow “universal” builds, but for ESP8266 size pressure keeps energy optional.
• Community trend: use templates from the Blakadder repository to auto-assign GPIOs instead of choosing a fixed “module”.
• Future direction: CMake-based “boards.txt” style-selective build so a single binary can enable drivers at run-time on devices with ≥4 MB flash (experimental in 14.x nightlies).
Supporting explanations and details
Command grammar (official docs):
No equals sign, no extra spaces. Therefore:
HTTP →
/cm?cmnd=Status%208
MQTT → topic
cmnd/myPlug/Status
payload8
*May be trimmed in future releases—always check the release notes.
Ethical and legal aspects
• Firmware replacement voids many consumer warranties; ensure compliance with local regulations if the device is used for billing-grade metering.
• Safety: When reflashing mains-powered plugs, work through an isolation barrier and respect the creepage distances.
Practical guidelines
Identify the running binary
Check the parentheses after the version, e.g.
13.5.0(tasmota-lite)
Pick the correct upgrade path
• If on
minimal
, first OTA-flashtasmota-sensors
directly (since v12+ allows skipping the two-step).• If very old (<8.x), flash minimal → reboot → sensors.
Apply device template
– Configuration ▸ Configure Other ▸ Template ▸ paste JSON ▸ Activate ▸ Save.
Reboot, open Console, and try
You should now receive:
Optional verification
Watch
tele/<dev>/SENSOR
messages over MQTT to confirm continuous energy telemetry.Possible disclaimers or additional notes
• On 1 MB ESP8266 modules (Sonoff Basic R1, some older Gosund plugs) you might simply not have enough flash for a sensors build; compile a custom binary with only your IC driver and MQTT.
• Some proprietary energy ICs (e.g., BL09XX variants) demand correct board-level gain resistor values; mis-soldered boards will give nonsensical readings although the command works.
Suggestions for further research
• Investigate Berry scripting in Tasmota 14.x to post-process energy data locally.
• Explore ESPHome as an alternative if you routinely need custom drivers and already use Home-Assistant.
• Look into the upcoming Matter/Thread branch of Tasmota if you plan to integrate energy monitoring with new smart-home hubs.
Brief summary
“Unknown command” for
Status 8
is almost always a compile-time omission: you are running a firmware build that lacks the energy-monitoring module or the WebApp mangled the command syntax.Flash tasmota-sensors (or another full build), keep the exact
Status 8
syntax, configure the correct template, and the command will return the ENERGY JSON block.User question
how to get power [W] via http
Artificial Intelligence Response
Direct answer to the question
http://<device-ip>/cm?cmnd=Status%2010
(or the lighterStatus%208
).StatusSNS → ENERGY → Power
.tasmota-sensors.bin
or a custom build withUSE_ENERGY_SENSOR
).Key points
•
/cm?cmnd=Status 8/10
are the official REST endpoints for sensor/energy data.• Space must be URL-encoded as
%20
.• If the response lacks an
ENERGY
block or you get “Unknown command”, the firmware or template is wrong.• Add
user=
andpassword=
parameters when Web-UI authentication is enabled.Detailed problem analysis
Tasmota’s internal command tree
•
State
→ core status (relay, uptime, Wi-Fi) – never carries energy.•
Status 8
→ “SENSOR”: all sensor data, minimum overhead (≈ 0.6 kB).•
Status 10
→ “STATUS + SENSOR”: full module, network, and sensor report (≈ 1.2 kB).JSON structure (excerpt)
Firmware variants
Why an “ENERGY” block may be missing
• Wrong binary flashed.
• Template/GPIO table does not map the metering IC pins.
• Metering IC unpowered, faulty, or not present.
Current information and trends
• Since Tasmota v13.x the preferred query for automation systems is
Status 8
; older tutorials still citeStatus 10
. Both remain valid in 2024.• A new
TelePeriod
default of 300 s keeps the device from flooding the network; HTTP polling every 30–60 s is common.• JSONPath extraction is supported directly in Home-Assistant 2024.6+, eliminating custom templates.
Future directions
• Core team is evaluating an “edge-metrics” endpoint returning only key values (power, voltage, current) to cut traffic for low-power IoT radios.
• ESP32-C6 ports add native HTTPS and Matter for secured energy data.
Supporting explanations and details
Practical examples
• Browser test
http://192.168.1.123/cm?cmnd=Status%208
•
curl
+jq
one-liner• Python snippet
Advanced (push instead of pull)
The device now POSTs the wattage whenever it changes, saving bandwidth.
Ethical and legal aspects
• Network exposure: opening port-80 to the Internet can leak live consumption profiles. Use VPN or MQTT-over-TLS for remote access.
• Electrical safety: never exceed the plug’s rated current; inaccurate readings or overheating can cause fire.
• GDPR / CCPA: power data is personal usage information—treat logs accordingly.
Practical guidelines
Implementation checklist
tasmota-sensors.bin
(Web UI → Firmware upgrade, or OTA URL).HLW8012: Voltage=229.5V Current=0.27A Power=63W
.Status 8
URL.• Node-RED: HTTP-request → JSON node →
msg.payload.StatusSNS.ENERGY.Power
.• Home-Assistant: RESTful Sensor platform.
Common pitfalls & fixes
• “401 Unauthorized” → supply credentials (
http://user:pass@ip/...
).•
Power
always 0 W → load below metering IC’s threshold; calibrate withEnergyCal
.• JSON decode error → configure
Content-Type: application/json
if using custom HTTP libraries.Possible disclaimers or additional notes
• Single-value query (
cm?cmnd=Power
) returns relay state, not wattage—often confused in older blog posts.• Meter accuracy is typically ±1 % after calibration; cheap plugs may drift.
• HTTP traffic is plain-text; consider MQTT-TLS or HTTPS proxy in security-sensitive environments.
Suggestions for further research
• Explore Tasmota’s Script engine to build custom REST endpoints.
• Investigate ESPHome if YAML-based configuration is preferred.
• Look at IEC 62053-21 class-2 or class-1 certified meters for billing-grade accuracy.
• Study upcoming Matter-Energy spec for unified smart-home power metering.
Brief summary
Query
Status%208
orStatus%2010
on the/cm
endpoint of a Tasmota plug that has energy-capable firmware, parseENERGY.Power
, and you have the instantaneous power in watts. Ensure the correct firmware/template, URL-encode the space, authenticate if needed, and secure the traffic if it leaves your LAN.