September 14, 20223 yr @sjlouw I allways use 32's the older 8266's wifi stack on esphome was allways touch and go. I ended up removing R7 as well as two other resistive sensors I had on the 32. Its now perfectly stable. Thanks for the effort. This is by far the best option of getting the data in HomeAssistant on sunsynk inverters!
September 14, 20223 yr Author @sjlouw I am doing something wrong and I can't figure out what cause I can't get my ESP32 to work! I have tried 2 different boards and two different RS485 connectors (same models as you specified) but no joy Have tried different ethernet cables etc, I am using a T568B cable so using the orange/orange&white cables (pin 1&2) These are the errors I am getting, any idea? Settings on the inverter are as specified.
September 29, 20223 yr Also trying to get this working for my Sunsynk 8kw. I have the MicroRobotics 4-pin USB-RS485 dongle, have connected pins 1,2,3 from the T568B cable (orange/white, orange, green/white) to B, A, Ground. My inverter is set to Slave, ID 1. I am trying to use mbusd as described in kellerza's sunsynk repo ``` mbusd -d -L - -v 9 -p /dev/ttyUSB0 -s 9600 -m 8N1 -P 502 -T 5 ``` And then `pymodbus.console` to connect to mbusd to do a basic sanity test. Unfortunately, I just get timeouts. As an alternative, I'm wondering if I could replace the firmware on the Sunsynk Wifi dongle (ESP32, talking RS232 to the inverter) with ESPHome, and query the inverter via that router? Anyone tried this?
September 29, 20223 yr 15 minutes ago, RoganDawes said: Also trying to get this working for my Sunsynk 8kw. I have the MicroRobotics 4-pin USB-RS485 dongle, have connected pins 1,2,3 from the T568B cable (orange/white, orange, green/white) to B, A, Ground. My inverter is set to Slave, ID 1. I am trying to use mbusd as described in kellerza's sunsynk repo ``` mbusd -d -L - -v 9 -p /dev/ttyUSB0 -s 9600 -m 8N1 -P 502 -T 5 ``` And then `pymodbus.console` to connect to mbusd to do a basic sanity test. Unfortunately, I just get timeouts. As an alternative, I'm wondering if I could replace the firmware on the Sunsynk Wifi dongle (ESP32, talking RS232 to the inverter) with ESPHome, and query the inverter via that router? Anyone tried this? The only suggestion I have is to ensure the SunSynk Modbus ID is correct: Mine was zero, which did not seem to work.
September 29, 20223 yr 2 hours ago, RoganDawes said: mbusd -d -L - -v 9 -p /dev/ttyUSB0 -s 9600 -m 8N1 -P 502 -T 5 mine is started as: mbusd -v 2 -c /etc/mbusd/mbusd.conf and mbusd.conf contains: ########## Serial port settings ############# # Serial port device name device = /dev/ttyUSB0 # Serial port speed speed = 9600 # Serial port mode mode = 8n1 # RS-485 data direction control type (addc, rts, sysfs_0, sysfs_1) trx_control = addc # Sysfs file to use to control data direction # trx_sysfile = ############# TCP port settings ############# # TCP server address to bind address = 192.168.1.6 # TCP server port number port = 502 # Maximum number of simultaneous TCP connections maxconn = 32 # Connection timeout value in seconds timeout = 60 ######### Request/response settings ######### # Maximum number of request retries retries = 3 # Pause between requests in milliseconds pause = 100 # Response wait time in milliseconds wait = 500 # Reply on Broadcast replyonbroadcast = no
September 29, 20223 yr 6 minutes ago, Kalahari Meerkat said: mine is started as: mbusd -v 2 -c /etc/mbusd/mbusd.conf Thanks! I'm just trying to get a minimal response back from the inverter, to show that I am correctly connected to it. From there, I'm happy to try and install all sorts of programs, etc. Is there a simple "ping" that should get an answer? I tried: printf "client.connect\nclient.read_device_information\n" | pymodbus.console tcp --host 192.168.201.1 --port 502 But I just get a timeout. And I have confirmed that my slave id is set to 01. Is there a simple "liveness" check that I can do to confirm that I am able to talk to my inverter?
September 29, 20223 yr For liveness, simply use the addon- if you get the serial number you are ok faq on connectivity here: https://github.com/kellerza/sunsynk/tree/v0.2.5#fault-finding
October 19, 20223 yr On 2022/09/14 at 2:28 PM, Sc00bs said: @sjlouw @Sc00bs Scoobs, did you ever get this to work? im using a esp32 devkit 1, and then the same rs485 to ttl convertor sjlouw used. Tried with a deye 12kw 3 phase and also no comms. I saw from sjlouws diagram that Green of white is pin 1 connecting to A and Green is pin 2 connecting to B, but from the deye manual, it looks like Pin one on Rs485 is B and pin2 is A. Still didnt work for me though, bunch of crc errors.. On 2022/09/14 at 2:28 PM, Sc00bs said: I am doing something wrong and I can't figure out what cause I can't get my ESP32 to work! I have tried 2 different boards and two different RS485 connectors (same models as you specified) but no joy Have tried different ethernet cables etc, I am using a T568B cable so using the orange/orange&white cables (pin 1&2) These are the errors I am getting, any idea? Settings on the inverter are as specified. Edited October 19, 20223 yr by roadkill wrong name
October 25, 20223 yr On 2022/09/14 at 2:28 PM, Sc00bs said: @sjlouw I am doing something wrong and I can't figure out what cause I can't get my ESP32 to work! I have tried 2 different boards and two different RS485 connectors (same models as you specified) but no joy Have tried different ethernet cables etc, I am using a T568B cable so using the orange/orange&white cables (pin 1&2) These are the errors I am getting, any idea? Settings on the inverter are as specified. Same problem on a new install. I wonder if something changed with latest firmware. EDIT. Think I might be using the wrong port. I was trying using the one on the bottom right, not top left Edited October 25, 20223 yr by slipx update
October 27, 20223 yr @sjlouw Thank you for the esphome code! I have modified it somewhat and below is my current code if anyone is interested: esphome: name: "sunsynk" esp32: board: esp32dev framework: type: arduino #################################### STATIC SECTION #################################### wifi: ssid: !secret wifi_ssid password: !secret wifi_password fast_connect: true ap: ssid: '${device_name}' password: !secret fallback_password ota: safe_mode: true reboot_timeout: 10min num_attempts: 5 #web_server: # port: 80 # auth: # username: !secret esphome_web_username # password: !secret esphome_web_password #switch: # - platform: restart # name: "${device_name} Restart" captive_portal: esp32_ble_tracker: scan_parameters: active: true bluetooth_proxy: active: true # Enable logging logger: # Enable Home Assistant API api: password: !secret esphome_api_password # Enable time component to reset energy at midnight # https://esphome.io/components/time.html#home-assistant-time-source time: - platform: homeassistant id: homeassistant_time #################################### STATIC SECTION #################################### uart: id: mod_bus tx_pin: 17 rx_pin: 16 baud_rate: 9600 stop_bits: 1 modbus: id: sunsynk_modbus flow_control_pin: 4 modbus_controller: - id: sunsynk_esphome address: 0x01 modbus_id: sunsynk_modbus setup_priority: -10 update_interval: 5000ms sensor: - platform: modbus_controller #72 Battery Charge Total modbus_controller_id: sunsynk_esphome name: "SS Battery Charge Total" id: sunsynk_esphome_battery_charge_total register_type: holding address: 72 unit_of_measurement: "kWh" accuracy_decimals: 1 device_class: energy state_class: total_increasing filters: - lambda: |- x = x / -1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - x + 65535) /10; else return (0 - x) /10; - platform: modbus_controller #74 Battery Discharge Total modbus_controller_id: sunsynk_esphome name: "SS Battery Discharge Total" id: sunsynk_esphome_battery_discharge_total register_type: holding address: 74 unit_of_measurement: "kWh" accuracy_decimals: 0 device_class: energy state_class: total_increasing filters: - lambda: |- x = x / 1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - 65535) /10; else return (x) /10; # - platform: modbus_controller # 81 Grid Export Total (Sell) # modbus_controller_id: sunsynk_esphome # name: "SS Grid Export Total (Sell)" # id: sunsynk_esphome_grid_export_total_sell # register_type: holding # address: 81 # unit_of_measurement: "kWh" # accuracy_decimals: 2 # device_class: energy # state_class: total_increasing # filters: # - lambda: |- # x = x / 1; # float MAX_VALUE = 32767; # if (x > MAX_VALUE) return (0 - 65535) / 10; # else return x /10; - platform: modbus_controller # 78 Grid Import Total (Buy) modbus_controller_id: sunsynk_esphome name: "SS Grid Import Total (Buy)" id: sunsynk_esphome_grid_import_total_buy register_type: holding address: 78 unit_of_measurement: "kWh" accuracy_decimals: 0 device_class: energy state_class: total_increasing filters: #GOOD - lambda: |- x = x / -1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - x + 65535) /1; else return (0 - x) /1; - platform: modbus_controller # 85 Load Power Total modbus_controller_id: sunsynk_esphome name: "SS Load Power Total" id: sunsynk_esphome_load_power_total register_type: holding address: 85 unit_of_measurement: "kWh" accuracy_decimals: 0 device_class: energy state_class: total_increasing filters: #GOOD - lambda: |- x = x / 1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - x + 65535) /1; else return (0 - x) /1; # - platform: modbus_controller # modbus_controller_id: sunsynk_esphome # name: "SS Total PV Power (kWh)" # id: sunsynk_esphome_total_pv_power_kwh # register_type: holding # address: 96 # unit_of_measurement: "kWh" # accuracy_decimals: 2 # device_class: energy # state_class: total_increasing # filters: # - multiply: 0.1 - platform: modbus_controller # 169 Grid Power modbus_controller_id: sunsynk_esphome name: "SS Grid Power" id: sunsynk_esphome_grid_power register_type: holding address: 169 unit_of_measurement: "W" accuracy_decimals: 0 device_class: power state_class: measurement filters: #GOOD - lambda: |- x = x /1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - 65535) /1; else return (x) /1; - platform: modbus_controller # 178 Load Power modbus_controller_id: sunsynk_esphome name: "SS Load Power" id: sunsynk_esphome_load_power register_type: holding address: 178 unit_of_measurement: "W" accuracy_decimals: 0 device_class: power state_class: measurement filters: #GOOD - lambda: |- x = x /1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - 65535) /1; else return (x) /1; # - platform: modbus_controller # modbus_controller_id: sunsynk_esphome # name: "SS PV1 Power" # id: sunsynk_esphome_pv1_power # register_type: holding # address: 186 # unit_of_measurement: "W" # accuracy_decimals: 2 # device_class: power # state_class: measurement # - platform: modbus_controller # modbus_controller_id: sunsynk_esphome # name: "SS PV2 Power" # id: sunsynk_esphome_pv2_power # register_type: holding # address: 187 # unit_of_measurement: "W" # accuracy_decimals: 2 # device_class: power # state_class: measurement - platform: modbus_controller # 184 Battery SOC modbus_controller_id: sunsynk_esphome name: "SS Battery SOC" id: sunsynk_esphome_battery_soc register_type: holding address: 184 unit_of_measurement: "%" accuracy_decimals: 0 device_class: battery state_class: measurement filters: #GOOD - lambda: |- x = x /1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - 65535) /1; else return (x) /1; - platform: modbus_controller # 216 Battery Charging Efficiency modbus_controller_id: sunsynk_esphome name: "SS Battery Charging Efficiency" id: sunsynk_esphome_battery_charging_efficiency register_type: holding address: 216 unit_of_measurement: "%" accuracy_decimals: 1 device_class: battery state_class: measurement filters: #GOOD - lambda: |- x = x /1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - 65535) /10; else return (x) /10; - platform: modbus_controller # 194 Grid Connected Status modbus_controller_id: sunsynk_esphome name: "SS Grid Connected Status" id: sunsynk_esphome_grid_connected_status register_type: holding address: 194 accuracy_decimals: 0 - platform: modbus_controller # 059 Overall State modbus_controller_id: sunsynk_esphome name: "SS Overall State" id: sunsynk_esphome_overall_state register_type: holding address: 59 - platform: modbus_controller # 013 Firmware Control Board modbus_controller_id: sunsynk_esphome name: "SS Firmware Control Board" id: sunsynk_esphome_firmware_control_board register_type: holding address: 13 - platform: modbus_controller # 013 Firmware Comms Board modbus_controller_id: sunsynk_esphome name: "SS Firmware Comms Board" id: sunsynk_esphome_firmware_comms_board register_type: holding address: 14 - platform: modbus_controller # 079 Grid Frequency modbus_controller_id: sunsynk_esphome name: "SS Grid Frequency" id: sunsynk_esphome_grid_frequency register_type: holding address: 79 unit_of_measurement: "hz" accuracy_decimals: 2 filters: #GOOD - lambda: |- x = x /1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - 65535) /100; else return (x) /100; #device_class: none state_class: measurement - platform: modbus_controller # 154 Grid Inverter Voltage modbus_controller_id: sunsynk_esphome name: "SS Grid Inverter Voltage" id: sunsynk_esphome_grid_inverter_voltage register_type: holding address: 154 unit_of_measurement: "V" accuracy_decimals: 1 filters: #GOOD - lambda: |- x = x / 1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - 65535) /10; else return (x) /10; device_class: voltage state_class: measurement - platform: modbus_controller # 150 Grid Voltage modbus_controller_id: sunsynk_esphome name: "SS Grid Voltage" id: sunsynk_esphome_grid_voltage register_type: holding address: 150 unit_of_measurement: "V" accuracy_decimals: 1 filters: #GOOD - lambda: |- x = x / 1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - 65535) /10; else return (x) /10; device_class: voltage state_class: measurement - platform: modbus_controller # 183 Battery Voltage modbus_controller_id: sunsynk_esphome name: "SS Battery Voltage" id: sunsynk_esphome_battery_voltage register_type: holding address: 183 unit_of_measurement: "V" accuracy_decimals: 1 filters: #GOOD - lambda: |- x = x /1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (x - 65535) / 100; else return x / 100; device_class: voltage state_class: measurement - platform: modbus_controller # 312 Battery Charge Voltage modbus_controller_id: sunsynk_esphome name: "SS Battery Charge Voltage" id: sunsynk_esphome_battery_charge_voltage register_type: holding address: 312 unit_of_measurement: "V" accuracy_decimals: 1 filters: #GOOD - lambda: |- x = x / -1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - x + 65535) /100; else return (0 - x) /100; device_class: voltage state_class: measurement - platform: modbus_controller # 167 Grid Inverter Load modbus_controller_id: sunsynk_esphome name: "SS Grid Inverter Load" id: sunsynk_esphome_grid_inverter_load register_type: holding address: 167 unit_of_measurement: "W" accuracy_decimals: 0 filters: #GOOD - lambda: |- x = x / 1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - 65535) /1; else return (x) /1; device_class: power state_class: measurement - platform: modbus_controller # 191 Battery Output Current modbus_controller_id: sunsynk_esphome name: "SS Battery Output Current" id: sunsynk_esphome_battery_output_current register_type: holding address: 191 unit_of_measurement: "A" accuracy_decimals: 1 device_class: current state_class: measurement filters: #GOOD - lambda: |- x = x / 1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - x + 65535) /100; else return (0 - x) /100; - platform: modbus_controller # 182 Battery Temperature modbus_controller_id: sunsynk_esphome name: "SS Battery Temperature" id: sunsynk_esphome_battery_temperature register_type: holding address: 182 unit_of_measurement: "°C" accuracy_decimals: 1 device_class: temperature state_class: measurement filters: # GOOD - lambda: |- x = x /1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return ((x - 65535)-1000) / 10; else return ((x)-1000) / 10; # - platform: modbus_controller # modbus_controller_id: sunsynk_esphome # name: "SS Environment Temp" # id: sunsynk_esphome_environment_temperature # register_type: holding # address: 095 # unit_of_measurement: "°C" # accuracy_decimals: 0 # device_class: temperature # state_class: measurement # filters: # - multiply: 0.1 - platform: modbus_controller # 090 DC Transformer Temperature modbus_controller_id: sunsynk_esphome name: "SS DC Transformer Temperature" id: sunsynk_esphome_dctransformer_temperature register_type: holding address: 090 unit_of_measurement: "°C" accuracy_decimals: 1 device_class: temperature state_class: measurement filters: # GOOD - lambda: |- x = x /1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return ((x - 65535)-1000) / 10; else return ((x)-1000) / 10; - platform: modbus_controller # 091 Radiator Temperature modbus_controller_id: sunsynk_esphome name: "SS DC Radiator Temperature" id: sunsynk_esphome_radiator_temperature register_type: holding address: 091 unit_of_measurement: "°C" accuracy_decimals: 1 device_class: temperature state_class: measurement filters: # GOOD - lambda: |- x = x /1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return ((x - 65535)-1000) / 10; else return ((x)-1000) / 10; - platform: modbus_controller #076 Grid Import Day (Buy) modbus_controller_id: sunsynk_esphome name: "SS Grid Import Day (Buy)" id: sunsynk_esphome_grid_import_day register_type: holding address: 76 unit_of_measurement: "kWh" accuracy_decimals: 0 device_class: energy state_class: total_increasing filters: # GOOD - lambda: |- x = x / 1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - 65535) / 10; else return x /10; - platform: modbus_controller # 070 Battery Charge Day modbus_controller_id: sunsynk_esphome name: "SS Battery Charge Day" id: sunsynk_esphome_battery_charge_day register_type: holding address: 70 unit_of_measurement: "kWh" accuracy_decimals: 1 device_class: energy state_class: total_increasing filters: #GOOD - lambda: |- x = x / 10; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - 65535) /1; else return (x) /1; - platform: modbus_controller # 071 Battery Discharge Day modbus_controller_id: sunsynk_esphome name: "SS Battery Discharge Day" id: sunsynk_esphome_battery_discharge_day register_type: holding address: 71 unit_of_measurement: "kWh" accuracy_decimals: 1 device_class: energy state_class: total_increasing filters: #GOOD - lambda: |- x = x / 10; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - 65535) /1; else return (x) /1; - platform: modbus_controller # 175 Inverter Output Power modbus_controller_id: sunsynk_esphome name: "SS Inverter Output Power" id: sunsynk_esphome_inverter_output_power register_type: holding address: 175 unit_of_measurement: "W" accuracy_decimals: 1 device_class: power filters: #GOOD - lambda: |- x = x /1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - x + 65535) /-1; else return (0 - x) /-1;
October 27, 20223 yr Hi I tried plugging into the top left RS485 port and get a bunch of CRC errors. Everything is wired up as per the previous posts. pin1 (orange/white) -->A pin2 (orange) -->B I also tried swapping A and B. Any ideas? INFO Reading configuration /config/sunsynk.yaml... WARNING GPIO4 is a Strapping PIN and should be avoided. Attaching external pullup/down resistors to strapping pins can cause unexpected failures. See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins INFO Starting log output from sunsynk.local using esphome API INFO Successfully connected to sunsynk.local [13:56:57][I][app:102]: ESPHome version 2022.10.0 compiled on Oct 23 2022, 16:48:26 [13:56:57][C][wifi:502]: WiFi: [13:56:57][C][wifi:360]: Local MAC: EC:62:60:9C:2B:E0 [13:56:57][C][wifi:361]: SSID: 'xxx'[redacted] [13:56:57][C][wifi:362]: IP Address: 10.0.0.35 [13:56:57][C][wifi:364]: BSSID: 60:63:4C:AA:B5:CF[redacted] [13:56:57][C][wifi:365]: Hostname: 'sunsynk' [13:56:57][C][wifi:367]: Signal strength: -60 dB ▂▄▆█ [13:56:57][C][wifi:371]: Channel: 3 [13:56:57][C][wifi:372]: Subnet: 255.255.255.0 [13:56:57][C][wifi:373]: Gateway: 10.0.0.2 [13:56:57][C][wifi:374]: DNS1: 10.0.0.101 [13:56:57][C][wifi:375]: DNS2: 1.1.1.1 [13:56:57][C][logger:275]: Logger: [13:56:57][C][logger:276]: Level: DEBUG [13:56:57][C][logger:277]: Log Baud Rate: 115200 [13:56:57][C][logger:278]: Hardware UART: UART0 [13:56:57][C][uart.arduino_esp32:107]: UART Bus: [13:56:57][C][uart.arduino_esp32:108]: TX Pin: GPIO17 [13:56:57][C][uart.arduino_esp32:109]: RX Pin: GPIO16 [13:56:57][C][uart.arduino_esp32:111]: RX Buffer Size: 256 [13:56:57][C][uart.arduino_esp32:113]: Baud Rate: 9600 baud [13:56:57][C][uart.arduino_esp32:114]: Data Bits: 8 [13:56:57][C][uart.arduino_esp32:115]: Parity: NONE [13:56:57][C][uart.arduino_esp32:116]: Stop bits: 1 [13:56:57][C][modbus:139]: Modbus: [13:56:57][C][modbus:140]: Flow Control Pin: GPIO4 [13:56:57][C][modbus:141]: Send Wait Time: 250 ms [13:56:57][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Total Battery Charge (kWh)' [13:56:57][C][modbus_controller.sensor:010]: modbus_controller.sensor Device Class: 'energy' [13:56:57][C][modbus_controller.sensor:010]: modbus_controller.sensor State Class: 'total_increasing' [13:56:58][C][modbus_controller.sensor:010]: modbus_controller.sensor Unit of Measurement: 'kWh' [13:56:58][C][modbus_controller.sensor:010]: modbus_controller.sensor Accuracy Decimals: 2 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! 944A!=08 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C569!=8140 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C081!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! 401F!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=1810 [13:56:58][W][modbus:105]: Modbus CRC Check failed! 385D!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! 9C5!=2030 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C7F1!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=1808 [13:56:58][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Total Battery Discharge (kWh)' [13:56:58][C][modbus_controller.sensor:010]: modbus_controller.sensor Device Class: 'energy' [13:56:58][C][modbus_controller.sensor:010]: modbus_controller.sensor State Class: 'total_increasing' [13:56:58][C][modbus_controller.sensor:010]: modbus_controller.sensor Unit of Measurement: 'kWh' [13:56:58][C][modbus_controller.sensor:010]: modbus_controller.sensor Accuracy Decimals: 2 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=18 [13:56:58][W][modbus:105]: Modbus CRC Check failed! EA97!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=800 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=A08 [13:56:58][W][modbus:105]: Modbus CRC Check failed! 57EE!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=20 [13:56:58][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Total Grid Export (kWh)' [13:56:58][C][modbus_controller.sensor:010]: modbus_controller.sensor Device Class: 'energy' [13:56:58][C][modbus_controller.sensor:010]: modbus_controller.sensor State Class: 'total_increasing' [13:56:58][C][modbus_controller.sensor:010]: modbus_controller.sensor Unit of Measurement: 'kWh' [13:56:58][C][modbus_controller.sensor:010]: modbus_controller.sensor Accuracy Decimals: 2 [13:56:58][W][modbus:105]: Modbus CRC Check failed! 32!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=800 [13:56:58][W][modbus:105]: Modbus CRC Check failed! 69E5!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! 65FA!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=800 [13:56:58][W][modbus:105]: Modbus CRC Check failed! 16BF!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! F4F2!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=2000 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=10 [13:56:58][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Total Grid Import (kWh)' [13:56:58][C][modbus_controller.sensor:010]: modbus_controller.sensor Device Class: 'energy' [13:56:58][C][modbus_controller.sensor:010]: modbus_controller.sensor State Class: 'total_increasing' [13:56:58][C][modbus_controller.sensor:010]: modbus_controller.sensor Unit of Measurement: 'kWh' [13:56:58][C][modbus_controller.sensor:010]: modbus_controller.sensor Accuracy Decimals: 2 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! 9DE1!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! 76!=40C [13:56:58][W][modbus:105]: Modbus CRC Check failed! A615!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! 130!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=1000 [13:56:58][W][modbus:105]: Modbus CRC Check failed! 77C1!=38 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! 76!=1840 [13:56:58][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Total Load Power (kWh)' [13:56:58][C][modbus_controller.sensor:010]: modbus_controller.sensor Device Class: 'energy' [13:56:58][C][modbus_controller.sensor:010]: modbus_controller.sensor State Class: 'total_increasing' [13:56:58][C][modbus_controller.sensor:010]: modbus_controller.sensor Unit of Measurement: 'kWh' [13:56:58][C][modbus_controller.sensor:010]: modbus_controller.sensor Accuracy Decimals: 2 [13:56:58][W][modbus:105]: Modbus CRC Check failed! C071!=00 [13:56:58][W][modbus:105]: Modbus CRC Check failed! E9EE!=800 Edited October 30, 20223 yr by slipx
October 27, 20223 yr Author 3 hours ago, jacauc said: @sjlouw Thank you for the esphome code! I have modified it somewhat and below is my current code if anyone is interested: esphome: name: "sunsynk" esp32: board: esp32dev framework: type: arduino #################################### STATIC SECTION #################################### wifi: ssid: !secret wifi_ssid password: !secret wifi_password fast_connect: true ap: ssid: '${device_name}' password: !secret fallback_password ota: safe_mode: true reboot_timeout: 10min num_attempts: 5 #web_server: # port: 80 # auth: # username: !secret esphome_web_username # password: !secret esphome_web_password #switch: # - platform: restart # name: "${device_name} Restart" captive_portal: esp32_ble_tracker: scan_parameters: active: true bluetooth_proxy: active: true # Enable logging logger: # Enable Home Assistant API api: password: !secret esphome_api_password # Enable time component to reset energy at midnight # https://esphome.io/components/time.html#home-assistant-time-source time: - platform: homeassistant id: homeassistant_time #################################### STATIC SECTION #################################### uart: id: mod_bus tx_pin: 17 rx_pin: 16 baud_rate: 9600 stop_bits: 1 modbus: id: sunsynk_modbus flow_control_pin: 4 modbus_controller: - id: sunsynk_esphome address: 0x01 modbus_id: sunsynk_modbus setup_priority: -10 update_interval: 5000ms sensor: - platform: modbus_controller #72 Battery Charge Total modbus_controller_id: sunsynk_esphome name: "SS Battery Charge Total" id: sunsynk_esphome_battery_charge_total register_type: holding address: 72 unit_of_measurement: "kWh" accuracy_decimals: 1 device_class: energy state_class: total_increasing filters: - lambda: |- x = x / -1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - x + 65535) /10; else return (0 - x) /10; - platform: modbus_controller #74 Battery Discharge Total modbus_controller_id: sunsynk_esphome name: "SS Battery Discharge Total" id: sunsynk_esphome_battery_discharge_total register_type: holding address: 74 unit_of_measurement: "kWh" accuracy_decimals: 0 device_class: energy state_class: total_increasing filters: - lambda: |- x = x / 1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - 65535) /10; else return (x) /10; # - platform: modbus_controller # 81 Grid Export Total (Sell) # modbus_controller_id: sunsynk_esphome # name: "SS Grid Export Total (Sell)" # id: sunsynk_esphome_grid_export_total_sell # register_type: holding # address: 81 # unit_of_measurement: "kWh" # accuracy_decimals: 2 # device_class: energy # state_class: total_increasing # filters: # - lambda: |- # x = x / 1; # float MAX_VALUE = 32767; # if (x > MAX_VALUE) return (0 - 65535) / 10; # else return x /10; - platform: modbus_controller # 78 Grid Import Total (Buy) modbus_controller_id: sunsynk_esphome name: "SS Grid Import Total (Buy)" id: sunsynk_esphome_grid_import_total_buy register_type: holding address: 78 unit_of_measurement: "kWh" accuracy_decimals: 0 device_class: energy state_class: total_increasing filters: #GOOD - lambda: |- x = x / -1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - x + 65535) /1; else return (0 - x) /1; - platform: modbus_controller # 85 Load Power Total modbus_controller_id: sunsynk_esphome name: "SS Load Power Total" id: sunsynk_esphome_load_power_total register_type: holding address: 85 unit_of_measurement: "kWh" accuracy_decimals: 0 device_class: energy state_class: total_increasing filters: #GOOD - lambda: |- x = x / 1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - x + 65535) /1; else return (0 - x) /1; # - platform: modbus_controller # modbus_controller_id: sunsynk_esphome # name: "SS Total PV Power (kWh)" # id: sunsynk_esphome_total_pv_power_kwh # register_type: holding # address: 96 # unit_of_measurement: "kWh" # accuracy_decimals: 2 # device_class: energy # state_class: total_increasing # filters: # - multiply: 0.1 - platform: modbus_controller # 169 Grid Power modbus_controller_id: sunsynk_esphome name: "SS Grid Power" id: sunsynk_esphome_grid_power register_type: holding address: 169 unit_of_measurement: "W" accuracy_decimals: 0 device_class: power state_class: measurement filters: #GOOD - lambda: |- x = x /1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - 65535) /1; else return (x) /1; - platform: modbus_controller # 178 Load Power modbus_controller_id: sunsynk_esphome name: "SS Load Power" id: sunsynk_esphome_load_power register_type: holding address: 178 unit_of_measurement: "W" accuracy_decimals: 0 device_class: power state_class: measurement filters: #GOOD - lambda: |- x = x /1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - 65535) /1; else return (x) /1; # - platform: modbus_controller # modbus_controller_id: sunsynk_esphome # name: "SS PV1 Power" # id: sunsynk_esphome_pv1_power # register_type: holding # address: 186 # unit_of_measurement: "W" # accuracy_decimals: 2 # device_class: power # state_class: measurement # - platform: modbus_controller # modbus_controller_id: sunsynk_esphome # name: "SS PV2 Power" # id: sunsynk_esphome_pv2_power # register_type: holding # address: 187 # unit_of_measurement: "W" # accuracy_decimals: 2 # device_class: power # state_class: measurement - platform: modbus_controller # 184 Battery SOC modbus_controller_id: sunsynk_esphome name: "SS Battery SOC" id: sunsynk_esphome_battery_soc register_type: holding address: 184 unit_of_measurement: "%" accuracy_decimals: 0 device_class: battery state_class: measurement filters: #GOOD - lambda: |- x = x /1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - 65535) /1; else return (x) /1; - platform: modbus_controller # 216 Battery Charging Efficiency modbus_controller_id: sunsynk_esphome name: "SS Battery Charging Efficiency" id: sunsynk_esphome_battery_charging_efficiency register_type: holding address: 216 unit_of_measurement: "%" accuracy_decimals: 1 device_class: battery state_class: measurement filters: #GOOD - lambda: |- x = x /1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - 65535) /10; else return (x) /10; - platform: modbus_controller # 194 Grid Connected Status modbus_controller_id: sunsynk_esphome name: "SS Grid Connected Status" id: sunsynk_esphome_grid_connected_status register_type: holding address: 194 accuracy_decimals: 0 - platform: modbus_controller # 059 Overall State modbus_controller_id: sunsynk_esphome name: "SS Overall State" id: sunsynk_esphome_overall_state register_type: holding address: 59 - platform: modbus_controller # 013 Firmware Control Board modbus_controller_id: sunsynk_esphome name: "SS Firmware Control Board" id: sunsynk_esphome_firmware_control_board register_type: holding address: 13 - platform: modbus_controller # 013 Firmware Comms Board modbus_controller_id: sunsynk_esphome name: "SS Firmware Comms Board" id: sunsynk_esphome_firmware_comms_board register_type: holding address: 14 - platform: modbus_controller # 079 Grid Frequency modbus_controller_id: sunsynk_esphome name: "SS Grid Frequency" id: sunsynk_esphome_grid_frequency register_type: holding address: 79 unit_of_measurement: "hz" accuracy_decimals: 2 filters: #GOOD - lambda: |- x = x /1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - 65535) /100; else return (x) /100; #device_class: none state_class: measurement - platform: modbus_controller # 154 Grid Inverter Voltage modbus_controller_id: sunsynk_esphome name: "SS Grid Inverter Voltage" id: sunsynk_esphome_grid_inverter_voltage register_type: holding address: 154 unit_of_measurement: "V" accuracy_decimals: 1 filters: #GOOD - lambda: |- x = x / 1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - 65535) /10; else return (x) /10; device_class: voltage state_class: measurement - platform: modbus_controller # 150 Grid Voltage modbus_controller_id: sunsynk_esphome name: "SS Grid Voltage" id: sunsynk_esphome_grid_voltage register_type: holding address: 150 unit_of_measurement: "V" accuracy_decimals: 1 filters: #GOOD - lambda: |- x = x / 1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - 65535) /10; else return (x) /10; device_class: voltage state_class: measurement - platform: modbus_controller # 183 Battery Voltage modbus_controller_id: sunsynk_esphome name: "SS Battery Voltage" id: sunsynk_esphome_battery_voltage register_type: holding address: 183 unit_of_measurement: "V" accuracy_decimals: 1 filters: #GOOD - lambda: |- x = x /1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (x - 65535) / 100; else return x / 100; device_class: voltage state_class: measurement - platform: modbus_controller # 312 Battery Charge Voltage modbus_controller_id: sunsynk_esphome name: "SS Battery Charge Voltage" id: sunsynk_esphome_battery_charge_voltage register_type: holding address: 312 unit_of_measurement: "V" accuracy_decimals: 1 filters: #GOOD - lambda: |- x = x / -1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - x + 65535) /100; else return (0 - x) /100; device_class: voltage state_class: measurement - platform: modbus_controller # 167 Grid Inverter Load modbus_controller_id: sunsynk_esphome name: "SS Grid Inverter Load" id: sunsynk_esphome_grid_inverter_load register_type: holding address: 167 unit_of_measurement: "W" accuracy_decimals: 0 filters: #GOOD - lambda: |- x = x / 1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - 65535) /1; else return (x) /1; device_class: power state_class: measurement - platform: modbus_controller # 191 Battery Output Current modbus_controller_id: sunsynk_esphome name: "SS Battery Output Current" id: sunsynk_esphome_battery_output_current register_type: holding address: 191 unit_of_measurement: "A" accuracy_decimals: 1 device_class: current state_class: measurement filters: #GOOD - lambda: |- x = x / 1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - x + 65535) /100; else return (0 - x) /100; - platform: modbus_controller # 182 Battery Temperature modbus_controller_id: sunsynk_esphome name: "SS Battery Temperature" id: sunsynk_esphome_battery_temperature register_type: holding address: 182 unit_of_measurement: "°C" accuracy_decimals: 1 device_class: temperature state_class: measurement filters: # GOOD - lambda: |- x = x /1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return ((x - 65535)-1000) / 10; else return ((x)-1000) / 10; # - platform: modbus_controller # modbus_controller_id: sunsynk_esphome # name: "SS Environment Temp" # id: sunsynk_esphome_environment_temperature # register_type: holding # address: 095 # unit_of_measurement: "°C" # accuracy_decimals: 0 # device_class: temperature # state_class: measurement # filters: # - multiply: 0.1 - platform: modbus_controller # 090 DC Transformer Temperature modbus_controller_id: sunsynk_esphome name: "SS DC Transformer Temperature" id: sunsynk_esphome_dctransformer_temperature register_type: holding address: 090 unit_of_measurement: "°C" accuracy_decimals: 1 device_class: temperature state_class: measurement filters: # GOOD - lambda: |- x = x /1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return ((x - 65535)-1000) / 10; else return ((x)-1000) / 10; - platform: modbus_controller # 091 Radiator Temperature modbus_controller_id: sunsynk_esphome name: "SS DC Radiator Temperature" id: sunsynk_esphome_radiator_temperature register_type: holding address: 091 unit_of_measurement: "°C" accuracy_decimals: 1 device_class: temperature state_class: measurement filters: # GOOD - lambda: |- x = x /1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return ((x - 65535)-1000) / 10; else return ((x)-1000) / 10; - platform: modbus_controller #076 Grid Import Day (Buy) modbus_controller_id: sunsynk_esphome name: "SS Grid Import Day (Buy)" id: sunsynk_esphome_grid_import_day register_type: holding address: 76 unit_of_measurement: "kWh" accuracy_decimals: 0 device_class: energy state_class: total_increasing filters: # GOOD - lambda: |- x = x / 1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - 65535) / 10; else return x /10; - platform: modbus_controller # 070 Battery Charge Day modbus_controller_id: sunsynk_esphome name: "SS Battery Charge Day" id: sunsynk_esphome_battery_charge_day register_type: holding address: 70 unit_of_measurement: "kWh" accuracy_decimals: 1 device_class: energy state_class: total_increasing filters: #GOOD - lambda: |- x = x / 10; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - 65535) /1; else return (x) /1; - platform: modbus_controller # 071 Battery Discharge Day modbus_controller_id: sunsynk_esphome name: "SS Battery Discharge Day" id: sunsynk_esphome_battery_discharge_day register_type: holding address: 71 unit_of_measurement: "kWh" accuracy_decimals: 1 device_class: energy state_class: total_increasing filters: #GOOD - lambda: |- x = x / 10; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - 65535) /1; else return (x) /1; - platform: modbus_controller # 175 Inverter Output Power modbus_controller_id: sunsynk_esphome name: "SS Inverter Output Power" id: sunsynk_esphome_inverter_output_power register_type: holding address: 175 unit_of_measurement: "W" accuracy_decimals: 1 device_class: power filters: #GOOD - lambda: |- x = x /1; float MAX_VALUE = 32767; if (x > MAX_VALUE) return (0 - x + 65535) /-1; else return (0 - x) /-1; Thanks for the code @jacauc Which firmware is you inverter running?
October 27, 20223 yr 7 minutes ago, Sc00bs said: Thanks for the code @jacauc Which firmware is you inverter running? Not sure where to look. Is this it?
October 27, 20223 yr Author 1 hour ago, jacauc said: Not sure where to look. Is this it? You have a 5kw I assume?
October 27, 20223 yr Author Have asked for an update as it looks like my firmware is quite old. Will see if that makes a difference with me being able to connect using the ESP32
October 27, 20223 yr 5 minutes ago, Sc00bs said: Have asked for an update as it looks like my firmware is quite old. Will see if that makes a difference with me being able to connect using the ESP32 I doubt. If it worked before with Raspberry there's no reason it won't work with ESP. The modbus protocol is pretty simple,so can't see why it won't work that way. I would suggest trying not bridging the middle two pins on that modbus converter @sjlouw used and trying each of them independently. I actually used my raspberry pi rs485 HAT and wired it into the ESP32 Edited October 27, 20223 yr by jacauc
October 27, 20223 yr Author Thanks @jacauc will play around with the pins and see if that works. It is working without any issues on my Intel Nuc connecting using a USB-RS485 adapter and Bloubuls Node Red flows so what you are saying makes sense.
October 28, 20223 yr Author On 2022/10/25 at 7:19 PM, slipx said: Same problem on a new install. I wonder if something changed with latest firmware. EDIT. Think I might be using the wrong port. I was trying using the one on the bottom right, not top left Only one RS485 port on the 8kw
October 28, 20223 yr Instead of posting my esphome configs here, I'm uploading them to github (partly just for keeping for my own backup) Recently added all the setting values https://github.com/jacauc/SunsynkEsphome Edited October 28, 20223 yr by jacauc
October 28, 20223 yr I managed to get mine working. I had to remove the R7 resistor to increase the D.C. voltage across A/B. I also wired both 2 and 7 -- >A and 1 and 8 -->B
October 28, 20223 yr Author 2 hours ago, slipx said: I managed to get mine working. I had to remove the R7 resistor to increase the D.C. voltage across A/B. I also wired both 2 and 7 -- >A and 1 and 8 -->B Thanks @slipx Will give that a go as well
October 28, 20223 yr Author 38 minutes ago, Sc00bs said: Thanks @slipx Will give that a go as well Yay, finally working, I think that removing R7 did the trick. I have an 8kw so maybe they need the R7 to be removed to work on them for some strange reason
October 29, 20223 yr Author 17 hours ago, slipx said: I managed to get mine working. I had to remove the R7 resistor to increase the D.C. voltage across A/B. I also wired both 2 and 7 -- >A and 1 and 8 -->B Do you have an 8Kw inverter @slipx @sjlouw? Wondering if the removal of the R7 resistor is specific to the 8kw as mine would not connect with the resistor in place but some people do not seem to have that issue, most (all maybe) seem to be on the 5kw inverter.
October 29, 20223 yr Author @jacauc Would be nice to be able to not waste querying cycles to the inverter on values which do not change as quickly e.g. the Daily totals and spend more cycles on the values such as PV Power etc. I see in your example you aren't monitoring PV power. Was thinking of putting together an example with all the Inverter values and people can just # out the ones they don't require Do you think that we could write values back to the inverter using ESPhome as well?
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.