Skip to content

Migrating from HA FoxESS Modbus

Dave Foster edited this page Aug 28, 2023 · 6 revisions

NOTE: When migrating from the StealthChestnut HA-FoxESS-Modbus version, before installing this integration please remove the modbus: include from the configuration.yaml, it will look similar to this (depending on the path you chose)

modbus: !include custom_components/foxmodbuslan/modbusUSB.yaml

You will likely have created the custom sensors Battery Discharge, Battery Charge, Grid Consumption (examples shown below), please remove them from your configuration.yaml as these sensor names are now provided within the integration.

    - name: "Battery Discharge"
      device_class: "power"
      unit_of_measurement: "kW"
      state: >
          {% if (states('sensor.battery_discharge_power') | float(default=0) ) > 0 %}
          {{ states('sensor.battery_discharge_power') | float(default=0) * 1 }}
          {% else %}
          0 
          {% endif %}
    - name: "Battery Charge"
      device_class: "power"
      unit_of_measurement: "kW"
      state: >
          {% if (states('sensor.battery_discharge_power') | float(default=0) ) < 0 %}
          {{ states('sensor.battery_discharge_power') | float(default=0) * -1 }}
          {% else %}
          0 
          {% endif %}
    - name: "Grid Consumption"
      device_class: "power"
      unit_of_measurement: "kW"
      state: >
          {% if (states('sensor.grid_ct') | float(default=0) ) < 0 %}
          {{ states('sensor.grid_ct') | float(default=0) * -1 }}
          {% else %}
          0 
          {% endif %}

Note: Dashboard Auto-Update

To ensure you maintain consistent dashboard statistics it is recommended you keep your existing energy dashboard settings and do not select auto-update.

In order to do this please ensure you have removed the template sensors mentioned above, you must leave all other pre-existing utility meters and Riemann sum sensors in place, *do not remove them as these contain your historical statistics.

This integration adds sensor.feed_in_energy_total - (export energy reported since the inverter installed) and sensor.feed_in_energy_today (export energy reported for today) - however we need to retain a working feedin_sum and utility meter to retain your export statistics.

In configuration.yaml change your sensor.feed_in_power template as follows -

    - name: "Feed In Power"
      unique_id: foxess_inv1_feed_in_power
      device_class: "power"
      unit_of_measurement: "kW"
      state: >
          {{ states('sensor.feed_in') | float(default=0) }}

NB: the state: line has changed as the source sensor has changed from grid_ct to sensor.feed_in

In the very latest version of StealthChesnut modbus integration time period sensors have been configured, they will be in your configuration.yaml along with the sensors listed above - these should be removed (there are 4 of them with names "Time Period 1 - Start Time", "Time Period 1 - End Time", "Time Period 2 - Start Time", "Time Period 2 - End Time")

Make sure that configuration.yaml is saved, and check the config is good by going to Developer Tools, and click 'CHECK CONFIGURATION' before you Restart Home Assistant

After clicking 'restart' leave the Home Assistant for 5 minutes as the old modbus has been known to block shutdown, or simply wait and watch it restart correctly before proceeding.

Now install the FoxESS modbus integration via HACS