jourdant / esphome-lgap

19 stars 2 forks source link

How to send command? #3

Open CS012019 opened 7 months ago

CS012019 commented 7 months ago

Hi I have a Dual Inverter Air Conditioner - M38AKH and PI-485 extension board and I am trying to control the aircon remotely using this board.

I have a question as I am not getting any response. How exactly do I send the request? What is the format? If you could please send an example of a valid request and how exactly you send it, that would be appreciated.

I am currently sending this request over serial [0,0,0,0,2,2,5,92] and it is not working. Any help will be greatly appreciated.

jourdant commented 7 months ago

That's awesome you have the PI-485! According to this diagram, the LGAP pins should be 4 (BUS A/+) and 5 (BUS B/-).

image

You also need to check the DIP switches are set correctly. The final switch refers to whether the PI-485 is outputting LGAP protocol or not.

image

With the final switch on the right set to the up position, it will enable LGAP. You'll also need to set the other switches according to the unit you are interfacing with.

Assuming that's all in place already, which ESP32 board are you using to interface with the PI-485 board? I've started implementing the LGAP protocol as an esphome component already and it's on my feature/esphome2 branch right now. If you're wanting to add it to an esphome config, you'll need to add the following lines:

external_components:
  - source:
      type: git
      url: https://github.com/jourdant/esphome-lgap
      ref: feature/esphome2
    components: [ "lgap"]
    refresh: 0sec

uart:
  id: lgap_uart1
  tx_pin: GPIO06 #update your pin
  rx_pin: GPIO07 #update your pin
  baud_rate: 4800

  debug:
      direction: BOTH

lgap:
  - id: lgap1
    uart_id: lgap_uart1
    flow_control_pin: GPIO05
    zone_check_wait_time: 5000ms
    send_wait_time: 4000ms
    receive_wait_time: 4000ms

    debug: True
    debug_wait_time: 2000ms

climate:
   - platform: lgap
     id: lgap_zone_1
     name: 'Zone 1 - Ground Floor'
     lgap_id: lgap1
     zone: 0