Skip to content

include customization to specify the modbus TCP id ports related with suport multiple inverters. #12

Closed

Description

@mcamposv

Posible drop box with inverters preconfig.
EMMA
Inverter.
o custom option. That can include things like.
Port ID
enable disable Connection Test
Connection Test String.

const uint8_t MODBUS_FIXED_ID = 0;
const uint16_t MODBUS_TEST_REG = 30000;

Activity

  1. mcamposv commented on Nov 2, 2026

    @mcamposv
    CollaboratorAuthor

    Implemented in #13 (firmware 6.1-0).

    What was done

    The hard-coded MODBUS_FIXED_ID / MODBUS_TEST_REG constants are gone. There is now a Test Target subsection inside Modbus TCP target, available both in the web settings page (/config) and in the initial Setup portal:

    • Device type drop-down with presets: EMMA, SUN2000 and Custom.
    • Connection check on boot: enable / disable. When disabled, the proxy opens the gateway as soon as the ping to the target IP succeeds (the ping step always stays).
    • The 4 fields of the test request:
    Field EMMA SUN2000 Custom
    Unit ID 0 (editable) 1 (editable) free
    Function code 03 03 free (1–127)
    Start register 30000 30000 free
    Register count 15 15 free
    • Selecting Custom shows a warning: the values are the user's responsibility.

    How the check works

    1. Ping to the target IP (retry every 30 s until it answers).
    2. If enabled, the Modbus test request above is sent (retry every 10 s). It passes with any valid Modbus answer — the normal reply of that function, or its exception (FC | 0x80), which proves the device's Modbus stack is alive. No specific string is expected. With FC03/FC04 the text read is shown as the device model on the OLED and the dashboard.

    Until both steps pass, incoming client connections are refused.

    The configured Unit ID only affects the startup check and the menu diagnostics. Client requests are forwarded untouched with their own Unit ID, so a client can still talk to several devices (EMMA, inverters…) through the proxy.

    Persistence

    Settings are stored in NVS and survive reboots and USB/OTA flashing. When upgrading from 6.0-0 they don't exist yet and are initialised with the EMMA values (0 / FC03 / 30000 / 15, check enabled), so behaviour is unchanged until modified. /api/status exposes them (target_profile, startup_check, test_unit_id, test_function, test_register, test_reg_count).

    Verified on the test proxy against the EMMA emulator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions