Schneider Electric Solar TCP Modbus Integration

Here are the ModBus Maps for these Conext Devices, XW/XW+ , Schneider Link shared below:

[SE Devices Link PDF’s Zip - Below:
503-0244-01-01_RevA.4_Modbus_Map_Conext_SW_Device.pdf
503-0245-01-01_RevA.4_Modbus_Map_Freedom_SW_Device.pdf
503-0246-01-01_RevA.4_Modbus_Map_Conext_XW_Device.pdf
503-0247-01-01_RevA.4_Modbus_Map_AGS_Device.pdf
503-0248-01-01_RevA.4_Modbus_Map_MPPT60_Device.pdf
503-0250-01-01_RevA.4_Modbus_Map_GridTie_Device.pdf
503-0251-01-01_RevA.4_Modbus_Map_SCP_Device.pdf
503-0252-01-01_RevA.4_Modbus_Map_MPPT80_Device.pdf
503-0253-01-01_RevA.4_Modbus_Map_ConverterComBox_Device.pdf
503-0261-01-01_RevA.4_Battery_Monitor_Device.pdf
503-0262-01-01_RevA.4_Freedom Sequence Device.pdf

These maps can be found in the InsightHome and InsightFacility downloads section. Under Technical Documents.
https://solar.se.com/us/wp-content/uploads/sites/7/2022/02/Conext-Gateway-InsightHome-InsightFacility-Modbus-Maps.zip

2 Likes

hi all. I just found this post a d found it very interesting.
i have a schieder SW4024 inverter and am InsightHome smart edge device.
my charge controllers are another brand.
will this be good enough to monitor a few sensors like:
ac voltage out
dc voltage in
consumption current and power?
total newbie with HA so if anyone is willing to help will be much much appreciated.
i will need a headstart on the ymal code
thanks
M.

Sorry for the late replies, life has been, well life haha. Yes, that’s what I do, even though you will not be able to read directly from the charge controllers, you could get the charge controller input readings from the Inverter. I use the AC and DC readings, and I have automated the home, whenever there is an outage, all of my high-consumption devices are turned off and a notification is sent to the Family members’ phones and also broadcasted on Alexa and Google Devices. The same way I set up my neighbor who has a hearing impediment, I set up a couple of RGB lights, and depending on what happens with his solar system he would get a pulsating color on specific lights and also phone notifications.

I’m trying to read from my devices, and failing, and must be missing something obvious…

Here’s my hardware from ComBox

image

Here’s my attempted modbus yaml

### https://diysolarforum.com/threads/all-modbus-maps-and-schneider-xw-6848-pro-integration-into-home-assistant-via-modbus-tcp.62707/#post-814231

  - name: conext_combox
    type: tcp
    host: 192.168.40.30
    port: 502
    delay: 5
    timeout: 10
    message_wait_milliseconds: 5
    
    sensors:

### XW6848-01 - Address 11

      - name: "XW Load AC Frequency"
        data_type: uint16
        input_type: input
        slave: 11
        address: 153
        unit_of_measurement: Hz
        scale: 0.01
        offset: 0
        precision: 2
        
      - name: "XW 4868 Load AC Current"
        data_type: int32
        input_type: input
        slave: 11
        address: 150
        unit_of_measurement: A
        scale: 0.001
        offset: 0
        precision: 3
        
      - name: "XW 4868 Load AC Power"
        data_type: int32
        input_type: input
        slave: 11
        address: 154
        unit_of_measurement: W
        scale: 1
        offset: 0
        precision: 0
        device_class: energy
logs hereLogger: homeassistant.components.modbus.modbus
Source: components/modbus/modbus.py:367
integration: Modbus (documentation, issues)
First occurred: 5:52:40 PM (1 occurrences)
Last logged: 5:52:40 PM

Pymodbus: conext_combox: Error: device: 11 address: 153 -> pymodbus returned isError True

All of this was very helpful in getting me kickstarted. Since then, I’ve got quite a bit of it working, bringing in many of the available modbus options on this. Still many more left but I’m pretty well covered with what I have working at this point. If you’re still having trouble reply here and we can see what we can do. Moving onto now trying to integrate this with my Seplos BMS.

I’d love to see the yaml for any sensor that works with your combus!

I’ve never been able to figure out what I’m missing :slight_smile:
thanks in advance

just saw your message. I didnt get a notice or anything.

if this doesnt help you let me know- it just an example; the whole yaml is very long.

lazy error has been deprecated. this is my mobus.yaml file.

  - name: conext_gateway
    type: tcp
    host: 192.168.x.xxx
    port: 502
    delay: 2
    
    timeout: 4
    #close_comm_on_error: true
    message_wait_milliseconds: 30
    #retries: 3
    #retry_on_empty: false
    sensors:
      - name: "MPPT Input DC Power"
        unique_id: mppt_input_dc_powerr
        data_type: uint32
        input_type: holding
        #count: 2
        slave: 30
        address: 80
        scale: 1
        offset: 0
        precision: 1
        unit_of_measurement: W
        state_class: measurement
        device_class: power
        #lazy_error_count: 999type or paste code here

Thank you for your YAML!

I found quite a few differences that seem to help me.

  • Input_type: holding - all other examples used input_type: input
  • state_class & device class
  • message_wait_milliseconds

I’m now up and running!

Good morning, I have a problem with reading parameters… the values given by my devices are somewhat high and I don’t understand why or how to transform them into correct values…

I am providing the first screenshot with the data that I am getting…

sensor: !include sensors.yaml

modbus:
  - name: conext_gateway
    type: tcp
    host: 192.168.XXX
    port: 502
    delay: 2
    timeout: 15
    sensors:
      #Always double check your address for each device.
      
      - name: "XW Load ac Power"
        unique_id: xwprueba_load_ac_power
        data_type: uint32
        input_type: holding
        #count: 2
        slave: 10
        address: 154
        scale: 1
        offset: 0
        precision: 3
        unit_of_measurement: W
        state_class: measurement
        device_class: power

      - name: "XW Load AC Voltage"
        unique_id: xwprueba_load_ac_Voltage
        data_type: uint32
        input_type: holding
        slave: 10
        address: 140
        unit_of_measurement: V
        scale: 0.001
        offset: 0
        precision: 3

      - name: "XW Battery Power"
        unique_id: xwprueba_battery_power
        data_type: int32
        input_type: holding
        slave: 10
        address: 84
        unit_of_measurement: W
        scale: 1
        offset: 0
        precision: 3

      - name: "XW Battery Voltage"
        unique_id: xwprueba_battery_voltage
        data_type: uint32
        input_type: holding
        slave: 10
        address: 80
        unit_of_measurement: V
        scale: 0.001
        offset: 0
        precision: 3
      
      - name: "XW Battery Temperature"
        unique_id: xwprueba_battery_temperature
        data_type: uint16
        input_type: holding
        slave: 10
        address: 86
        unit_of_measurement: degC
        scale: 0.01
        offset: -273
        precision: 3

      - name: "XW Inverter Status"
        unique_id: xwprueba_inverter_status
        data_type: uint16
        input_type: holding
        slave: 10
        address: 122
        scale: 1
        offset: 0
      
      - name: "XW Load AC Current"
        unique_id: xwprueba_load_ac_current
        data_type: uint32
        input_type: holding
        slave: 10
        address: 150
        unit_of_measurement: A
        scale: 0.001
        offset: 0
        

        #Conext MPPT60 slave 30 y 31
        
      - name: "MPPT PV Power Today"
        data_type: uint32
        input_type: holding
        slave: 30
        address: 106
        scale: 0.001
        offset: 0
        precision: 0
        device_class: energy
        unit_of_measurement: kWh

      - name: "MPPT2 PV Power Today"
        data_type: uint32
        input_type: holding
        slave: 31
        address: 106
        scale: 0.001
        offset: 0
        precision: 0
        device_class: energy
        unit_of_measurement: kWh

#Conext Combox Slave 201

      - name: "ComBox DC Charging Power "
        data_type: uint32
        input_type: holding
        slave: 201
        address: 70
        scale: 1
        offset: 0
        precision: 0
        device_class: energy
        unit_of_measurement: W

      - name: "ComBox DC Inverting Power "
        data_type: uint32
        input_type: holding
        slave: 201
        address: 74
        scale: 1
        offset: 0
        precision: 0
        device_class: energy
        unit_of_measurement: W

      - name: "ComBox Load Power "
        data_type: uint32
        input_type: holding
        slave: 201
        address: 98
        scale: 1
        offset: 0
        precision: 0
        device_class: energy
        unit_of_measurement: W

      - name: "ComBox MPPT PV Power "
        data_type: uint32
        input_type: holding
        slave: 201
        address: 140
        scale: 1
        offset: 0
        precision: 0
        device_class: energy
        unit_of_measurement: W

      - name: "ComBox MPPT Battery Power "
        data_type: uint32
        input_type: holding
        slave: 201
        address: 140
        scale: 1
        offset: 0
        precision: 0
        device_class: energy
        unit_of_measurement: W

      - name: "ComBox Load Output Power "
        data_type: uint32
        input_type: holding
        slave: 201
        address: 94
        scale: 1
        offset: 0
        precision: 0
        device_class: energy
        unit_of_measurement: W

      - name: "ComBox Battery Voltage "
        data_type: uint32
        input_type: holding
        slave: 201
        address: 152
        scale: 0.001
        offset: 0
        precision: 0
        device_class: energy
        unit_of_measurement: V

      - name: "ComBox Battery Temperature "
        data_type: uint32
        input_type: holding
        slave: 201
        address: 154
        scale: 0.01
        offset: -253
        precision: 3
        device_class: Temperature
        unit_of_measurement: degC

If you could tell me why this is happening, I would greatly appreciate it.

Thanks!!

Can anyone guide me on getting the slave id from the context gateway?

The Conext Gateway uses slave id 1 by default.

Slave IDs are listed in the Conext Gateway.

Looking for some help. I have been banging my head against the wall trying to get the data from my SW4048 with Combox into HA, but all I get is “unavailable” for the entities and “N/A” (the last ‘else’ option in the template) for the sensors. I know I need to change the port from 503 to 502. I suspect I’m not connecting to the device but am not sure how to test that. In the logs I have this error:

"Logger: homeassistant.components.modbus.modbus
Source: components/modbus/modbus.py:300
integration: Modbus (documentation, issues)
First occurred: 22:25:04 (1 occurrences)
Last logged: 22:25:04

Pymodbus: conext_combox: Error: device: 90 address: 65 → Exception Response(132, 4, IllegalFunction)"

I restarted HA, the virtual machine, my computer; cleared my cache; shut down my firewall (just in case). HA is on the same subnet as the inverter/combox. I can log into the SE web interface and see all the data they offer but can’t get HA to read it.

ATM I only have the first sensor in the yaml. (Well, I had everything but cleared most of it out to troubleshoot.)

sensor: !include sensors.yaml

modbus:
  - name: conext_combox
    type: tcp
    host: 192.168.30.119
    port: 502
    delay: 2
    timeout: 15
    sensors:
    #conext_combox device over Modbus: CSW4048 0 - Bus ID:2, Bus address:1, Modbus Slave Address (Port 502 [503 is for gateway]): 90
      - name: ‘SW Device State’
        data_type: uint16
        input_type: input
        slave: 90
        address: 65
        unique_id: SW4048_Device_State

sensors.yaml is the same as what was originally posted. Changing Modbus Byte Order (comment 287) to MSB didn’t make a difference.

Any suggestions? Thanks!

OK, so after lots of fiddling (and LOTS of browser cache clearing, HA restarts, some virtual machine restarts, and sometimes….just waiting), this seems to be working. This isn’t the most active thread, but in case someone is looking for a Combox setup, here is mine.

TL;DR: This works on HA 2025.1.1 with the SE SW4048 and Conext Combox. MPPT charge controller and Battery Monitor code not included. Code will be posted below.

My system:
-Midnite Solar Classic 150 charge controller (not part of this setup but listed because I did NOT include MPPT code in the yaml)
-SE SW4048 charger/inverter,
-SE Conext Combox,
-SE Conext Battery Monitor (BM has never worked correctly and lost its Combox connection a while back but started reporting a relatively correct battery level after being unplugged for several months, so I have hope it might come back online someday, but for the moment I didn’t include any BM code in the yaml.)

I am not a programmer but do okay modifying other people’s code. It takes me 10x longer to figure things out, but I often do…eventually. This process forced me to better understand HA’s inner workings, I got a little better at understanding YAML, educated myself on WTH Modbus is, and learned more about my solar equipment. If I can figure this out, so can other DIY-minded folks.

Here’s what happened after my post:

The yaml did not initially “take” until I rebooted my virtual HA server. I had been using Restart HA>Quick Reload (updates yaml only), so I don’t know if it would have taken with a full Restart HA. Or if it was just a matter of waiting (or clearing my browser cache, something I ended up doing any time I made changes that were not showing up, and it often helped). It didn’t work at night but was up and running (sort of) the next morning. I did a lot of guessing on how to change the code, so I was never sure if my issues were user error or something else. As I progressed, I used the full Restart HA almost always, until I got it running smoothly. Then I was able to use Quick Reload.

Once I finally figured out that the values in the Modbus maps should be reflected in my configuration.yaml file, it started to make sense. Some of the values from the code I copied from the above posts did not match the values needed for my specific equipment, and (I think) when one value was off, it seemed to not read the rest of the code, so every value was showing up as “unavailable” (again, a non-programmer’s perspective).

Then I realized that the tabs in the maps document related to the different pieces of equipment and that there was a section in the yaml code for each one. Like I said, I’m not a programmer, and initially the code just looked like alphabet soup to me.

I had to dig into documentation from Schneider Electric. There are different versions floating around out there and, interestingly, the Combox and SW Modbus documents list the SW4024 but NOT the 4048 in their “applicable products” list, which put me into a temporary panic. Luckily they seem to have used the same mapping for the 4048.

The logs in HA became my friends. I learned I should look at them even if I didn’t get a notification of an error. If something didn’t work as expected, the logs shed light on what was going wrong, and I was able to troubleshoot from there.

At some point I learned that my text editor (Mac TextEdit) was wreaking havoc on the code until I turned off things like SmartQuotes. This was NOT obvious in many cases. For example, ’ is different from ’. (IKR!) Make sure your editor uses plain text, not rich text, to prevent invisible issues like this from messing with your code.

Finally, I discovered (from the logs) that syntax for templates has changed since the OP. The old syntax is still usable, but they suggest updating to the new. This post helped me understand that.

Changes I made to the configuration.yaml code provided in above posts:

  • Changed all mentions of gateway to combox (I think this was only in comments.)

  • Changed port to 502 (from 503) to work with the combox. But I still used the Modbus maps linked in the OP, which are for port 503. They work fine for me.

  • Changed input_type to holding (from input), as noted at comment #20. This was sometimes out of line with the Modbus maps, but it is working for me.

  • Commented out the “count” rows for any device with a data_type: int32 or uint32 to avoid the error count illegal with `data_type: int32 (See Fehlermeldungen zum datentyp in modbus.yaml | heimnetz.de | Forum). This might be affected by the following (see next point):

  • Changed many data_type rows to int16/uint16 (from …32) so that my numbers were “normal” (e.g., voltage of 52.14V instead of 52534263V). I don’t currently have any 32’s in my code, and the count row for 16-bit should be 1, so I may play with changing that at some point (above point).

  • Added unique ID to each entity so I can edit in the UI. (Add unique_id: YOUR_UNIQUE_ID to the yaml. See https://community.home-assistant.io/t/unique-ids-for-entities-in-configuration-yaml/258176/10.)

  • changed Battery Power device_type to power (from energy) to get rid of warning in log (energy expects units of Wh/KWh; power expects W/KW (Sensor entity | Home Assistant Developer Docs)

  • Some of the Modbus address values were different from what was in the configuration code others posted. You could check all of them, but I found it was easier to figure this out once things started running smoothly, because I’d get results for some devices and not others. Then I could check the address value in the code against Modbus Address (1st column) in the maps. (I think I also may have done this in the templates [Notes column in the modes maps].)

Changes I made to templates:

  • Update to new syntax. I did not create templates for all of the data points because I’m not going to use most of them.

I will post my yaml files below.

Here are my yaml files:

configuration.yaml

Some original values are still there but commented in case I need to roll back.

#sensor: !include sensors.yaml -- deprecated; use template instead (https://community.home-assistant.io/t/where-to-place-template-code-and-how-to-add-the-template-integration/504260/2)
template: !include templates.yaml

modbus:
  - name: conext_combox
    type: tcp
    host: 192.168.30.119
    port: 502
    delay: 2
    timeout: 15
    sensors:
    #conext_combox device over Modbus: CSW4048 0 - Bus ID:2, Bus address:1, Modbus Slave Address (Port 502 [503 is for gateway]): 90

      - name: ‘SW Operating Mode’
        data_type: uint16
        input_type: holding #input
        slave: 90
        address: 243
        unique_id: SW4048_Operating_Mode        
      - name: ‘SW Device State’
        data_type: uint16
        input_type: holding #input
        slave: 90
        address: 65
        unique_id: SW4048_Device_State
      - name: ‘SW Inverter Enabled’
        data_type: uint16
        input_type: holding #input
        slave: 90
        address: 67
        unique_id: SW4048_Inverter_Enabled
      - name: ‘SW Charger Enabled’
        data_type: uint16
        input_type: holding #input
        slave: 90
        address: 68
        unique_id: SW4048_Charger_Enabled
      - name: ‘SW Active Faults’
        data_type: uint16
        input_type: holding #input
        slave: 90
        address: 69
        unique_id: SW4048_Active_Faults
      - name: ‘SW Active Warnings’
        data_type: uint16
        input_type: holding #input
        slave: 90
        address: 70
        unique_id: SW4048_Active_Warnings
      - name: ‘SW Inverter Status’
        data_type: uint16
        input_type: holding #input
        slave: 90
        address: 75
        unique_id: SW4048_Inverter_Status
      - name: ‘SW Battery Voltage’
        data_type: uint16
        input_type: holding #input
        slave: 90
        address: 78
        #unit_of_measurement: V
        scale: 0.001
        precision: 2
        unique_id: SW4048_Battery_Voltage
      - name: ‘SW Battery Current’
        data_type: int16
        input_type: holding #input
        #count: 2
        slave: 90
        address: 80
        unit_of_measurement: A
        scale: 0.001
        offset: 0
        precision: 3    
        unique_id: SW4048_Battery_Current
      - name: ‘SW Battery Power’
        data_type: int16
        input_type: holding #input
        #count: 2
        slave: 90
        address: 82
        scale: 1
        offset: 0
        precision: 0
        #device_class: power
        unit_of_measurement: W
        unique_id: SW4048_Battery_Power
      - name: ‘SW Battery Temperature’
        data_type: uint16
        input_type: holding #input
        slave: 90
        address: 84
        scale: 0.01
        offset: -273
        precision: 2
        device_class: temperature
        unit_of_measurement: °C
        unique_id: SW4048_Battery_Temp
      - name: ‘SW Charger Status’
        data_type: uint16
        input_type: holding #input
        slave: 90
        address: 85
        unique_id: SW4048_Charger_Status
      - name: ‘SW AC1 Frequency’
        data_type: uint16
        input_type: holding #input
        slave: 90
        address: 95
        unit_of_measurement: Hz
        scale: 0.01
        offset: 0
        precision: 2
        unique_id: SW4048_AC1_Freq
      - name: ‘SW AC1 Voltage’
        data_type: uint16
        input_type: holding #input
        #count: 2
        slave: 90
        address: 96
        unit_of_measurement: V
        scale: 0.001
        offset: 0
        precision: 3
        unique_id: SW4048_AC1_Voltage
      - name: ‘SW AC1 Input Current’
        data_type: int16
        input_type: holding #input
        #count: 2
        slave: 90
        address: 98
        unit_of_measurement: A
        scale: 0.001
        offset: 0
        precision: 3
        unique_id: SW4048_AC1_Input_Current
      - name: ‘SW AC1 Input Power’
        data_type: int16
        input_type: holding #input
        #count: 2
        slave: 90
        address: 100
        scale: 1
        offset: 0
        precision: 0
        #device_class: power
        unit_of_measurement: W
        unique_id: SW4048_AC1_Input_Power
      - name: ‘SW Load AC Voltage’
        data_type: uint16
        input_type: holding #input
        #count: 2
        slave: 90
        address: 120
        unit_of_measurement: V
        scale: 0.001
        offset: 0
        precision: 3
        unique_id: SW4048_Load_AC_Voltage
      - name: ‘SW Load AC Current’
        data_type: int16
        input_type: holding #input
        #count: 2
        slave: 90
        address: 130
        unit_of_measurement: A
        scale: 0.001
        offset: 0
        precision: 3
        unique_id: SW4048_Load_AC_Current
      - name: ‘SW Load AC Power’
        data_type: int16
        input_type: holding #input
        #count: 2
        slave: 90
        address: 132
        #device_class: power
        unit_of_measurement: W
        scale: 1
        offset: 0
        precision: 0
        unique_id: SW4048_Load_AC_Power
      - name: ‘SW Load AC Frequency’
        data_type: uint16
        input_type: holding #input
        slave: 90
        address: 138
        unit_of_measurement: Hz
        scale: 0.01
        offset: 0
        precision: 2
        unique_id: SW4048_Load_AC_Freq
      - name: ‘SW Energy From Battery This Hour’
        data_type: int16
        input_type: holding #input
        #count: 2
        slave: 90
        address: 144
        unit_of_measurement: kWh
        scale: 0.001
        offset: 0
        precision: 0
        unique_id: SW4048_Energy_fr_Batt_This_Hour
      - name: ‘SW Battery Discharge Active This Hour’
        data_type: int16
        input_type: holding #input
        #count: 2
        slave: 90
        address: 146
        unit_of_measurement: kWh
        scale: 0.001
        offset: 0
        precision: 0
        unique_id: SW4048_Batt_Dischg_Active_This_Hour
      - name: ‘SW AC1 Net Power’
        data_type: int16
        input_type: holding #input
        #count: 2
        slave: 90
        address: 346
        scale: 1
        offset: 0
        precision: 0
        #device_class: power
        unit_of_measurement: W
        unique_id: SW4048_AC1_Net_Power
      - name: ‘SW AC1 Net Current’
        data_type: int16
        input_type: holding #input
        #count: 2
        slave: 90
        address: 344
        unit_of_measurement: A
        scale: 0.001
        offset: 0
        precision: 3
        unique_id: SW4048_AC1_Net_Current

#data_type: int16, uint32, float, string, custom (default int)
#count: 1, 2 (default 1 for 16-bit register, 2 for 32-bit register)
#input_type: holding, input (default holding)
#CSW4048 0  - Bus ID:2, Bus Address:1, Modbus Slave Address (Port 502): 90
#MPPT60 0   - Bus ID:2, Bus Address:2, Modbus Slave Address (Port 502): 30 -- charge controller
#BattMon 0  - Bus ID:2, Bus Address:3, Modbus Slave Address (Port 502): 42
#Conext Combox xxx.xxx.xxx.xxx, Port 502

templates.yaml (replaces sensors.yaml)

(Emma is my dog, and I often find myself saying, “Uh oh, Emma” when something goes wrong, so I used that as the default when another status does not apply.)

#conext_combox device over Modbus
#Does not include templates for Battery Monitor and MPPT charge controller 

sensor:
  - name: "template-SW Operating Mode"
    state: >-
        {{ {"2": "Standby", 
            "3": "Operating"}.get(states('sensor.sw_operating_mode'), 'Uh oh Emma') }}
    unique_id: "SW4048_operating_mode_template"

  - name: "template-Inverter Device State"
    state: >-
        {{ {"0": "Hibernate", 
            "1": "Power Save",
            "2": "Safe Mode",
            "3": "Operating",
            "4": "Diagnostic Mode",
            "5": "Remote Power Off",
            "255": "Data Not Available"}.get(states('sensor.sw_device_state'), 'Uh oh Emma') }}
    unique_id: "SW4048_inverter_device_state_template"

  - name: "template-Inverter Enabled"
    state: >-
        {{ {"0": "Standby", 
            "1": "Operating"}.get(states('sensor.sw_inverter_enabled'), 'Uh oh Emma') }}
    unique_id: "SW4048_inverter_enabled_template"

  - name: "template-Charger Enabled"
    state: >-
        {{ {"0": "Standby", 
            "1": "Operating"}.get(states('sensor.sw_charger_enabled'), 'Uh oh Emma') }}
    unique_id: "SW4048_charger_enabled_template"

  - name: "template-Active Faults"
    state: >-
        {{ {"0": "No Active Faults", 
            "1": "Has Active Faults"}.get(states('sensor.sw_active_faults'), 'Uh oh Emma') }}
    unique_id: "SW4048_active_faults_template"

  - name: "template-Active Warnings"
    state: >-
        {{ {"0": "No Active Warnings", 
            "1": "Has Active Warnings"}.get(states('sensor.sw_active_warnings'), 'Uh oh Emma') }}
    unique_id: "SW4048_active_warnings_template"
    
  - name: "template-Charger Status"
    state: >-
        {{ {"768": "Not Charging", 
            "769": "Bulk",
            "770": "Absorption",
            "771": "Overcharge",
            "772": "Equalize",
            "773": "Float",
            "774": "No Float",
            "775": "Constant VI",
            "776": "Charger Disabled",
            "777": "Qualifying AC",
            "778": "Qualifying APS",
            "779": "Engaging Charger",
            "780": "Charge Fault",
            "781": "Charger Suspend",
            "782": "AC Good",
            "783": "APS Good",
            "784": "AC Fault",
            "785": "Charge",
            "786": "Absorption Exit Pending",
            "787": "Ground Fault",
            "788": "AC Good Pending",
            "789": "Load Shaving",
            "790": "AC Support",
            "791": "Coupled",
            "792": "Coupled Bulk",
            "793": "Coupled Absorption",
            "794": "Coupled Float",
            "795": "AC Coupled No Float",
            "796": "External BMS",
            "797": "Load Sense"}.get(states('sensor.sw_charger_status'), 'Uh oh Emma') }}
    unique_id: "SW4048_charger_status_template"

  - name: "template-Inverter Status"
    state: >-
        {{ {"1024": "Invert",
            "1025": "AC Pass Through",
            "1026": "APS Only",
            "1027": "Load Sense",
            "1028": "Inverter Disabled",
            "1029": "Load Sense Ready",
            "1030": "Engaging Inverter",
            "1031": "Invert Fault",
            "1032": "Inverter Standby",
            "1033": "Grid-Tied",
            "1034": "Grid Support",
            "1035": "Gen Support",
            "1036": "Sell-to-Grid",
            "1037": "Load Shaving",
            "1038": "Grid Frequency Stabilization",
            "1039": "AC Coupling",
            "1040": "Reverse Ibatt"}.get(states('sensor.sw_inverter_status'), 'Uh oh Emma') }}
    unique_id: "SW4048_inverter_status_template"