Solar power widget. Shows grid and solar usage

This is a widget for solar panel monitoring. The code came from someone else and I have modified it to change colours when on solar or grid power. Thanks to whoever wrote the orginal code. I can’t find where I got it from.

I have added in the props section the Fronius binding names in case anyone using the fronius binding want to know which items to use. I am sure this will work with all other solar installations.

Screenshot of when power is coming from the grid.

Changelog

  • initial release
uid: solar-power-widget
tags: []
props:
  parameters:
    - context: item
      description: GRID Power Item
      label: GRID Power Item FroniusSymoInverter_GridPower
      name: gridPower
      required: true
      type: TEXT
    - context: item
      description: SOLAR Power Item
      label: SOLAR Power Item FroniusSymoInverter_CurrentSolarYield
      name: solarPower
      required: true
      type: TEXT
    - context: item
      description: VOLTAGE Item
      label: VOLTAGE Item FroniusSmartMeter_ACVoltagePhase1
      name: voltageItem
      required: true
      type: TEXT
    - context: item
      description: CONSUMPTION Item
      label: CONSUMPTION Item FroniusSymoInverter_LoadPower
      name: consumption
      required: true
      type: TEXT
  parameterGroups: []
timestamp: Oct 21, 2022, 11:20:06 AM
component: f7-card
config:
  class:
    - padding-bottom
  style:
    --f7-popover-width: 760px
slots:
  default:
    - component: f7-row
      config:
        class:
          - margin-top
        style:
          top: 0px
          width: 100%
          height: 100%
      slots:
        default:
          - component: f7-col
            config:
              width: 20
              class:
                - display-flex
                - flex-direction-column
                - align-content-space-around
            slots:
              default:
                - component: oh-gauge
                  config:
                    type: semicircle
                    item: =props.gridPower
                    borderColor: =Number.parseFloat(items[props.gridPower].state) >= 0 ? 'red' :'green'
                    min: -5000
                    max: 5000
                    valueTextColor: =Number.parseFloat(items[props.gridPower].state) >= 0 ? 'red' :'green'
                    valueFontSize: 25
                    borderBgColor: gray
                    labelText: GRID
                    borderWidth: 20
                    class:
                      - margin-top
                      - margin-bottom
                - component: oh-gauge
                  config:
                    type: semicircle
                    item: =props.solarPower
                    borderColor: =Number.parseFloat(items[props.solarPower].state) != 0 ? 'green' :'blue'
                    min: -5000
                    max: 5000
                    valueTextColor: =Number.parseFloat(items[props.solarPower].state) != 0 ? 'green' :'blue'
                    valueFontSize: 25
                    borderBgColor: gray
                    labelText: SOLAR
                    borderWidth: 25
                    class:
                      - margin-top
                      - margin-bottom
                - component: oh-gauge
                  config:
                    type: semicircle
                    item: =props.consumption
                    borderColor: =(Number.parseFloat(items[props.solarPower].state) + Number.parseFloat(items[props.consumption].state)) >= Number.parseFloat(items[props.gridPower].state) ? 'green' :'red'
                    min: -5000
                    max: 5000
                    valueTextColor: =(Number.parseFloat(items[props.solarPower].state) + Number.parseFloat(items[props.consumption].state)) >= Number.parseFloat(items[props.gridPower].state) ? 'green' :'red'
                    valueFontSize: 25
                    borderBgColor: gray
                    labelText: CONSUMPTION
                    borderWidth: 25
                    class:
                      - margin-top
                      - margin-bottom
                - component: f7-col
                  config:
                    width: 20
                  slots:
                    default:
                      - component: oh-icon
                        config:
                          color: =Number.parseFloat(items[props.gridPower].state) <= 0 ? 'yellow':'red'
                          icon: =Number.parseFloat(items[props.gridPower].state) <= 0 ? 'f7:sun_max_fill':'if:mdi-transmission-tower-import'
                          width: 20
                          style:
                            position: absolute
                      - component: Label
                        config:
                          text: =(items[props.voltageItem].state)
                          style:
                            font-size: 20px
                            font-weight: 500
                            line-height: 65px
                            text-align: left
                            white-space: nowrap
                      - component: Label
                        config:
                          text: =Number.parseFloat(items[props.gridPower].state) <= 0 ? 'Currently on Solar':'Currently on Grid'
                          style:
                            color: =Number.parseFloat(items[props.gridPower].state) <= 0 ? 'Green':'Red'
                            font-size: 13px
                            font-weight: 400
                            line-height: 1px
                            text-align: left
                            white-space: nowrap
          - component: f7-col
            config:
              width: 80
            slots:
              default:
                - component: oh-chart
                  config:
                    chartType: ""
                    period: 12h
                    label: Power
                  slots:
                    grid:
                      - component: oh-chart-grid
                        config:
                          containLabel: false
                    xAxis:
                      - component: oh-time-axis
                        config:
                          gridIndex: 0
                    yAxis:
                      - component: oh-value-axis
                        config:
                          gridIndex: 0
                          name: W
                    series:
                      - component: oh-time-series
                        config:
                          name: Grid
                          gridIndex: 0
                          xAxisIndex: 0
                          yAxisIndex: 0
                          type: line
                          color: blue
                          item: =props.gridPower
                      - component: oh-time-series
                        config:
                          name: Solar
                          gridIndex: 0
                          xAxisIndex: 0
                          yAxisIndex: 0
                          type: line
                          color: green
                          item: =props.solarPower
                    tooltip:
                      - component: oh-chart-tooltip
                        config:
                          confine: true
                          smartFormatter: true
                    legend:
                      - component: oh-chart-legend
                        config:
                          bottom: 3
                          type: scroll
                    dataZoom:
                      - component: oh-chart-datazoom
                        config:
                          type: inside

5 Likes

Nice and straight forward widget.
But I wonder why there is a voltage?

The voltage is there because I was having over voltage issues so I put it on the display to keep track of it.
I had to get the power company to tap down the voltage at the street transformer to drop my voltage as the solar panels were shutting down because of too much voltage.
If you look at the screenshots the voltage was around 250V it is around 240V now.
It was going as high as 260V when full sun.
All is good now and the solar panels haven’t shut down since the transformer tap down.

1 Like

Very cool widget. Thanks for it. I have modified it a bit to show solar power, battery state of charge and water temperature state next to the graph that shows solar, grid and battery power (I am using Fronius components).

uid: storage-power-graph
tags: []
props:
  parameters:
    - context: item
      description: GRID Power Item
      label: GRID Power
      name: gridPower
      required: true
      type: TEXT
    - context: item
      description: SOLAR Power Item
      label: SOLAR Power
      name: solarPower
      required: true
      type: TEXT
    - context: item
      description: VOLTAGE Item
      label: VOLTAGE Item
      name: voltageItem
      required: false
      type: TEXT
    - context: item
      description: CONSUMPTION Item
      label: CONSUMPTION Item
      name: consumption
      required: true
      type: TEXT
    - context: item
      description: BATTERY State
      label: Battery State
      name: batteryState
      required: true
      type: TEXT
    - context: item
      description: BATTERY Power
      label: Battery Power
      name: batteryPower
      required: true
      type: TEXT
    - context: item
      description: Ohmpilot State
      label: Ohmpilot State
      name: ohmpilotState
      required: true
      type: TEXT
  parameterGroups: []
timestamp: Mar 29, 2024, 7:06:30 PM
component: f7-card
config:
  class:
    - padding-bottom
  style:
    --f7-popover-width: 760px
  title: Storage State & Power Graph
slots:
  default:
    - component: f7-row
      config:
        class:
          - margin-top
        style:
          height: 100%
          top: 0px
          width: 100%
      slots:
        default:
          - component: f7-col
            config:
              class:
                - display-flex
                - flex-direction-column
                - align-content-space-around
              width: 20
            slots:
              default:
                - component: oh-gauge
                  config:
                    borderBgColor: gray
                    borderColor: =Number.parseFloat(items[props.solarPower].state) < 900 ? 'orange' :'#6cbe58'
                    borderWidth: 20
                    class:
                      - margin-top
                      - margin-bottom
                    item: =props.solarPower
                    labelText: SOLAR
                    max: 5000
                    min: 0
                    type: semicircle
                    valueFontSize: 25
                    valueTextColor: =Number.parseFloat(items[props.solarPower].state) < 900 ? 'orange' :'#6cbe58'
                - component: oh-gauge
                  config:
                    borderBgColor: gray
                    borderColor: =Number.parseFloat(items[props.batteryState].state) <= 10 ? '#6cbe58' :'orange'
                    borderWidth: 25
                    class:
                      - margin-top
                      - margin-bottom
                    item: =props.batteryState
                    labelText: BATTERY
                    max: 1
                    min: 0
                    type: semicircle
                    valueFontSize: 25
                    valueTextColor: =Number.parseFloat(items[props.batteryState].state) <= 10 ? '#6cbe58' :'orange'
                - component: oh-gauge
                  config:
                    borderBgColor: gray
                    borderColor: =Number.parseFloat(items[props.ohmpilotState].state) <= 40 ? 'orange' :'#6cbe58'
                    borderWidth: 25
                    class:
                      - margin-top
                      - margin-bottom
                    item: =props.ohmpilotState
                    labelText: WATER
                    max: 60
                    min: 10
                    type: semicircle
                    valueFontSize: 25
                    valueTextColor: =Number.parseFloat(items[props.ohmpilotState].state) <= 40 ? 'orange' :'#6cbe58'
                - component: f7-col
                  config:
                    width: 20
          - component: f7-col
            config:
              width: 80
            slots:
              default:
                - component: oh-chart
                  config:
                    chartType: ""
                    label: Power
                    period: 4h
                  slots:
                    dataZoom:
                      - component: oh-chart-datazoom
                        config:
                          type: inside
                    grid:
                      - component: oh-chart-grid
                        config:
                          containLabel: false
                    legend:
                      - component: oh-chart-legend
                        config:
                          bottom: 3
                          type: scroll
                    series:
                      - component: oh-time-series
                        config:
                          color: gray
                          gridIndex: 0
                          item: =props.gridPower
                          name: Grid
                          type: line
                          xAxisIndex: 0
                          yAxisIndex: 0
                      - component: oh-time-series
                        config:
                          color: orange
                          gridIndex: 0
                          item: =props.solarPower
                          name: Solar
                          type: line
                          xAxisIndex: 0
                          yAxisIndex: 0
                      - component: oh-time-series
                        config:
                          color: "#6cbe58"
                          gridIndex: 0
                          item: =props.batteryPower
                          name: Battery
                          type: line
                          xAxisIndex: 0
                          yAxisIndex: 0
                    tooltip:
                      - component: oh-chart-tooltip
                        config:
                          confine: true
                          smartFormatter: true
                    xAxis:
                      - component: oh-time-axis
                        config:
                          gridIndex: 0
                    yAxis:
                      - component: oh-value-axis
                        config:
                          gridIndex: 0
                          name: W

1 Like