The read timeout was kept in 16 bits, so a longer one wrapped: Berry's
webclient.set_timeouts(80000) gave up after about 14.5 s, and 70000
after 4.5 s. Keep it in 32 bits, in HttpClientLight and
AsyncHttpClientLight, as ESPEasy's copy of the client now does.
Matter_TLV.tlv2raw() wrote a UTF2 string with bytes().frostring(), a
typo for fromstring(), so encoding any string of more than 255 bytes
(which is given type UTF2 automatically) raised attribute_error.
run_tests.be and button_stability_tests.be stop with assert_failed right
after "Matter epoch conversion for UTC and local time: OK" on development.
Three test-only mistakes, each hiding the next:
- run_tests.be checked the RSSI item's stored TLV type before encoding.
"Clamp RSSI" (#25126) stores signed values as I4; the encoded bytes are
still the 1-byte 00C3, which the next assert checks. Check the value only.
- TestGarageDevice (run_tests.be) lacks disable_bridge_mode, which
Matter_Plugin_Device.init() reads since #25099.
- StabilityDevice (button_stability_tests.be) lacks it too.
Tests only; no firmware files change.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The Shutter and Shutter + Tilt plugins handle UpOrOpen, DownOrClose,
StopMotion and GoToLiftPercentage (and GoToTiltPercentage for tilt) in
invoke_request(), but AcceptedCommandList (0xFFF9) of the Window
Covering cluster was empty. Controllers that build their feature set
from this list, such as Home Assistant, then don't offer setting the
position or tilt.
Override get_accepted_commands() in both plugins to report the
commands they implement.
Fixes #25146
* AsyncHttpClientLight: time out reading a body when the server goes silent
writeToStreamDataBlock() waited for the rest of a body for as long as
connected() held. A server that stops sending part way through without
closing leaves connected() true, so the worker never finishes and the
caller, waiting in runJob(), never returns. Give up after _tcpTimeout
without data and return HTTPC_ERROR_READ_TIMEOUT, as HttpClientLight
now does (#25139).
* AsyncHttpClientLight: notice when the server closes after the last byte
AsyncTcpAdapter only saw the peer close inside read(), and callers only
read when available() > 0. A body without Content-Length that ends with
the server closing left connected() true for ever, so
writeToStreamDataBlock() never returned. connected() now peeks at the
socket, as WiFiClient::connected() does: data still buffered keeps it
connected, an orderly close after it does not.
* AsyncHttpClientLight: address review of the read timeout
- connected() only reports a peer close and no longer calls stop(): it can
be called from another task than the worker using the socket.
- writeToStreamDataBlock() closes the connection on a read timeout, as the
chunked readers do, so a stalled connection is not reused.
- readBodyToStreamString(): the identity branch used by async GET/POST now
times out after _tcpTimeout without data, and notices a close: with no
Content-Length it ends the body, with one it is a lost connection.
After the zero-size chunk the readers read one line unconditionally,
then waited for another empty line. The first read already consumed the
empty line that ends the body, so every chunked body waited for a line
that never came and failed with HTTPC_ERROR_READ_TIMEOUT after
_tcpTimeout. Read trailer lines up to the first empty one instead.
writeToStreamDataBlock() looped for as long as connected() held, waiting
for the rest of the body with no time limit. A server that stops sending
part way through a body without closing the connection - a computer that
sleeps, a cable pulled, a network that drops between the two ends - leaves
connected() true for ever, so the read never returned. Called from the main
loop, as Berry's webclient get_string() is, it left the device answering
nothing, not even its web page, until it was power-cycled.
Give up after _tcpTimeout without data, returning HTTPC_ERROR_READ_TIMEOUT,
as handleHeaderResponse() already does for the headers. A body that keeps
arriving, however slowly, is unaffected: each piece resets the clock.
* Matter add Wi-Fi Network Diagnostics cluster (0x0036)
Expose BSSID, SecurityType, WiFiVersion, ChannelNumber and RSSI on the
Root endpoint so controllers (Apple Home, Home Assistant) can show which
access point and channel a device uses. BSSID and channel changes are
reported to subscribers when the device roams.
tasmota.wifi() now also reports `channel`, `security` and `phy`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Clamp RSSI
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: s-hadinger <49731213+s-hadinger@users.noreply.github.com>
* copy pins_arduino from tasmota not framework
* move specific P4 settings out of pins_arduino.h
* keep backwards compability
with the option to redefine the specific different P4 board configs
* Keep P4 SD card on SDMMC slot 0 and set hosted MCU pins in default module
Arduino core and libraries do not see my_user_config.h, so without
BOARD_SDMMC_SLOT in pins_arduino.h SD_MMC uses slot 1 which is taken
by ESP-Hosted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Add command Ldo<x> <mV> to configure ESP32-P4 LDO3 and LDO4
LDOs are set at boot before any GPIO use. LDO settings of DSI display
descriptor, CSI camera and SD card are only used if not set by command
Ldo and are deprecated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Show clear error if pins_arduino.h for a variant is missing
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Jason2866 <obermeier.johann@googlemail.com>
Co-authored-by: Jason2866 <24528715+Jason2866@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* Fix silently-dropped LVGL flush chunks on ESP32-P4 DSI panels
esp_lcd_panel_draw_bitmap()'s DMA2D path takes an internal draw
semaphore with a 0 timeout and returns ESP_ERR_INVALID_STATE (without
drawing anything) if the previous async transfer hasn't completed yet.
DSIPanel::pushColors() ignored that return value, and lv_flush_callback()
always calls lv_disp_flush_ready() regardless, so LVGL believed the
flush succeeded even when the chunk was silently dropped - leaving
stale framebuffer content on screen for that region.
Retry instead of dropping the chunk. The transfer typically completes
in well under 1ms, so poll in short bursts rather than 1ms FreeRTOS
ticks; a bounded retry count still catches a genuinely stuck transfer
and logs it instead of looping forever.
* Allow LVGL DSI draw buffers to use PSRAM on ESP32-P4
lv_pixel_buf/lv_pixel_buf2 previously preferred MALLOC_CAP_INTERNAL,
costing ~120KB of scarce internal SRAM on boards where PSRAM is
otherwise nearly idle (e.g. a 1024x600 DSI panel at 60 flushlines).
Prefer MALLOC_CAP_SPIRAM instead, falling back to internal RAM if
PSRAM is unavailable - safe now that the previous commit fixes the
DMA2D transfer race that PSRAM's slower read speed was exposing.
Also switch the flush-timing debug log from millis() to micros() and
drop its DMA-path exclusion: at a ~60KB/transfer chunk size the whole
operation completes in a few hundred microseconds, so millisecond
resolution just read back 0 or 1 and the DMA path - the one we
actually needed data from - was never logged at all.
* Remove defaulting to PSRAM for now
---------
Co-authored-by: s-hadinger <49731213+s-hadinger@users.noreply.github.com>
* Matter: add Electrical Power Measurement cluster to On/Off Plug-in Unit
Adds a new "relay_power" plugin type (Matter_Plugin_OnOff_Power) that extends
the existing relay/OnOff Plug-in Unit (0x010A) with the Electrical Power
Measurement cluster (0x0090), reporting Voltage, Current, ActivePower,
ApparentPower, ReactivePower, Frequency and PowerFactor from Tasmota's ENERGY
sensor JSON, so Matter controllers can display live power usage for smart
plugs with energy monitoring.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* Matter: add v_relay_power virtual variant for Electrical Power Measurement
Adds Matter_Plugin_Virt_OnOff_Power ("v_relay_power") so the new
ElectricalPowerMeasurement-enabled plug can be exercised without physical
hardware, driven entirely via `MtrUpdate` (e.g. Voltage/Current/ActivePower/
ApparentPower/ReactivePower/Factor/Frequency).
Also guards Matter_Plugin_OnOff_Power.parse_sensors() against VIRTUAL
instances (it must not read the local ENERGY sensor) and declares
UPDATE_COMMANDS so MtrUpdate accepts the new measurement keys. The wattage
key is named `ActivePower` rather than `Power` since `Power` is already the
inherited On/Off boolean command.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* Matter: register new plugin headers in be_matter_module.c
be_matter_module.c maintains an explicit, hand-written list of solidified
Berry header includes (no auto-discovery). The new OnOff_Power and
Virt_OnOff_Power plugin files were missing from that list, so their classes
were never defined, causing the "undeclared" build failures reported by CI
(be_class_Matter_Plugin_OnOff_Power / be_class_Matter_Plugin_Virt_OnOff_Power)
even though matter.plugins_classes referenced them by name.
* Matter: add http_relay_power bridge variant for Electrical Power Measurement
Adds Matter_Plugin_Bridge_OnOff_Power ("http_relay_power") so the
ElectricalPowerMeasurement-enabled plug can also be bridged from a remote
Tasmota device over HTTP (polling `Status 10`), completing the local/virtual/
bridge trio already used by other plugins (relay, relay_power now included).
Refactors the ENERGY-object parsing in Matter_Plugin_OnOff_Power into a
shared `_parse_energy()` helper used by both `parse_sensors()` (local device)
and the new `parse_status()` override (bridge, index 10 / Status 10), and
guards `parse_sensors()` against BRIDGE instances so a bridge endpoint never
reads the local gateway's own ENERGY sensor by mistake.
Registers the new solidified header in be_matter_module.c (missed this for
the previous two plugin files, which broke CI) and adds http_relay_power to
the bridge type dropdown in Matter_UI.be.
Verified with a full PlatformIO build for tasmota32s3 (SUCCESS).
* Matter: auto-detect relay_power on remote bridge devices with an ENERGY sensor
The "Add Remote sensor or device" auto-detection always suggested plain
light0/relay for every detected relay channel, even when the remote device
reports an ENERGY sensor (e.g. a NOUS A5T 4-outlet power strip with a single
shared CSE7766 meter) - so relay+power devices showed up as plain "Light 0
OnOff" with no way to pick relay_power from that screen (the type column is
static text for already-detected rows, only editable for a brand new blank
row).
generate_config_from_status() now tags the first detected relay as
relay_power when ENERGY is present, leaving the rest as plain relays: most
Tasmota energy-monitoring boards have a single meter for the whole device,
not one per relay, so duplicating the cluster across every channel would
misleadingly show the same aggregate reading on each endpoint.
* Matter: compose Electrical Sensor device type onto the power-monitoring plug
Adds device type 0x0510 (Electrical Sensor) alongside 0x010A (On/Off
Plug-in Unit) on the same endpoint for relay_power/v_relay_power/
http_relay_power, plus the mandatory Power Topology cluster (0x009C) with
the NODE feature (this single ENERGY sensor meters the whole device, not a
subset of endpoints - matches Tasmota's non-indexed ENERGY object).
Matches the Matter 1.4.1 Device Library requirement that Electrical Power
Measurement lives on an Electrical Sensor device type, while keeping the
cluster on the plug's own endpoint (composed DeviceTypeList) rather than a
separate endpoint, since controllers only recognize the measurement
capability when the Electrical Sensor device type is actually declared.
Verified on real ESP32-S3 hardware via chip-tool: endpoint 2 now reports
DeviceTypeList = [266 (On/Off Plug-in Unit), 1296/0x0510 (Electrical
Sensor), 19 (Bridged Node)], and Power Topology FeatureMap = 1 (NODE).
---------
Co-authored-by: Ludovic BOUÉ <938089+lboue@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>