Skip to content

Instantly share code, notes, and snippets.

@fbradyirl
Last active September 17, 2024 09:01
Show Gist options
  • Save fbradyirl/08fef90bd11d7bdddf588a56e668d879 to your computer and use it in GitHub Desktop.
Save fbradyirl/08fef90bd11d7bdddf588a56e668d879 to your computer and use it in GitHub Desktop.
Recreate Sigenergy UI (using modbus sensors) as Home Assistant Card
type: custom:button-card
show_state: true
tap_action: none
custom_fields:
home_image:
card:
type: picture
image: local/Sigenergy/home_has_solar_has_car.png
card_mod:
style: |
ha-card {
background-color: transparent;
border: none;
}
sigenstor_home_image:
card:
type: picture
image: local/Sigenergy/sigenstor_home.png
card_mod:
style: |
ha-card {
background-color: transparent;
border: none;
}
ammeter_home_image:
card:
type: picture
image: local/Sigenergy/ammeter_home.png
card_mod:
style: |
ha-card {
background-color: transparent;
border: none;
}
ac_charger_bg_image:
card:
type: picture
image: local/Sigenergy/ac_charger_bg.png
card_mod:
style: |
ha-card {
background-color: transparent;
border: none;
}
pv_power:
card:
type: custom:mushroom-template-card
primary: '{{states(''sensor.sigen_pv_power'') | round(1) }}kW'
secondary: SOLAR
multiline_secondary: false
fill_container: false
card_mod:
style:
mushroom-state-info$: |
.primary {
font-size: 14px !important;
font-weight: bold !important;
position: relative;
letter-spacing: -0.1px !important; /* Reduce letter spacing */
overflow: visible !important;
text-align: left;
}
.secondary {
font-size: 12px !important;
color: gray !important;
position: relative;
letter-spacing: -0.1px !important; /* Reduce letter spacing */
overflow: visible !important;
text-align: left;
}
.: |
ha-card {
background-color: transparent;
border: none;
}
load_power:
card:
type: custom:mushroom-template-card
primary: '{{states(''sensor.sigen_consumed_power'') | round(1) }}kW'
secondary: HOME
multiline_secondary: false
fill_container: false
card_mod:
style:
mushroom-state-info$: |
.primary {
font-size: 14px !important;
font-weight: bold !important;
position: relative;
letter-spacing: -0.1px !important; /* Reduce letter spacing */
overflow: visible !important;
text-align: left;
}
.secondary {
font-size: 12px !important;
color: gray !important;
letter-spacing: -0.1px !important; /* Reduce letter spacing */
position: relative;
overflow: visible !important;
text-align: left;
}
.: |
ha-card {
background-color: transparent;
border: none;
}
grid_power:
card:
type: custom:mushroom-template-card
primary: >
{% set import = states('sensor.sigen_grid_sensor_import_power') |
round(1) %} {% set export =
states('sensor.sigen_grid_sensor_export_power') | round(1) %} {% if
import > 0 %}
{{ import }}kW
{% elif export > 0 %}
{{ -export }}kW
{% else %}
0
{% endif %}
secondary: |
GRID
multiline_secondary: false
fill_container: false
card_mod:
style:
mushroom-state-info$: |
.primary {
font-size: 14px !important;
font-weight: bold !important;
position: relative;
letter-spacing: -0.1px !important; /* Reduce letter spacing */
overflow: visible !important;
text-align: left;
}
.secondary {
font-size: 12px !important;
color: gray !important;
letter-spacing: -0.1px !important; /* Reduce letter spacing */
position: relative;
overflow: visible !important;
text-align: left;
}
.: |
ha-card {
background-color: transparent;
border: none;
}
grid_flow_label:
card:
type: custom:mushroom-template-card
primary: >
{% set import = states('sensor.sigen_grid_sensor_import_power') | round(1)
%} {% set export = states('sensor.sigen_grid_sensor_export_power') | round(1)
%} {% if import > 0 %}
Importing
{% elif export > 0 %}
Exporting
{% else %} {% endif %}
multiline_secondary: false
fill_container: false
card_mod:
style:
mushroom-state-info$: |
.primary {
font-size: 12px !important;
font-weight: bold !important;
letter-spacing: -0.1px !important; /* Reduce letter spacing */
color: lightgray !important;
position: relative;
overflow: visible !important;
text-align: left;
}
.: |
ha-card {
background-color: transparent;
border: none;
}
battery_soc:
card:
type: custom:mushroom-template-card
primary: >
{% set soc = states('sensor.sigen_energy_storage_system_soc') %} {% set
soc_power = states('sensor.sigen_ess_charge_discharge_power') | round(1) %}
{% if soc_power != 0 %}
{{ soc_power | abs }}kW · {{ soc }}%
{% else %}
{{ soc }}%
{% endif %}
secondary: SigenStor
multiline_secondary: false
fill_container: false
card_mod:
style:
mushroom-state-info$: |
.primary {
font-size: 14px !important;
font-weight: bold !important;
position: relative;
overflow: visible !important;
letter-spacing: -0.1px !important; /* Reduce letter spacing */
text-align: left;
}
.secondary {
font-size: 12px !important;
color: gray !important;
position: relative;
letter-spacing: -0.1px !important; /* Reduce letter spacing */
overflow: visible !important;
text-align: left;
}
.: |
ha-card {
background-color: transparent;
border: none;
}
battery_discharge_label:
card:
type: custom:mushroom-template-card
primary: >
{% set soc = states('sensor.sigen_energy_storage_system_soc') %} {% set
soc_power = states('sensor.sigen_ess_charge_discharge_power') | round(1) %}
{% if soc_power < 0 %}
Discharging
{% else %}
{% endif %}
multiline_secondary: false
fill_container: false
card_mod:
style:
mushroom-state-info$: |
.primary {
font-size: 12px !important;
font-weight: bold !important;
letter-spacing: -0.1px !important; /* Reduce letter spacing */
color: lightgreen !important;
position: relative;
overflow: visible !important;
text-align: left;
}
.: |
ha-card {
background-color: transparent;
border: none;
}
battery_charge_label:
card:
type: custom:mushroom-template-card
primary: >
{% set soc = states('sensor.sigen_energy_storage_system_soc') %} {% set
soc_power = states('sensor.sigen_ess_charge_discharge_power') | round(1) %}
{% if soc_power == 0 %}
{% else %}
{% if soc_power > 0 %}
Charging
{% endif %}
{% endif %}
multiline_secondary: false
fill_container: false
card_mod:
style:
mushroom-state-info$: |
.primary {
font-size: 12px !important;
font-weight: bold !important;
letter-spacing: -0.1px !important; /* Reduce letter spacing */
color: red !important;
position: relative;
overflow: visible !important;
text-align: left;
}
.: |
ha-card {
background-color: transparent;
border: none;
}
ev_soc:
card:
type: custom:mushroom-template-card
primary: >
{% set power = states('sensor.buzz_lightgear_charger_power') | float %}
{% set soc = states('sensor.buzz_lightgear_battery') %} {% set range =
states('sensor.buzz_lightgear_range') | round(0) %} {% if power > 0 %}
{{ power }}kW - {{ soc }}% ({{ range }}km)
{% else %}
{{ soc }}% ({{ range }}km)
{% endif %}
secondary: >
{% set soc = states('sensor.buzz_lightgear_battery') %} {% if soc ==
'unknown' %}
Car Asleep
{% else %}
Buzz Lightgear
{% endif %}
multiline_secondary: false
fill_container: false
card_mod:
style:
mushroom-state-info$: |
.primary {
font-size: 14px !important;
font-weight: bold !important;
position: relative;
letter-spacing: -0.1px !important; /* Reduce letter spacing */
overflow: visible !important;
text-align: left;
}
.secondary {
font-size: 12px !important;
color: gray !important;
position: relative;
letter-spacing: -0.1px !important; /* Reduce letter spacing */
overflow: visible !important;
text-align: left;
}
.: |
ha-card {
background-color: transparent;
border: none;
}
water_diverter_power:
card:
type: custom:mushroom-template-card
primary: >
{% set power = states('sensor.myenergi_eddi_power_charging') | float %}
{% if power > 0 %}
{{ (power / 1000) | round(2) }}kW
{% else %}
{% endif %}
secondary: >
{% set power = states('sensor.myenergi_eddi_power_charging') | float %}
{% if power > 0 %}
🛁 {{states('sensor.myenergi_eddi_23546415_status')}}
{% else %}
{% endif %}
multiline_secondary: false
fill_container: false
card_mod:
style:
mushroom-state-info$: |
.primary {
font-size: 14px !important;
font-weight: bold !important;
position: relative;
letter-spacing: -0.1px !important; /* Reduce letter spacing */
overflow: visible !important;
text-align: left;
}
.secondary {
font-size: 12px !important;
color: gray !important;
position: relative;
letter-spacing: -0.1px !important; /* Reduce letter spacing */
overflow: visible !important;
text-align: left;
}
.: |
ha-card {
background-color: transparent;
border: none;
}
ev_ac_power:
card:
type: custom:mushroom-template-card
primary: '{{states(''sensor.sigen_2024052302935_acpower'')}}kW'
secondary: AC CHARGER
multiline_secondary: false
fill_container: false
card_mod:
style:
mushroom-state-info$: |
.primary {
font-size: 14px !important;
font-weight: bold !important;
position: relative;
letter-spacing: -0.1px !important; /* Reduce letter spacing */
overflow: visible !important;
text-align: left;
}
.secondary {
font-size: 12px !important;
color: gray !important;
position: relative;
letter-spacing: -0.1px !important; /* Reduce letter spacing */
overflow: visible !important;
text-align: left;
}
.: |
ha-card {
background-color: transparent;
border: none;
}
ev_charging_label:
card:
type: custom:mushroom-template-card
primary: >
{% set soc_power = states('sensor.buzz_lightgear_charger_power') | float
%}
{% if soc_power > 0 %}
Charging
{% else %}
{% endif %}
multiline_secondary: false
fill_container: false
card_mod:
style:
mushroom-state-info$: |
.primary {
font-size: 12px !important;
font-weight: bold !important;
letter-spacing: -0.1px !important; /* Reduce letter spacing */
color: red !important;
position: relative;
overflow: visible !important;
text-align: left;
}
.: |
ha-card {
background-color: transparent;
border: none;
}
ev_charging_icon:
card:
type: custom:mushroom-template-card
icon: >-
{% set soc_power = states('sensor.buzz_lightgear_charger_power') | float
%}
{% if soc_power > 0 %}
mdi:lightning-bolt
{% endif %}
icon_color: >-
{% set soc_power = states('sensor.buzz_lightgear_charger_power') | float
%}
{% if soc_power > 0 %}
red
{% endif %}
fill_container: false
card_mod:
style:
mushroom-state-info$: |
.primary {
font-size: 12px !important;
font-weight: bold !important;
letter-spacing: -0.1px !important; /* Reduce letter spacing */
color: lightgreen !important;
position: relative;
overflow: visible !important;
text-align: left;
}
.: |
ha-card {
background-color: transparent;
border: none;
}
styles:
card:
- align-self: start
- height: >
[[[ return states['input_number.sigen_home_card_height'].state + 'px';
]]]
- opacity: 1
- background-color: transparent
- border: none
custom_fields:
home_image:
- position: absolute
- top: 5px
- left: 10px
- width: 395px
sigenstor_home_image:
- position: absolute
- top: 5px
- left: 10px
- width: 395px
ammeter_home_image:
- position: absolute
- top: 5px
- left: 10px
- width: 395px
ac_charger_bg_image:
- position: absolute
- top: 5px
- left: 10px
- width: 395px
pv_power:
- position: absolute
- top: 15px
- left: 210px
- width: 100px
load_power:
- position: absolute
- top: 15px
- left: 300px
- width: 100px
water_diverter_power:
- position: absolute
- top: 110px
- left: 130px
- width: 100px
grid_power:
- position: absolute
- top: 300px
- left: 300px
- width: 100px
grid_flow_label:
- position: absolute
- top: 335px
- left: 300px
- width: 100px
battery_soc:
- position: absolute
- top: 300px
- left: 175px
- width: 100px
battery_discharge_label:
- position: absolute
- top: 335px
- left: 175px
- width: 100px
battery_charge_label:
- position: absolute
- top: 335px
- left: 175px
- width: 100px
ev_soc:
- position: absolute
- top: 300px
- left: 20px
- width: 100px
ev_ac_power:
- position: absolute
- top: 15px
- left: 20px
- width: 100px
ev_charging_label:
- position: absolute
- top: 335px
- left: 20px
- width: 100px
ev_charging_icon:
- position: absolute
- top: 245px
- left: 10px
- width: 100px
@fbradyirl
Copy link
Author

fbradyirl commented Sep 9, 2024

Modbus Frontend Card

This is an attempt to build a nice looking card which reads the Sigenergy modbus sensor values in Home Assistant.

Screenshot 2024-09-10 at 09 35 01

Download the images from:

and place those in the directory /config/www/Sigenergy/ on your HA instance.

The data being read is all local via Modbus. Install the Sigenergy-Home-Assistant-Integration integration.

Now install the following via HACS:

You might also see some MyEnergy (EDDI) and Tesla references in the yaml. If you have either of those, install their corresponding HACS components:

Once all that is set up, create a new card in HA, and edit the yaml and paste in the above. Delete parts you don't need.

Still todo:

  • Add lines indicating energy flow.
  • Add data from Sigen AC EV Charger (from modbus)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment