Add ESPHome example configurations
The README carried a fragment, which is enough to show the shape but not enough to flash. These are complete configs: wiredsensor.yaml one node, every measurement and diagnostic register wiredsensor-node.yaml one node as a reusable package, parameterised by address bus-of-nodes.yaml three nodes on one segment, via that package All three validate against ESPHome 2026.7, and the expanded config was checked register by register rather than only for schema validity — a wrong address or value_type validates perfectly and then reports a plausible but wrong temperature, which is the failure mode worth guarding against. Two things the fragment in the README was missing and a real config cannot be: flow_control_pin on the modbus component. Without it the ESP32 never asserts DE, so nothing reaches the segment and the node looks dead. The generated fragment now carries it too. The read/holding split for diagnostics. ESPHome merges adjacent registers of one register_type into a single command, and a read overlapping 0x0000..0x0004 is refused when the sensor has never produced a reading — so diagnostics merged into the measurement command go unavailable exactly when they are needed. Asking for them as `holding` puts them in their own command. Serials are text_sensors with raw_encode: HEXBYTES rather than numeric sensors, because Home Assistant stores states as float32 and 24 bits of mantissa cannot hold a 32-bit serial. Uptime has the same limit and is left numeric with a note; quantising past 194 days does not matter for spotting a reboot. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -669,7 +669,11 @@ def run_tests(bus: Bus) -> int:
|
||||
|
||||
ESPHOME_YAML = """\
|
||||
# wiredsensor node at unit address {unit} — paste into your ESPHome config and
|
||||
# set the tx_pin/rx_pin to whatever your RS485 transceiver is wired to.
|
||||
# set the pins to whatever your RS485 transceiver is wired to.
|
||||
#
|
||||
# This is the bus and entity fragment only. For a complete flashable config,
|
||||
# including the board, wifi and every diagnostic register, see
|
||||
# examples/esphome/wiredsensor.yaml.
|
||||
uart:
|
||||
id: rs485
|
||||
tx_pin: GPIO17
|
||||
@@ -682,6 +686,10 @@ uart:
|
||||
modbus:
|
||||
id: rs485_bus
|
||||
uart_id: rs485
|
||||
# Driver enable, wired to DE and /RE together. Delete this if your
|
||||
# transceiver switches direction itself; without it on a module that does
|
||||
# not, nothing you send reaches the segment and the node looks dead.
|
||||
flow_control_pin: GPIO4
|
||||
|
||||
modbus_controller:
|
||||
- id: wiredsensor
|
||||
|
||||
Reference in New Issue
Block a user