Open spitfire opened 10 months ago
I've started working on this, you can check my progress on my fork: https://github.com/SibrenVasse/Foxess-T-series-ESPHome-Home-Assistant
I've started working on this, you can check my progress on my fork: https://github.com/SibrenVasse/Foxess-T-series-ESPHome-Home-Assistant
Hey, first of all thanks for working on that! I've tried to migrate over by changing
includes:
- templates/Foxess-T-series-ESPHome-Home-Assistant/foxess_t_series.h
from this repo to
external_components:
- source:
type: git
url: https://github.com/SibrenVasse/Foxess-T-series-ESPHome-Home-Assistant
shown in your example yaml.
Unfortunately it spawned this error at compile time:
/config/foxess-inverter.yaml: In lambda function:
/config/foxess-inverter.yaml:122:32: error: expected type-specifier before 'foxesscomponent'
auto foxesssensors = new foxesscomponent(id(uart_bus));
^~~~~~~~~~~~~~~
/config/foxess-inverter.yaml:158:7: error: could not convert '{<expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'std::vector<esphome::sensor::Sensor*>'
};
^
which seem to be related to lambda function from https://github.com/assembly12/Foxess-T-series-ESPHome-Home-Assistant/blob/main/foxess-inverter.yaml (line 61-100 here).
Is there any way to cleanly replace that? I've seen your https://github.com/SibrenVasse/Foxess-T-series-ESPHome-Home-Assistant/blob/main/foxess-inverter.yaml.example, but I'm afraid it would completely replace my entity names and anything depending on them in the process.
You have to replace everything below the 'uart:' section with the sections from the new yaml example.
If you're worried about entities changing name in Home Asisstant, you have to make sure the new sensor has the same 'name' field in the yaml file. Like this:
button:
- platform: restart
name: "Foxess inverter restart"
text_sensor:
- platform: template
name: "T-Series Inverter Mode"
id: "inverter_mode_text_sensor"
icon: mdi:solar-power-variant
sensor:
- platform: foxess_solar
phase_a:
voltage:
name: "T-Series Grid Voltage R"
current:
name: "T-Series Grid Current R"
active_power:
name: "T-Series Grid Power R"
frequency:
name: "T-Series Grid Frequency R"
phase_b:
voltage:
name: "T-Series Grid Voltage S"
current:
name: "T-Series Grid Current S"
active_power:
name: "T-Series Grid Power S"
frequency:
name: "T-Series Grid Frequency S"
phase_c:
voltage:
name: "T-Series Grid Voltage T"
current:
name: "T-Series Grid Current T"
active_power:
name: "T-Series Grid Power T"
frequency:
name: "T-Series Grid Frequency T"
pv1:
voltage:
name: "T-Series PV1 Voltage"
current:
name: "T-Series PV1 Current"
active_power:
name: "T-Series PV1 Power"
pv2:
voltage:
name: "T-Series PV2 Voltage"
current:
name: "T-Series PV2 Current"
active_power:
name: "T-Series PV2 Power"
pv3:
voltage:
name: "T-Series PV3 Voltage"
current:
name: "T-Series PV3 Current"
active_power:
name: "T-Series PV3 Power"
pv4:
voltage:
name: "T-Series PV4 Voltage"
current:
name: "T-Series PV4 Current"
active_power:
name: "T-Series PV4 Power"
total_energy_production:
name: "T-Series Generation Total"
energy_production_day:
name: "T-Series Today Yield"
generation_power:
name: "T-Series Generation Power"
grid_power:
name: "T-Series Grid Power"
loads_power:
name: "T-Series loads Power"
inverter_temp:
name: "T-Series Inverter Temperature"
ambient_temp:
name: "T-Series Ambient Temperature"
boost_temp:
name: "T-Series Boost Temperature"
inverter_status:
name: "T-Series Inverter State"
internal: true
on_value:
then:
- lambda: |-
if (x==0) {
id(inverter_mode_text_sensor).publish_state("Offline");
} else if (x==1) {
id(inverter_mode_text_sensor).publish_state("Online");
} else if (x==2) {
id(inverter_mode_text_sensor).publish_state("Error");
} else {
id(inverter_mode_text_sensor).publish_state("Waiting for response...");
}
# Uncomment this sensor and the i2c section to use the AHT10
# - platform: aht10
# temperature:
# name: "Foxess inverter ambient Temperature"
# humidity:
# name: "Foxess inverter ambient Humidity"
#i2c:
You have to replace everything below the 'uart:' section with the sections from the new yaml example.
If you're worried about entities changing name in Home Asisstant, you have to make sure the new sensor has the same 'name' field in the yaml file.
thanks for adapting it for me, that helped me a lot!
I've adapted it further to work with LilyGo T-CAN485 board I'm using (works great with no need to add voltage controllers or RS485 components):
# Set pins required for LilyGo T-CAN485 board
output:
- platform: gpio
id: ENABLE_PIN # Enable the chip
pin:
number: GPIO19
inverted: true
- platform: gpio
id: SE_PIN # Enable autodirection
pin:
number: GPIO17
inverted: true
allow_other_uses: true
- platform: gpio
id: ENABLE_5V_PIN # Enable 5V pin for RS485 chip
pin:
number: GPIO16
inverted: true
# Configure uart that will be used
uart:
id: uart_bus
rx_pin: GPIO21
tx_pin: GPIO22
baud_rate: 9600
# debug:
I have an optional light section for control over the built in LED:
light:
- platform: esp32_rmt_led_strip
id: led_light
name: "${friendly_name} Light"
pin:
number: GPIO04
num_leds: 1
rmt_channel: 0
rgb_order: GRB
chipset: ws2812
which I'm using to show different color depending on energy production:
generation_power:
name: "T-Series Generation Power"
on_value_range:
- below: 1.0
then:
- light.turn_on:
id: led_light
red: "100%"
green: 0
blue: 0
- above: 1.0
below: 1000.0
then:
- light.turn_on:
id: led_light
red: "100%"
green: "100%"
blue: 0
- above: 1000.0
below: 2000.0
then:
- light.turn_on:
id: led_light
red: 0
green: 0
blue: "100%"
- above: 2000.0
then:
- light.turn_on:
id: led_light
red: 0
green: "100%"
blue: 0
I had to add configuration for flow control pin, it seems to be GPIO17 on that board:
flow_control_pin:
number: GPIO17
inverted: true
allow_other_uses: true
I've started working on this, you can check my progress on my fork: https://github.com/SibrenVasse/Foxess-T-series-ESPHome-Home-Assistant
@SibrenVasse for some reason your version fails to update some of the sensors, while the version from this repo does. I've noticed my Foxess Inverter T-Series Today Yield (and Total) was updating very infrequently (less often than once an hour) messing up my statistics.
[12:31:10][W][component:170]: Component foxess_solar.sensor cleared Warning flag
[12:31:10][W][FoxessSolar::parse_message:134]: Unexpected msg length, length: 165
[12:31:10][W][component:157]: Component foxess_solar.sensor set Warning flag: unspecified
[12:31:10][D][sensor:094]: 'T-Series Grid Power': Sending state 0.00000 W with 0 decimals of accuracy
[12:31:10][D][sensor:094]: 'T-Series Generation Power': Sending state 3576.00000 W with 0 decimals of accuracy
[12:31:10][D][sensor:094]: 'T-Series loads Power': Sending state 0.00000 W with 0 decimals of accuracy
[12:31:10][D][sensor:094]: 'T-Series Grid Voltage R': Sending state 249.50000 V with 1 decimals of accuracy
[12:31:10][D][sensor:094]: 'T-Series Grid Current R': Sending state 4.70000 A with 1 decimals of accuracy
[12:31:10][D][sensor:094]: 'T-Series Grid Frequency R': Sending state 49.98000 Hz with 2 decimals of accuracy
[12:31:10][D][sensor:094]: 'T-Series Grid Power R': Sending state 1192.00000 W with 0 decimals of accuracy
[12:31:10][D][sensor:094]: 'T-Series Grid Voltage S': Sending state 252.50000 V with 1 decimals of accuracy
[12:31:10][D][sensor:094]: 'T-Series Grid Current S': Sending state 4.80000 A with 1 decimals of accuracy
[12:31:10][D][sensor:094]: 'T-Series Grid Frequency S': Sending state 49.98000 Hz with 2 decimals of accuracy
[12:31:10][D][sensor:094]: 'T-Series Grid Power S': Sending state 1192.00000 W with 0 decimals of accuracy
[12:31:10][D][sensor:094]: 'T-Series Grid Voltage T': Sending state 249.20000 V with 1 decimals of accuracy
[12:31:10][D][sensor:094]: 'T-Series Grid Current T': Sending state 4.80000 A with 1 decimals of accuracy
[12:31:10][D][sensor:094]: 'T-Series Grid Frequency T': Sending state 49.98000 Hz with 2 decimals of accuracy
[12:31:18][D][sensor:094]: 'WiFi Signal dB': Sending state -49.00000 dBm with 0 decimals of accuracy
[12:31:18][D][sensor:094]: 'WiFi Signal Percent': Sending state 100.00000 % with 0 decimals of accuracy
[12:31:19][D][esp32.preferences:114]: Saving 1 preferences to flash...
[12:31:19][D][esp32.preferences:143]: Saving 1 preferences to flash: 1 cached, 0 written, 0 failed
[12:31:20][D][internal_temperature:069]: Ignoring invalid temperature (success=0, value=53.3)
[12:32:18][D][sensor:094]: 'WiFi Signal dB': Sending state -47.00000 dBm with 0 decimals of accuracy
[12:32:18][D][sensor:094]: 'WiFi Signal Percent': Sending state 100.00000 % with 0 decimals of accuracy
[12:32:20][D][internal_temperature:069]: Ignoring invalid temperature (success=0, value=53.3)
[12:33:10][W][component:170]: Component foxess_solar.sensor cleared Warning flag
[12:33:10][W][FoxessSolar::parse_message:134]: Unexpected msg length, length: 165
[12:33:10][W][component:157]: Component foxess_solar.sensor set Warning flag: unspecified
[12:33:10][D][sensor:094]: 'T-Series Grid Power': Sending state 0.00000 W with 0 decimals of accuracy
[12:33:10][D][sensor:094]: 'T-Series Generation Power': Sending state 3573.00000 W with 0 decimals of accuracy
[12:33:10][D][sensor:094]: 'T-Series loads Power': Sending state 0.00000 W with 0 decimals of accuracy
[12:33:10][D][sensor:094]: 'T-Series Grid Voltage R': Sending state 253.90001 V with 1 decimals of accuracy
[12:33:10][D][sensor:094]: 'T-Series Grid Current R': Sending state 4.70000 A with 1 decimals of accuracy
[12:33:10][D][sensor:094]: 'T-Series Grid Frequency R': Sending state 49.96000 Hz with 2 decimals of accuracy
[12:33:10][D][sensor:094]: 'T-Series Grid Power R': Sending state 1191.00000 W with 0 decimals of accuracy
[12:33:10][D][sensor:094]: 'T-Series Grid Voltage S': Sending state 251.40001 V with 1 decimals of accuracy
[12:33:10][D][sensor:094]: 'T-Series Grid Current S': Sending state 4.80000 A with 1 decimals of accuracy
[12:33:10][D][sensor:094]: 'T-Series Grid Frequency S': Sending state 49.96000 Hz with 2 decimals of accuracy
[12:33:10][D][sensor:094]: 'T-Series Grid Power S': Sending state 1191.00000 W with 0 decimals of accuracy
[12:33:10][D][sensor:094]: 'T-Series Grid Voltage T': Sending state 251.60001 V with 1 decimals of accuracy
[12:33:10][D][sensor:094]: 'T-Series Grid Current T': Sending state 4.70000 A with 1 decimals of accuracy
[12:33:10][D][sensor:094]: 'T-Series Grid Frequency T': Sending state 49.96000 Hz with 2 decimals of accuracy
[12:33:18][D][sensor:094]: 'WiFi Signal dB': Sending state -48.00000 dBm with 0 decimals of accuracy
[12:33:18][D][sensor:094]: 'WiFi Signal Percent': Sending state 100.00000 % with 0 decimals of accuracy
[12:33:19][D][esp32.preferences:114]: Saving 1 preferences to flash...
using code from this repo returns all data, all the time (every 2 minutes for my inverter):
[12:39:10][I][custom:113]: User data length: 152
[12:39:10][I][custom:114]: Total message length: 165
[12:39:10][D][sensor:094]: 'T-Series Grid Power': Sending state 0.00000 W with 0 decimals of accuracy
[12:39:10][D][sensor:094]: 'T-Series Generation Power': Sending state 3576.00000 W with 0 decimals of accuracy
[12:39:10][D][sensor:094]: 'T-Series loads Power': Sending state 0.00000 W with 0 decimals of accuracy
[12:39:10][D][sensor:094]: 'T-Series Grid Voltage R': Sending state 251.50000 V with 1 decimals of accuracy
[12:39:10][D][sensor:094]: 'T-Series Grid Current R': Sending state 4.80000 A with 1 decimals of accuracy
[12:39:11][D][sensor:094]: 'T-Series Grid Frequency R': Sending state 50.00000 Hz with 2 decimals of accuracy
[12:39:11][D][sensor:094]: 'T-Series Grid Power R': Sending state 1192.00000 W with 0 decimals of accuracy
[12:39:11][D][sensor:094]: 'T-Series Grid Voltage S': Sending state 249.60001 V with 1 decimals of accuracy
[12:39:11][D][sensor:094]: 'T-Series Grid Current S': Sending state 4.80000 A with 1 decimals of accuracy
[12:39:11][D][sensor:094]: 'T-Series Grid Frequency S': Sending state 50.00000 Hz with 2 decimals of accuracy
[12:39:11][D][sensor:094]: 'T-Series Grid Power S': Sending state 1192.00000 W with 0 decimals of accuracy
[12:39:11][D][sensor:094]: 'T-Series Grid Voltage T': Sending state 247.70000 V with 1 decimals of accuracy
[12:39:11][D][sensor:094]: 'T-Series Grid Current T': Sending state 4.80000 A with 1 decimals of accuracy
[12:39:11][D][sensor:094]: 'T-Series Grid Frequency T': Sending state 50.00000 Hz with 2 decimals of accuracy
[12:39:11][D][sensor:094]: 'T-Series Grid Power T': Sending state 1192.00000 W with 0 decimals of accuracy
[12:39:11][D][sensor:094]: 'T-Series PV1 Voltage': Sending state 358.60001 V with 1 decimals of accuracy
[12:39:11][D][sensor:094]: 'T-Series PV1 Current': Sending state 5.60000 A with 1 decimals of accuracy
[12:39:11][D][sensor:094]: 'T-Series PV2 Voltage': Sending state 376.10001 V with 1 decimals of accuracy
[12:39:11][D][sensor:094]: 'T-Series PV2 Current': Sending state 4.40000 A with 1 decimals of accuracy
[12:39:11][D][sensor:094]: 'T-Series PV3 Voltage': Sending state 0.00000 V with 1 decimals of accuracy
[12:39:11][D][sensor:094]: 'T-Series PV3 Current': Sending state 0.00000 A with 1 decimals of accuracy
[12:39:11][D][sensor:094]: 'T-Series PV4 Voltage': Sending state 0.00000 V with 1 decimals of accuracy
[12:39:11][D][sensor:094]: 'T-Series PV4 Current': Sending state 0.00000 A with 1 decimals of accuracy
[12:39:12][D][sensor:094]: 'T-Series Boost Temperature': Sending state 51.00000 °C with 0 decimals of accuracy
[12:39:12][D][sensor:094]: 'T-Series Inverter Temperature': Sending state 51.00000 °C with 0 decimals of accuracy
[12:39:12][D][sensor:094]: 'T-Series Ambient Temperature': Sending state 52.00000 °C with 0 decimals of accuracy
[12:39:12][D][sensor:094]: 'T-Series Today Yield': Sending state 12.70000 kWh with 1 decimals of accuracy
[12:39:12][D][sensor:094]: 'T-Series Generation Total': Sending state 17386.59961 kWh with 1 decimals of accuracy
[12:39:12][D][sensor:094]: 'T-Series PV1 Power': Sending state 2008.00000 W with 1 decimals of accuracy
[12:39:12][D][sensor:094]: 'T-Series PV2 Power': Sending state 1654.00000 W with 1 decimals of accuracy
[12:39:12][D][sensor:094]: 'T-Series PV3 Power': Sending state 0.00000 W with 1 decimals of accuracy
[12:39:12][D][sensor:094]: 'T-Series PV4 Power': Sending state 0.00000 W with 1 decimals of accuracy
[12:39:12][D][sensor:094]: 'T-Series Inverter State': Sending state 1.00000 with 0 decimals of accuracy
[12:39:12][D][text_sensor:064]: 'T-Series Inverter Mode': Sending state 'Online'
[12:39:12][W][component:237]: Component <unknown> took a long time for an operation (2119 ms).
[12:39:12][W][component:238]: Components should block for at most 30 ms.
Can you upload your yaml file? So I can check that everything is the same in my environment.
Here's the config I'm using. The commented out part is the 100% working code from here. The uncommented is derived from yours that fails to process part of the message received from Foxess inverter.
substitutions:
name: "foxess-inverter"
friendly_name: "Foxess Inverter"
device_description: "Modbus interface for Foxess Inverter"
esphome:
name: ${name}
friendly_name: ${friendly_name}
comment: ${device_description}
# includes:
# - templates/Foxess-T-series-ESPHome-Home-Assistant/foxess_t_series.h #Legacy, from https://github.com/assembly12/Foxess-T-series-ESPHome-Home-Assistant
esp32:
board: esp32dev
framework:
# type: arduino
type: esp-idf
# version: "5.3.1" #src/foxess_t_series.h:351:30: error: format '%i' expects argument of type 'int', but argument 5 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
# platform_version: 6.9.0
external_components:
- source:
type: git
url: https://github.com/SibrenVasse/Foxess-T-series-ESPHome-Home-Assistant
# Enable logging
logger:
baud_rate: 0
# level: VERBOSE
# logs:
# light: VERBOSE
<<: !include templates/spitfire/common/api.yaml
<<: !include templates/spitfire/common/ota.yaml
<<: !include templates/spitfire/common/wifi.yaml
<<: !include templates/spitfire/common/webserver.yaml
<<: !include templates/spitfire/common/time.yaml
#bluetooth_proxy:
#active: true
# Set pins required for LilyGo T-CAN485 board
output:
- platform: gpio
id: ENABLE_PIN # Enable the chip
pin:
number: GPIO19
inverted: true
- platform: gpio
id: SE_PIN # Enable autodirection
pin:
number: GPIO17
inverted: true
allow_other_uses: true
- platform: gpio
id: ENABLE_5V_PIN # Enable 5V pin for RS485 chip
pin:
number: GPIO16
inverted: true
# Configure uart that will be used
uart:
id: uart_bus
rx_pin: GPIO21
tx_pin: GPIO22
baud_rate: 9600
# debug:
binary_sensor:
- !include templates/spitfire/common/status.yaml
button:
- !include templates/spitfire/common/restart.yaml
- !include templates/spitfire/common/safe_mode.yaml
switch:
- platform: gpio
pin:
number: 17
allow_other_uses: true
name: "T-Series sending mode" #if "on" reading from inverter doesn't work!
internal: true #switch is not exposed to HA frontend, should you ever need to write to the inverter, just comment this line
text_sensor:
- !include templates/spitfire/common/text_sensor-wifi.yaml
- platform: template
name: "T-Series Inverter Mode"
id: "inverter_mode_text_sensor"
icon: mdi:solar-power-variant
light:
- platform: esp32_rmt_led_strip
id: led_light
name: "${friendly_name} Light"
pin:
number: GPIO04
# allow_other_uses: true
num_leds: 1
rmt_channel: 0
rgb_order: GRB
chipset: ws2812
sensor:
- !include templates/spitfire/common/esp32-internal_temperature.yaml
- !include templates/spitfire/common/wifi_signal_db.yaml
- !include templates/spitfire/common/wifi_signal_percent.yaml
- !include templates/spitfire/common/uptime.yaml
- platform: foxess_solar
phase_a:
voltage:
name: "T-Series Grid Voltage R"
current:
name: "T-Series Grid Current R"
active_power:
name: "T-Series Grid Power R"
frequency:
name: "T-Series Grid Frequency R"
phase_b:
voltage:
name: "T-Series Grid Voltage S"
current:
name: "T-Series Grid Current S"
active_power:
name: "T-Series Grid Power S"
frequency:
name: "T-Series Grid Frequency S"
phase_c:
voltage:
name: "T-Series Grid Voltage T"
current:
name: "T-Series Grid Current T"
active_power:
name: "T-Series Grid Power T"
frequency:
name: "T-Series Grid Frequency T"
pv1:
voltage:
name: "T-Series PV1 Voltage"
current:
name: "T-Series PV1 Current"
active_power:
name: "T-Series PV1 Power"
pv2:
voltage:
name: "T-Series PV2 Voltage"
current:
name: "T-Series PV2 Current"
active_power:
name: "T-Series PV2 Power"
pv3:
voltage:
name: "T-Series PV3 Voltage"
current:
name: "T-Series PV3 Current"
active_power:
name: "T-Series PV3 Power"
pv4:
voltage:
name: "T-Series PV4 Voltage"
current:
name: "T-Series PV4 Current"
active_power:
name: "T-Series PV4 Power"
total_energy_production:
name: "T-Series Generation Total"
energy_production_day:
name: "T-Series Today Yield"
generation_power:
name: "T-Series Generation Power"
on_value_range:
- below: 1.0
then:
- light.turn_on:
id: led_light
red: "100%"
green: 0
blue: 0
- above: 1.0
below: 1000.0
then:
- light.turn_on:
id: led_light
red: "100%"
green: "100%"
blue: 0
- above: 1000.0
below: 2000.0
then:
- light.turn_on:
id: led_light
red: 0
green: 0
blue: "100%"
- above: 2000.0
then:
- light.turn_on:
id: led_light
red: 0
green: "100%"
blue: 0
grid_power:
name: "T-Series Grid Power"
loads_power:
name: "T-Series loads Power"
inverter_temp:
name: "T-Series Inverter Temperature"
ambient_temp:
name: "T-Series Ambient Temperature"
boost_temp:
name: "T-Series Boost Temperature"
inverter_status:
name: "T-Series Inverter State"
internal: true
on_value:
then:
- lambda: |-
if (x==0) {
id(inverter_mode_text_sensor).publish_state("Offline");
} else if (x==1) {
id(inverter_mode_text_sensor).publish_state("Online");
} else if (x==2) {
id(inverter_mode_text_sensor).publish_state("Error");
} else {
id(inverter_mode_text_sensor).publish_state("Waiting for response...");
}
flow_control_pin:
number: GPIO17
inverted: true
allow_other_uses: true
# Startregion Legacy Foxess code
# - platform: custom
# lambda: |-
# auto foxesssensors = new foxesscomponent(id(uart_bus));
# App.register_component(foxesssensors);
# return {\
# foxesssensors->grid_power, \
# foxesssensors->generation_power, \
# foxesssensors->loads_power, \
# foxesssensors->grid_voltage_r, \
# foxesssensors->grid_current_r, \
# foxesssensors->grid_frequency_r, \
# foxesssensors->grid_power_r, \
# foxesssensors->grid_voltage_s, \
# foxesssensors->grid_current_s, \
# foxesssensors->grid_frequency_s, \
# foxesssensors->grid_power_s, \
# foxesssensors->grid_voltage_T, \
# foxesssensors->grid_current_T, \
# foxesssensors->grid_frequency_T, \
# foxesssensors->grid_power_T, \
# foxesssensors->pv1_voltage, \
# foxesssensors->pv1_current, \
# foxesssensors->pv2_voltage, \
# foxesssensors->pv2_current, \
# foxesssensors->pv3_voltage, \
# foxesssensors->pv3_current, \
# foxesssensors->pv4_voltage, \
# foxesssensors->pv4_current, \
# foxesssensors->boost_temperature, \
# foxesssensors->inverter_temperature, \
# foxesssensors->ambient_temperature, \
# foxesssensors->today_yield, \
# foxesssensors->generation_total, \
# foxesssensors->pv1_power, \
# foxesssensors->pv2_power, \
# foxesssensors->pv3_power, \
# foxesssensors->pv4_power, \
# foxesssensors->inverter_state \
# };
# sensors:
# - name: "T-Series Grid Power"
# id: "grid_power"
# unit_of_measurement: W
# icon: mdi:lightning-bolt
# - name: "T-Series Generation Power"
# id: "generation_power"
# unit_of_measurement: W
# state_class: measurement
# device_class: power
# icon: mdi:lightning-bolt
# on_value_range:
# - below: 1.0
# then:
# - light.turn_on:
# id: led_light
# red: "100%"
# green: 0
# blue: 0
# - above: 1.0
# below: 1000.0
# then:
# - light.turn_on:
# id: led_light
# red: "100%"
# green: "100%"
# blue: 0
# - above: 1000.0
# below: 2000.0
# then:
# - light.turn_on:
# id: led_light
# red: 0
# green: 0
# blue: "100%"
# - above: 2000.0
# then:
# - light.turn_on:
# id: led_light
# red: 0
# green: "100%"
# blue: 0
# - name: "T-Series loads Power"
# id: "loads_power"
# unit_of_measurement: W
# icon: mdi:lightning-bolt
# - name: "T-Series Grid Voltage R"
# id: "grid_voltage_r"
# unit_of_measurement: V
# accuracy_decimals: 1
# icon: mdi:flash
# filters:
# - multiply: 0.1
# - throttle: 1h
# - name: "T-Series Grid Current R"
# id: "grid_current_r"
# unit_of_measurement: A
# accuracy_decimals: 1
# icon: mdi:current-ac
# filters:
# - multiply: 0.1
# - throttle: 1h
# - name: "T-Series Grid Frequency R"
# id: "grid_Frequency_r"
# unit_of_measurement: Hz
# accuracy_decimals: 2
# icon: mdi:sine-wave
# filters:
# - multiply: 0.01
# - throttle: 1h
# - name: "T-Series Grid Power R"
# id: "grid_power_r"
# unit_of_measurement: W
# icon: mdi:lightning-bolt
# - name: "T-Series Grid Voltage S"
# id: "grid_voltage_s"
# unit_of_measurement: V
# accuracy_decimals: 1
# icon: mdi:flash
# filters:
# - multiply: 0.1
# - throttle: 1h
# - name: "T-Series Grid Current S"
# id: "grid_current_s"
# unit_of_measurement: A
# accuracy_decimals: 1
# icon: mdi:current-ac
# filters:
# - multiply: 0.1
# - throttle: 1h
# - name: "T-Series Grid Frequency S"
# id: "grid_Frequency_s"
# unit_of_measurement: Hz
# accuracy_decimals: 2
# icon: mdi:sine-wave
# filters:
# - multiply: 0.01
# - throttle: 1h
# - name: "T-Series Grid Power S"
# id: "grid_power_s"
# unit_of_measurement: W
# icon: mdi:lightning-bolt
# - name: "T-Series Grid Voltage T"
# id: "grid_voltage_T"
# unit_of_measurement: V
# accuracy_decimals: 1
# icon: mdi:flash
# filters:
# - multiply: 0.1
# - throttle: 1h
# - name: "T-Series Grid Current T"
# id: "grid_current_t"
# unit_of_measurement: A
# accuracy_decimals: 1
# icon: mdi:current-ac
# filters:
# - multiply: 0.1
# - throttle: 1h
# - name: "T-Series Grid Frequency T"
# id: "grid_Frequency_t"
# unit_of_measurement: Hz
# accuracy_decimals: 2
# icon: mdi:sine-wave
# filters:
# - multiply: 0.01
# - throttle: 1h
# - name: "T-Series Grid Power T"
# id: "grid_power_t"
# unit_of_measurement: W
# icon: mdi:lightning-bolt
# - name: "T-Series PV1 Voltage"
# id: "pv1_voltage"
# unit_of_measurement: V
# accuracy_decimals: 1
# icon: mdi:flash
# filters:
# - multiply: 0.1
# - name: "T-Series PV1 Current"
# id: "pv1_current"
# unit_of_measurement: A
# accuracy_decimals: 1
# icon: mdi:current-ac
# filters:
# - multiply: 0.1
# - name: "T-Series PV2 Voltage"
# id: "pv2_voltage"
# unit_of_measurement: V
# accuracy_decimals: 1
# icon: mdi:flash
# filters:
# - multiply: 0.1
# - name: "T-Series PV2 Current"
# id: "pv2_current"
# unit_of_measurement: A
# accuracy_decimals: 1
# icon: mdi:current-ac
# filters:
# - multiply: 0.1
# - name: "T-Series PV3 Voltage" #only relevant for models T8dual-T12dual and T15-T25
# id: "pv3_voltage"
# unit_of_measurement: V
# accuracy_decimals: 1
# icon: mdi:flash
# filters:
# - multiply: 0.1
# - name: "T-Series PV3 Current" #only relevant for models T8dual-T12dual and T15-T25
# id: "pv3_current"
# unit_of_measurement: A
# accuracy_decimals: 1
# icon: mdi:current-ac
# filters:
# - multiply: 0.1
# - name: "T-Series PV4 Voltage" #only relevant for models T8dual-T12dual and T15-T25
# id: "pv4_voltage"
# unit_of_measurement: V
# accuracy_decimals: 1
# icon: mdi:flash
# filters:
# - multiply: 0.1
# - name: "T-Series PV4 Current" #only relevant for models T8dual-T12dual and T15-T25
# id: "pv4_current"
# unit_of_measurement: A
# accuracy_decimals: 1
# icon: mdi:current-ac
# filters:
# - multiply: 0.1
# - name: "T-Series Boost Temperature" #boost temperature and inverter temperature seem to be always the same
# id: "boost_temperature"
# unit_of_measurement: °C
# filters:
# - throttle: 10min
# - name: "T-Series Inverter Temperature" #boost temperature and inverter temperature seem to be always the same
# id: "inverter_temperature"
# unit_of_measurement: °C
# state_class: measurement
# device_class: temperature
# filters:
# - throttle: 10min
# - name: "T-Series Ambient Temperature"
# id: "ambient_temperature"
# unit_of_measurement: °C
# filters:
# - throttle: 10min
# - name: "T-Series Today Yield"
# id: "today_yield"
# unit_of_measurement: kWh
# accuracy_decimals: 1
# icon: mdi:solar-power
# filters:
# - multiply: 0.1
# - name: "T-Series Generation Total"
# id: "generation_total"
# unit_of_measurement: kWh
# device_class: energy #for use in energy dashboard
# state_class: total_increasing #for use in energy dashboard
# accuracy_decimals: 1
# icon: mdi:solar-power
# filters:
# - multiply: 0.1
# - name: "T-Series PV1 Power" #rs485 comm says this is always 0W, so this is calculated in the .h file by voltage*current
# id: "pv1_power"
# unit_of_measurement: W
# state_class: measurement
# device_class: power
# icon: mdi:lightning-bolt
# accuracy_decimals: 1
# - name: "T-Series PV2 Power" #rs485 comm says this is always 0W, so this is calculated in the .h file by voltage*current
# id: "pv2_power"
# unit_of_measurement: W
# state_class: measurement
# device_class: power
# icon: mdi:lightning-bolt
# accuracy_decimals: 1
# - name: "T-Series PV3 Power" #rs485 comm says this is always 0W, so this is calculated in the .h file by voltage*current
# id: "pv3_power"
# unit_of_measurement: W
# state_class: measurement
# device_class: power
# icon: mdi:lightning-bolt
# accuracy_decimals: 1
# - name: "T-Series PV4 Power" #rs485 comm says this is always 0W, so this is calculated in the .h file by voltage*current
# id: "pv4_power"
# unit_of_measurement: W
# state_class: measurement
# device_class: power
# icon: mdi:lightning-bolt
# accuracy_decimals: 1
# - name: "T-Series Inverter State"
# id: "inverter_state"
# internal: true
# on_value:
# then:
# - lambda: |-
# if (x==0) {
# id(inverter_mode_text_sensor).publish_state("Offline");
# }
# else if(x==1) {
# id(inverter_mode_text_sensor).publish_state("Online");
# }
# else if(x==2) {
# id(inverter_mode_text_sensor).publish_state("Error");
# }
# else {
# id(inverter_mode_text_sensor).publish_state("Waiting for response...");
# }
#Endregion Legacy Foxess code
Somehow it's only publishing the sensor states until line foxess_solar.cpp#L156
Do you have a log snippet for when it does update the sensors after line 156? Did you capture the logs via the network?
Can you try this instead of the external_component in your config?
external_components:
- source: github://SibrenVasse/Foxess-T-series-ESPHome-Home-Assistant@PR
Somehow it's only publishing the sensor states until line foxess_solar.cpp#L156
Do you have a log snippet for when it does update the sensors after line 156? Did you capture the logs via the network?
Can you try this instead of the external_component in your config?
external_components: - source: github://SibrenVasse/Foxess-T-series-ESPHome-Home-Assistant@PR
Updated my config to use PR branch as suggested.
My logs show this so far:
[14:59:37][D][sensor:094]: 'WiFi Signal dB': Sending state -50.00000 dBm with 0 decimals of accuracy
[14:59:37][D][sensor:094]: 'WiFi Signal Percent': Sending state 100.00000 % with 0 decimals of accuracy
[14:59:44][D][internal_temperature:069]: Ignoring invalid temperature (success=0, value=53.3)
[14:59:46][I][safe_mode:041]: Boot seems successful; resetting boot loop counter
[14:59:46][D][esp32.preferences:114]: Saving 1 preferences to flash...
[14:59:46][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[15:00:37][D][sensor:094]: 'WiFi Signal dB': Sending state -54.00000 dBm with 0 decimals of accuracy
[15:00:37][D][sensor:094]: 'WiFi Signal Percent': Sending state 92.00000 % with 0 decimals of accuracy
[15:00:44][D][internal_temperature:069]: Ignoring invalid temperature (success=0, value=53.3)
[15:00:45][W][FoxessSolar::parse_message:126]: Unexpected msg length, length: 165
[15:00:45][W][component:157]: Component foxess_solar.sensor set Warning flag: unspecified
[15:00:45][D][sensor:094]: 'T-Series Grid Power': Sending state 0.00000 W with 0 decimals of accuracy
[15:00:45][D][sensor:094]: 'T-Series Generation Power': Sending state 1770.00000 W with 0 decimals of accuracy
[15:00:45][D][light:036]: 'Foxess Inverter Light' Setting:
[15:00:45][D][light:047]: State: ON
[15:00:45][D][light:059]: Red: 0%, Green: 0%, Blue: 100%
[15:00:45][D][light:085]: Transition length: 1.0s
[15:00:45][D][sensor:094]: 'T-Series loads Power': Sending state 0.00000 W with 0 decimals of accuracy
[15:00:45][D][sensor:094]: 'T-Series Grid Voltage R': Sending state 236.00000 V with 1 decimals of accuracy
[15:00:45][D][sensor:094]: 'T-Series Grid Current R': Sending state 2.60000 A with 1 decimals of accuracy
[15:00:45][D][sensor:094]: 'T-Series Grid Frequency R': Sending state 49.96000 Hz with 2 decimals of accuracy
[15:00:45][D][sensor:094]: 'T-Series Grid Power R': Sending state 590.00000 W with 0 decimals of accuracy
[15:00:45][D][sensor:094]: 'T-Series Grid Voltage S': Sending state 232.80000 V with 1 decimals of accuracy
[15:00:45][D][sensor:094]: 'T-Series Grid Current S': Sending state 2.60000 A with 1 decimals of accuracy
[15:00:45][D][sensor:094]: 'T-Series Grid Frequency S': Sending state 49.96000 Hz with 2 decimals of accuracy
[15:00:45][D][sensor:094]: 'T-Series Grid Power S': Sending state 590.00000 W with 0 decimals of accuracy
[15:00:45][D][esp32.preferences:114]: Saving 1 preferences to flash...
[15:00:45][D][esp32.preferences:143]: Saving 1 preferences to flash: 1 cached, 0 written, 0 failed
The[FoxessSolar::parse_message:126]: Unexpected msg length, length: 165
says that it failed to parse the message (which the implementation you forked from has no issues with), which is why it doesn't show some of the properties.
It's just a message to warn that the length of the messages received by the inverter are valid (integrity checked by checksum, which the original implementation does not do), but not the same length as the messages I verified my code with. here It will not abort parsing the message, just print the warning to the logs.
The parsing itself has not changed from the original code.
I have created a version without this check:
external_components:
- source: github://SibrenVasse/Foxess-T-series-ESPHome-Home-Assistant@PR-nocheck
It's just a message to warn that the length of the messages received by the inverter are valid (integrity checked by checksum, which the original implementation does not do), but not the same length as the messages I verified my code with. here It will not abort parsing the message, just print the warning to the logs.
The parsing itself has not changed from the original code.
Ok. Something has though as it seems to cut off data received from the inverter with your code, cause it works with the original. Anything else I can check?
Here's what the original code outputs:
[15:08:44][D][sensor:094]: 'T-Series Grid Power': Sending state 0.00000 W with 0 decimals of accuracy
[15:08:44][D][sensor:094]: 'T-Series Generation Power': Sending state 1776.00000 W with 0 decimals of accuracy
[15:08:44][D][light:036]: 'Foxess Inverter Light' Setting:
[15:08:44][D][light:047]: State: ON
[15:08:44][D][light:059]: Red: 0%, Green: 0%, Blue: 100%
[15:08:44][D][light:085]: Transition length: 1.0s
[15:08:44][D][sensor:094]: 'T-Series loads Power': Sending state 0.00000 W with 0 decimals of accuracy
[15:08:44][D][sensor:094]: 'T-Series Grid Voltage R': Sending state 236.70000 V with 1 decimals of accuracy
[15:08:44][D][sensor:094]: 'T-Series Grid Current R': Sending state 2.60000 A with 1 decimals of accuracy
[15:08:44][D][sensor:094]: 'T-Series Grid Frequency R': Sending state 50.02000 Hz with 2 decimals of accuracy
[15:08:45][D][sensor:094]: 'T-Series Grid Power R': Sending state 592.00000 W with 0 decimals of accuracy
[15:08:45][D][sensor:094]: 'T-Series Grid Voltage S': Sending state 235.10001 V with 1 decimals of accuracy
[15:08:45][D][sensor:094]: 'T-Series Grid Current S': Sending state 2.60000 A with 1 decimals of accuracy
[15:08:45][D][sensor:094]: 'T-Series Grid Frequency S': Sending state 50.02000 Hz with 2 decimals of accuracy
[15:08:45][D][sensor:094]: 'T-Series Grid Power S': Sending state 592.00000 W with 0 decimals of accuracy
[15:08:45][D][sensor:094]: 'T-Series Grid Voltage T': Sending state 237.80000 V with 1 decimals of accuracy
[15:08:45][D][sensor:094]: 'T-Series Grid Current T': Sending state 2.60000 A with 1 decimals of accuracy
[15:08:45][D][sensor:094]: 'T-Series Grid Frequency T': Sending state 50.02000 Hz with 2 decimals of accuracy
[15:08:45][D][sensor:094]: 'T-Series Grid Power T': Sending state 592.00000 W with 0 decimals of accuracy
[15:08:45][D][sensor:094]: 'T-Series PV1 Voltage': Sending state 354.20001 V with 1 decimals of accuracy
[15:08:45][D][sensor:094]: 'T-Series PV1 Current': Sending state 0.90000 A with 1 decimals of accuracy
[15:08:45][D][sensor:094]: 'T-Series PV2 Voltage': Sending state 369.50000 V with 1 decimals of accuracy
[15:08:45][D][sensor:094]: 'T-Series PV2 Current': Sending state 3.90000 A with 1 decimals of accuracy
[15:08:45][D][sensor:094]: 'T-Series PV3 Voltage': Sending state 0.00000 V with 1 decimals of accuracy
[15:08:45][D][sensor:094]: 'T-Series PV3 Current': Sending state 0.00000 A with 1 decimals of accuracy
[15:08:45][D][sensor:094]: 'T-Series PV4 Voltage': Sending state 0.00000 V with 1 decimals of accuracy
[15:08:45][D][sensor:094]: 'T-Series PV4 Current': Sending state 0.00000 A with 1 decimals of accuracy
[15:08:45][D][sensor:094]: 'T-Series Boost Temperature': Sending state 45.00000 °C with 0 decimals of accuracy
[15:08:45][D][sensor:094]: 'T-Series Inverter Temperature': Sending state 45.00000 °C with 0 decimals of accuracy
[15:08:46][D][sensor:094]: 'T-Series Ambient Temperature': Sending state 48.00000 °C with 0 decimals of accuracy
[15:08:46][D][sensor:094]: 'T-Series Today Yield': Sending state 19.70000 kWh with 1 decimals of accuracy
[15:08:46][D][sensor:094]: 'T-Series Generation Total': Sending state 17444.09961 kWh with 1 decimals of accuracy
[15:08:46][D][sensor:094]: 'T-Series PV1 Power': Sending state 318.00000 W with 1 decimals of accuracy
[15:08:46][D][sensor:094]: 'T-Series PV2 Power': Sending state 1441.00000 W with 1 decimals of accuracy
[15:08:46][D][sensor:094]: 'T-Series PV3 Power': Sending state 0.00000 W with 1 decimals of accuracy
[15:08:46][D][sensor:094]: 'T-Series PV4 Power': Sending state 0.00000 W with 1 decimals of accuracy
[15:08:46][D][sensor:094]: 'T-Series Inverter State': Sending state 1.00000 with 0 decimals of accuracy
[15:08:46][D][text_sensor:064]: 'T-Series Inverter Mode': Sending state 'Online'
[15:08:46][W][component:237]: Component <unknown> took a long time for an operation (2128 ms).
[15:08:46][W][component:238]: Components should block for at most 30 ms.
[15:08:52][D][internal_temperature:069]: Ignoring invalid temperature (success=0, value=53.3)
[15:09:01][D][sensor:094]: 'WiFi Signal dB': Sending state -52.00000 dBm with 0 decimals of accuracy
[15:09:01][D][sensor:094]: 'WiFi Signal Percent': Sending state 96.00000 % with 0 decimals of accuracy
I have created a version without this check:
external_components: - source: github://SibrenVasse/Foxess-T-series-ESPHome-Home-Assistant@PR-nocheck
no more warnings, but still just half of the data it seems:
[15:14:45][D][sensor:094]: 'T-Series Grid Power': Sending state 0.00000 W with 0 decimals of accuracy
[15:14:45][D][sensor:094]: 'T-Series Generation Power': Sending state 1766.00000 W with 0 decimals of accuracy
[15:14:45][D][light:036]: 'Foxess Inverter Light' Setting:
[15:14:45][D][light:047]: State: ON
[15:14:45][D][light:059]: Red: 0%, Green: 0%, Blue: 100%
[15:14:45][D][light:085]: Transition length: 1.0s
[15:14:45][D][sensor:094]: 'T-Series loads Power': Sending state 0.00000 W with 0 decimals of accuracy
[15:14:45][D][sensor:094]: 'T-Series Grid Voltage R': Sending state 236.30000 V with 1 decimals of accuracy
[15:14:45][D][sensor:094]: 'T-Series Grid Current R': Sending state 2.60000 A with 1 decimals of accuracy
[15:14:45][D][sensor:094]: 'T-Series Grid Frequency R': Sending state 49.99000 Hz with 2 decimals of accuracy
[15:14:45][D][sensor:094]: 'T-Series Grid Power R': Sending state 588.00000 W with 0 decimals of accuracy
[15:14:45][D][sensor:094]: 'T-Series Grid Voltage S': Sending state 231.80000 V with 1 decimals of accuracy
[15:14:45][D][sensor:094]: 'T-Series Grid Current S': Sending state 2.60000 A with 1 decimals of accuracy
[15:14:45][D][sensor:094]: 'T-Series Grid Frequency S': Sending state 49.99000 Hz with 2 decimals of accuracy
[15:14:45][D][sensor:094]: 'T-Series Grid Power S': Sending state 588.00000 W with 0 decimals of accuracy
[15:14:45][D][sensor:094]: 'T-Series Grid Voltage T': Sending state 240.80000 V with 1 decimals of accuracy
[15:14:45][D][sensor:094]: 'T-Series Grid Current T': Sending state 2.60000 A with 1 decimals of accuracy
[15:15:02][D][esp32.preferences:114]: Saving 1 preferences to flash...
[15:15:02][D][esp32.preferences:143]: Saving 1 preferences to flash: 1 cached, 0 written, 0 failed
[15:15:07][D][internal_temperature:069]: Ignoring invalid temperature (success=0, value=53.3)
[15:15:17][I][safe_mode:041]: Boot seems successful; resetting boot loop counter
[15:15:17][D][esp32.preferences:114]: Saving 1 preferences to flash...
[15:15:17][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[15:15:17][D][sensor:094]: 'WiFi Signal dB': Sending state -50.00000 dBm with 0 decimals of accuracy
[15:15:17][D][sensor:094]: 'WiFi Signal Percent': Sending state 100.00000 % with 0 decimals of accuracy
[15:16:07][D][internal_temperature:069]: Ignoring invalid temperature (success=0, value=53.3)
[15:16:17][D][sensor:094]: 'WiFi Signal dB': Sending state -50.00000 dBm with 0 decimals of accuracy
[15:16:17][D][sensor:094]: 'WiFi Signal Percent': Sending state 100.00000 % with 0 decimals of accuracy
[15:16:45][D][sensor:094]: 'T-Series Grid Power': Sending state 0.00000 W with 0 decimals of accuracy
[15:16:45][D][sensor:094]: 'T-Series Generation Power': Sending state 1945.00000 W with 0 decimals of accuracy
[15:16:45][D][sensor:094]: 'T-Series loads Power': Sending state 0.00000 W with 0 decimals of accuracy
[15:16:45][D][sensor:094]: 'T-Series Grid Voltage R': Sending state 238.20000 V with 1 decimals of accuracy
[15:16:45][D][sensor:094]: 'T-Series Grid Current R': Sending state 2.80000 A with 1 decimals of accuracy
[15:16:45][D][sensor:094]: 'T-Series Grid Frequency R': Sending state 49.99000 Hz with 2 decimals of accuracy
[15:16:45][D][sensor:094]: 'T-Series Grid Power R': Sending state 648.00000 W with 0 decimals of accuracy
[15:16:45][D][sensor:094]: 'T-Series Grid Voltage S': Sending state 234.30000 V with 1 decimals of accuracy
[15:16:45][D][sensor:094]: 'T-Series Grid Current S': Sending state 2.80000 A with 1 decimals of accuracy
[15:16:45][D][sensor:094]: 'T-Series Grid Frequency S': Sending state 49.99000 Hz with 2 decimals of accuracy
[15:16:45][D][sensor:094]: 'T-Series Grid Power S': Sending state 648.00000 W with 0 decimals of accuracy
[15:16:45][D][sensor:094]: 'T-Series Grid Voltage T': Sending state 240.40001 V with 1 decimals of accuracy
[15:16:45][D][sensor:094]: 'T-Series Grid Current T': Sending state 2.80000 A with 1 decimals of accuracy
[15:16:45][D][sensor:094]: 'T-Series Grid Frequency T': Sending state 49.99000 Hz with 2 decimals of accuracy
[15:16:45][D][sensor:094]: 'T-Series Grid Power T': Sending state 648.00000 W with 0 decimals of accuracy
[15:16:45][D][sensor:094]: 'T-Series PV1 Voltage': Sending state 370.39999 V with 1 decimals of accuracy
[15:16:45][D][sensor:094]: 'T-Series PV1 Current': Sending state 0.90000 A with 1 decimals of accuracy
[15:16:45][D][sensor:094]: 'T-Series PV1 Power': Sending state 333.35999 W with 1 decimals of accuracy
[15:16:45][D][sensor:094]: 'T-Series PV2 Voltage': Sending state 366.60001 V with 1 decimals of accuracy
[15:16:45][D][sensor:094]: 'T-Series PV2 Current': Sending state 4.30000 A with 1 decimals of accuracy
[15:16:45][D][sensor:094]: 'T-Series PV2 Power': Sending state 1576.38000 W with 1 decimals of accuracy
I don't know how much you have changed, or if it matters but when I compiled the original version with ESP-IDF 5.3.1 it was erroring out with src/foxess_t_series.h:351:30: error: format '%i' expects argument of type 'int', but argument 5 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
. I know it is just a warning treated as error, but you must have changed something here (validating/converting types?) since your code does compile with it.
I haven't tried compiling with esp-idf because of incompatibilities with my hardware.
Can you try compiling with the arduino framework and enabling verbose logging?
My inverter is already down for the day. I’m not sure if I will have time to do it tomorrow.
https://esphome.io/components/external_components.html#example-of-local-components