issues icon indicating copy to clipboard operation
issues copied to clipboard

Modbus Binary Sensor missing register_count option

Open chuyskywalker opened this issue 1 year ago • 4 comments

The problem

Based on the binary sensor modbus docs I should be able to read several registers to cobble together a 64bit int so that I can bitmask against that for a big long list of faults that my solark inverter reports

  - platform: modbus_controller
    modbus_controller_id: modbus_client_sa
    name: "Alarm: F08 GFDI_Relay_Failure"
    address: 103
    register_type: holding
    register_count: 4
    bitmask: 0x80  # position 7

As an example. However, this causes compile error

[register_count] is an invalid option for [binary_sensor.modbus_controller]. Did you mean [register_type]?

In fact, as best I can tell, there's no way to ask for more than a single register when attempting to extract bitmask values from a larger int.

Which version of ESPHome has the issue?

2024.12.4

What type of installation are you using?

pip

Which version of Home Assistant has the issue?

n.a

What platform are you using?

ESP32

Board

n/a

Component causing the issue

modbus

YAML Config

esphome:
  name: demo

esp32:
  board: esp32dev
  framework:
    type: arduino
uart:
  - id: uart_modbus_client_sa
    rx_pin: 13
    tx_pin: 16
    baud_rate: 9600
    data_bits: 8
    parity: NONE
    stop_bits: 1

modbus:
  - id: modbus_sa
    uart_id: uart_modbus_client_sa

modbus_controller:
- id: modbus_client_sa
  modbus_id: modbus_sa
  address: 0x1

binary_sensor:
  - platform: modbus_controller
    modbus_controller_id: modbus_client_sa
    name: "Alarm: F08 GFDI_Relay_Failure"
    address: 103
    register_type: holding
    register_count: 4
    bitmask: 0x80  # position 7

Anything in the logs that might be useful for us?


Additional information

No response

chuyskywalker avatar Jan 20 '25 23:01 chuyskywalker

Tangentially related to #5985

chuyskywalker avatar Jan 22 '25 07:01 chuyskywalker

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar May 23 '25 02:05 github-actions[bot]

Still issue

chuyskywalker avatar May 23 '25 14:05 chuyskywalker

Same for switch and number

Hadatko avatar Jun 24 '25 08:06 Hadatko