tfyoung / esphome-junctek_kgf

Component for esphome to read status from a Junctek KG-F coulometer/battery monitor via UART
MIT License
24 stars 14 forks source link

[feature request] Add flow control pin support #25

Open Id2ndR opened 2 months ago

Id2ndR commented 2 months ago

Some RS485 to UART module use the DE/RE flow control pin. However only TX/RX is used currently, meaning in cannot work with the MAX485 one.

This issue is similar to https://github.com/syssi/esphome-solax-x1-mini/issues/18

hslabbert commented 6 days ago

Ditto here for myself. On that note as well, I'm not quite seeing how to get this sorted with modbus support, which might enable this?

I can get flow_control_pin set via the modbus component, so e.g.:

uart:
  - id: uart_modbus_client
    rx_pin: 16
    tx_pin: 17
    baud_rate: 9600

modbus:
  uart_id: uart_modbus_client
  id: modbus1
  flow_control_pin: 4

modbus_controller:
  - id: modbus_junctek
    address: 0x2
    modbus_id: modbus1

But then I can't reference that modbus_controller_id in the junctek config; e.g. something like:

sensor:
  - platform: junctek_kgf
    modbus_controller_id: modbus_junctek
    invert_current: true
    voltage:
      name: "Battery Voltage"
    current:
      name: "Battery Current"
    battery_level:
      name: "Battery Level"
    temperature:
      name: "Battery Temperature"

If I'm reading things correctly, this is pulling in a single uart entry and picking up the pins and config from there, but then wouldn't permit a modbus interface to manage the flow_control_pin, yea?