ESPHome Modbus integration to GREE Thermo pump

Hi,

I’m using ESP8266 with MAX485 to control GREE Versaty II. Everything is working fine with sensors, except Modbus Switch, Changing Modes (heat, cool, heat+hot water, cool+hot water, hot water only - which is Switch component as well).
Im stuck some now with Modbus Switch Integration. I’m trying to Power on and off the unit, and I can see all the sensors, and can turn it ON with Modbus when I set bitmask: 0xAA (which is command for turning On, as pdf document says from Gree), but for turning OFF I need other bitmask which is 0x55. Is there a way to achieve that?

Here is my configuration as well, and part of PDF which is describing commands:
ESPHome Config:

ap:
    ssid: "Modbus-Gree Fallback Hotspot"
    password: "sQeTy2wInuSJ"

captive_portal:
web_server:
  port: 80

uart:
  id: mod_bus
  tx_pin: 12
  rx_pin: 14
  baud_rate: 9600
  stop_bits: 1

modbus:
  flow_control_pin: 13
  send_wait_time: 200ms
  id: modbus_versati2
  
modbus_controller:
  - id: versati2
    ## the Modbus device addr
    address: 0x1
    modbus_id: modbus_versati2
    setup_priority: -10

sensor:
  - platform: modbus_controller
    modbus_controller_id: versati2
    id: outside_temp
    name: "Outside Temp"
    address: 0x002D
    unit_of_measurement: "°C" 
    register_type: holding
    value_type: U_WORD
    accuracy_decimals: 2
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    modbus_controller_id: versati2
    id: heating_temp
    name: "Outgoing Water Temp"
    address: 0x0032
    unit_of_measurement: "°C" 
    register_type: holding
    value_type: U_WORD
    accuracy_decimals: 2
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    modbus_controller_id: versati2
    id: boiler_temp
    name: "Water Tank Temp"
    address: 0x0035
    unit_of_measurement: "°C" 
    register_type: holding
    value_type: U_WORD
    accuracy_decimals: 2
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    modbus_controller_id: versati2
    id: power_state
    name: "State"
    address: 0x01
    register_type: holding
    value_type: U_WORD
    
  - platform: modbus_controller
    modbus_controller_id: versati2
    id: mode_hvac
    name: "Mode"
    address: 0x02
    register_type: holding
    value_type: U_WORD
    
  - platform: modbus_controller
    modbus_controller_id: versati2
    id: boiler_setpoint
    name: "Boiler Setpoint Temp"
    address: 0x000D
    unit_of_measurement: "°C" 
    register_type: holding
    value_type: U_WORD
    accuracy_decimals: 2
    filters:
    - multiply: 0.1
  
  - platform: modbus_controller
    modbus_controller_id: versati2
    id: heting_setpoint
    name: "Heating Setpoint Temp"
    address: 0x000A
    unit_of_measurement: "°C" 
    register_type: holding
    value_type: U_WORD
    accuracy_decimals: 2
    filters:
    - multiply: 0.1

switch:
  - platform: modbus_controller
    modbus_controller_id: versati2
    id: turn_on_off
    name: "On Off"
    register_type: holding
    address: 0x001
    bitmask: 0xAA #"With bitmask: 0xAA Switch is working with correct possition, but it cannot turn off thermo pump for turning off 0x85 is needed"

This is a part of PDF document which Is describing commands:

Thank you in advance

If you do not format the code correctly it is undoable to read it:
image

Use two switches

Hi, I have the same heatpump can you please help me with the cable connection of the device side?
What kind of connector is needed?
Thanks

Hello,

I have a problem with esphome.
Does anyone know what I have wrong?

mcu: ESP32

esphome code:

uart:
  id: mod_bus
  tx_pin: GPIO16
  rx_pin: GPIO17
  baud_rate: 9600
  stop_bits: 1

modbus:
  send_wait_time: 200ms
  id: modbus_versati3

modbus_controller:
  - id: modbus_cotnroller
    address: 0x01
    modbus_id: modbus_versati3
    setup_priority: -10

sensor:
  - platform: modbus_controller
    modbus_controller_id: modbus_cotnroller
    id: nasi_komora_modbus_testsensor
    name: "nasi_komora_modbus_testsensor"
    address: 0x76
    register_type: holding
    value_type: U_WORD
    offset: 0

Error in log:
[13:55:28][D][modbus_controller:032]: Modbus command to device=1 register=0x76 countdown=0 no response received - removed from send queue

it’s finally working for me, I’ve created a tutorial here:

1 Like

@kristof.kalotay Sorry for long delay answer - yes I’ll Help you - I’ll send everything I have.
@Pecator Good Job dude - I’ll send you to you as well some other codes which will be usable to investigate problems with pump :wink:

2 Likes

the only thing I couldn’t figure out is how to write a sensor or switch for such registers…

Anyone have any ideas?

Hi everyone. I have recently implemented this integration and it has been working really well. With the change to winter now, I have run into a small issue. Every time the outdoor temp is below zero I get an outdoor tempo value of 6553. With the decimal of 3-8 depending on how cold it is.

any advice on why the Modbus is returning this value?

yes, need convert to negative float.

1 Like

  - platform: modbus_controller
    modbus_controller_id: versati3
    name: "versati_118_outdoor_temp"
    address: 118
    unit_of_measurement: "°C" 
    register_type: holding
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - lambda: |-
        if (x > 32767) {
          x -= 65536;
        }
        return x * 0.1;
1 Like

Thank you very much.