Skip to content

Add SMAModbus.device_info() from the SMA profile type label - #175

Merged
erwindouna merged 1 commit into
mainfrom
modbus-device-info
Sep 30, 2026
Merged

erwindouna merged 1 commit into
mainfrom
modbus-device-info

Conversation

@erwindouna

Copy link
Copy Markdown
Collaborator

First step towards reading measurements over Modbus next to WebConnect: read the device info from SMA's own Modbus profile.

  • SMAModbus.device_info() reads the type label (Nameplate.Model, Vendor, SerNum and PkgRev at 30053–30059) from sma_unit_id (default 3) and returns the same DeviceInfo as SMAWebConnect.device_info(). The serial matches across both transports, so a client can check that a Modbus endpoint is the device it already knows. Modbus has no device name, so DeviceInfo's fallback name is used.
  • NaN handling follows SMA's Modbus Technical Information: U32 NaN is 0xFFFFFFFF, and tag values use the lower 24 bits with NaN 0xFFFFFD. A unit that serves only NaN (unit 1 on an inverter) raises SmaReadException.
  • Modbus errors map to SmaReadException (exception response), SmaTimeoutException and SmaConnectionException.
  • The packaged l10n loading moves from SMAWebConnect into helpers.load_l10n(), so both transports translate the model and vendor tags the same way. WebConnect behaviour is unchanged.
  • uv.lock resynced to 1.1.8.

Tested against a live STP5.0-3SE-40 (firmware 4.08.39.R): DeviceInfo(type='SUNNY TRIPOWER 5.0 SE', manufacturer='SMA', sw_version='4.8.39.R'), the same values as WebConnect (with the sw_version fix from the other PR).

Reads Nameplate.Model/Vendor/SerNum/PkgRev from the SMA unit ID (default 3),
so the serial identifies the same device as SMAWebConnect.device_info().
Move the packaged l10n loading into helpers so both transports translate
the model and vendor tags the same way. Resync uv.lock to 1.1.8.
@erwindouna
erwindouna merged commit 0d58fca into main Sep 30, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants