esphome / esphome/feature-requests

Dynamic Modbus Read Address Selection

Open
#3,076 1 comment 5 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
450
Forks
29
PR merge metrics
No merged PRs in 30d

Description

**Describe the problem you have/What new integration you would like**

I would like to request a feature that allows dynamically modifying the Modbus read address in the ```modbus_controller``` sensor component. Ideally, this could be achieved using the ```Select``` component, an ```input_text``` box, or another mechanism—even if it requires a device restart for the changes to take effect.

**Please describe your use case for this integration and alternatives you've tried:**

Currently, to change the Modbus read address of a sensor, the ESPHome firmware needs to be modified and re-flashed. This process can be cumbersome, especially when debugging or when working with multiple Modbus devices that require different read addresses.

A possible implementation could allow selecting the Modbus read address dynamically from a dropdown list (via the ```Select``` component) or entering it manually (```input_text```). Example usage:
```
sensor:
# Active Power (30013 - 30014) (0x000C)
- platform: modbus_controller
modbus_controller_id: sdm120_modbus
name: "SDM120M Power"
id: sdm120m_power
address: !lambda 'return id(selected_modbus_address).state;'
register_type: read
value_type: FP32
unit_of_measurement: "W"
accuracy_decimals: 1
state_class: measurement

select:
- platform: template
name: "Modbus Address Selector"
id: selected_modbus_address
options:
- "0x000C"
- "0x0010"
- "0x0020"
initial_option: "0x000C"
```

**Additional context**

- This feature would make ESPHome more flexible for Modbus use cases, enabling easy debugging by switching addresses without reflashing and using a simple web interface.

- It would allow creating ESPHome devices that can dynamically select Modbus addresses from a dropdown list, making them more adaptable for different setups and ability to work as standalone devices.

- While an ESP restart might still be necessary, avoiding a full reflash would be a significant improvement.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the modbus_controller sensor component and compare its address configuration with the Select and input_text components described in the request. Done means a supported configuration can change the Modbus read address without modifying or reflashing firmware, with any restart requirement documented.

Written by the indexing model from the issue text.

Assessment

Domain
embedded-iot
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.