ryansch / esphome-config

1 stars 0 forks source link

Using the rs485 bus #1

Open paulwilke opened 3 months ago

paulwilke commented 3 months ago

Hey and thanks for this great starting point. Could you please point me to the right config I have to do so I can access the RS485?

I figured something along the lines should work:


uart:
  id: uart_bus
  tx_pin: GPIO17  
  rx_pin: GPIO18  
  baud_rate: 115200

modbus:
  id: modbus1
  uart_id: uart_bus

modbus_controller:
- id: modbus_device
  address: 0x1   ## address of the Modbus slave device on the bus
  modbus_id: modbus1
  setup_priority: -10

sensor:
  - platform: modbus_controller
    modbus_controller_id: modbus_device
    id: temp_sensor_1
    name: "Temperature Sensor 1"
    unit_of_measurement: "°C"
    address: 0x0001  
    register_type: read  
    value_type: U_WORD  

  - platform: modbus_controller
    modbus_controller_id: modbus_device
    id: temp_sensor_2
    name: "Temperature Sensor 2"
    unit_of_measurement: "°C"
    address: 0x0002  
    register_type: read  
    value_type: U_WORD ```
Jacksonjl commented 1 month ago

Did you get this working for RS485?

paulwilke commented 1 month ago

yes I got it working. ` uart: tx_pin: GPIO17 rx_pin: GPIO18 baud_rate: 9600 id: uart_bus

modbus: id: modbus1 uart_id: uart_bus

modbus_controller: