In case it helps someone… I have 3 Solis inverters, and get the hourly power from each using ModBus / ESPHome and use that in HA Energy. Only one ESP8266 + ModBus board required.
- I found the plastic bit (after removing the threaded piece) of a bulk standard 7 pin DIN socket was the perfect fit to the inverter data connection. I 3D printed a screw on cover - but this is not necessary. No need to spend money on the genuine connector
- I used a WeMos D1 mini
- And a cheap RS485 adaptor XY-017 3.3v 5v 12v RS485 to TTL RS485 SP3485 RS-485 Breakout for Arduino RPI | eBay
R0 on the adaptor needs to be populated with a 0ohm resistor (a blob of solder) - this connects in the in-built 120ohm resistor across A and B. I also connected the ‘ground’ contact (Chinese characters) on the ModBus end of the adaptor to the ‘ground’ pins on the inverter data socket (but not to the ground or common on the ESP8266).
substitutions:
device_name: "ESP8266 ModBus"
esphome:
name: esp8266-modbus
globals:
- id: my_global_int
type: int
restore_value: no
initial_value: '0'
esp8266:
board: d1_mini
# Enable logging
logger:
level: VERBOSE #makes uart stream available in esphome logstream
baud_rate: 0 #disable logging over uart
# Enable Home Assistant API
api:
encryption:
key: "xxxxxxxxxxxxxxxxxxx"
ota:
password: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp8266-Modbus Fallback Hotspot"
password: "xxxxxxxxxxxxxxxxxxxxxxxxxxx"
captive_portal:
uart:
id: uart_modbus
tx_pin: TX
rx_pin: RX
baud_rate: 9600
time:
- platform: homeassistant
id: hatime
timezone: Etc/GMT+0
modbus:
id: modbus1
uart_id: uart_modbus
modbus_controller:
- id: modbus1_01
address: 0x0001
modbus_id: modbus1
update_interval: 10s
setup_priority: -10
- id: modbus1_02
address: 0x0002
modbus_id: modbus1
update_interval: 10s
setup_priority: -9
- id: modbus1_03
address: 0x0003
modbus_id: modbus1
update_interval: 10s
setup_priority: -8
sensor:
- platform: wifi_signal
name: "${device_name} WiFi Signal Sensor"
update_interval: 60s
- platform: modbus_controller
modbus_controller_id: modbus1_01
id: today_power_p1
name: "${device_name} Phase 1 Power Generated Today"
address: 3014
unit_of_measurement: "Wh"
register_type: read
value_type: U_WORD
filters:
- multiply: 100
state_class: total_increasing
device_class: energy
- platform: modbus_controller
modbus_controller_id: modbus1_02
id: today_power_p2
name: "${device_name} Phase 2 Power Generated Today"
address: 3014
unit_of_measurement: "Wh"
register_type: read
value_type: U_WORD
filters:
- multiply: 100
state_class: total_increasing
device_class: energy
- platform: modbus_controller
modbus_controller_id: modbus1_03
id: today_power_p3
name: "${device_name} Phase 3 Power Generated Today"
address: 3014
unit_of_measurement: "Wh"
register_type: read
value_type: U_WORD
filters:
- multiply: 100
state_class: total_increasing
device_class: energy
