Action on oh-icon not working

When I want a button to open another window or do something else, I always use oh-button, but this element doesn’t support Iconify (yet). that’s why I was looking at oh-icon, but I don’t get my actions to work, actually, nothing happens at all. I’m runnning OH 3.3

Working action with oh-button:

- component: oh-button
            config:
              iconF7: gear_alt_fill
              color: gray
              iconSize: 18
              action: popup
              actionModal: widget:onkyo
              actionModalConfig:
                itemPrefix: Onkyo

Not working with oh-icon:

- component: oh-icon
            config:
              icon: iconify:mdi:television-ambient-light
              width: 20px
              color: gray
              action: popup
              actionModal: widget:onkyo
              actionModalConfig:
                itemPrefix: Onkyo

Did you solve this.
I have the same problem.

I use a “workaround” for oh-chart component (see Include graphic in custom echarts gauge widget - #2 by crnjan), cannot try it out if below works too since I’m not at home, but maybe something like:

- component: f7-block
  config:
    class:
      - no-margin
  slots:
    default:
      - component: oh-link
        config:
          style:
            position: absolute
            width: 100%
            height: 100%
          actionModal: widget:onkyo
          actionModalConfig:
            itemPrefix: Onkyo
      - component: oh-icon
        config:
               ...

I can confirm the following works

tapping on icon will display

My problem is that i have three different icons with different actions on the card.

Actions on an oh-icon work if the icon has been defined with one of the oh specific icons. F7 and iconify icons at present do not register actions. I don’t know if this is a technical limitation, or an oversight. If you wish to see it addressed you can post an issue on the web repo.

In the meantime, the solution is the oh-link. Anywhere you have an oh-icon you should be able to substitute an oh-link with the action configurations and then add the oh-icon in the link’s default slot.

- component: oh-link
  config:
    action: ...
  slots:
    default:
      - component: oh-icon
        config:
          icon: iconify:...

Perfect.

I just stumbled across this problem as well but I can’t get the proposed workaround to work. Could this be a regression in OH4.0.2 or am I doing something wrong?

I always get the following exception in the openhab.log when I click the link (clicking the OH-toggle below works just fine for the same item):

2023-08-27 15:12:05.515 [ERROR] [rg.apache.cxf.jaxrs.utils.JAXRSUtils] - No message body reader has been found for class java.lang.String, ContentType: application/octet-stream
2023-08-27 15:12:05.517 [WARN ] [s.impl.WebApplicationExceptionMapper] - javax.ws.rs.WebApplicationException: HTTP 415 Unsupported Media Type
	at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:1473)
	at org.apache.cxf.jaxrs.utils.JAXRSUtils.processRequestBodyParameter(JAXRSUtils.java:950)
	at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:881)
	at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:215)
	at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:79)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:265)
	at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
	at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:225)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:298)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:217)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:517)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:273)
	at org.ops4j.pax.web.service.spi.servlet.OsgiInitializedServlet.service(OsgiInitializedServlet.java:102)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
	at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1656)
	at org.ops4j.pax.web.service.spi.servlet.OsgiFilterChain.doFilter(OsgiFilterChain.java:100)
	at org.ops4j.pax.web.service.jetty.internal.PaxWebServletHandler.doHandle(PaxWebServletHandler.java:310)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:234)
	at org.ops4j.pax.web.service.jetty.internal.PrioritizedHandlerCollection.handle(PrioritizedHandlerCollection.java:96)
	at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:722)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	at org.eclipse.jetty.server.Server.handle(Server.java:516)
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
	at java.base/java.lang.Thread.run(Thread.java:833)

I have the following code. It is from my universal toggle widget, I try to make the icon clickable as well:

First the excerpt with the change I just did (replaced a simple f7-icon with the oh-link/f7-icon combination):

                            - component: oh-link
                              config:
                                action: toggle
                                actionItem: =props.maintoggle
                              slots:
                                default:
                                  - component: f7-icon
                                    config:
                                      color: '=items[props.maintoggle].state == "ON" ? props.color : items[props.maintoggle].state > 0 ? props.color : "gray"'
                                      f7: =props.icon
                                      size: '=(props.grouptogglearray) ? "100" : "120"'
                            - component: oh-toggle
                              config:
                                colorTheme: =props.color
                                item: =props.maintoggle
                            - component: f7-block
                              config:
                                style:
                                  display: '=(props.grouptogglearray) ? "block" : "none"'
                                  height: 35px

Here the full example that can be copied & pasted:

uid: universal_toggle_v3
tags: []
props:
  parameters:
    - description: Title of the card
      label: Title
      name: title
      required: false
      type: TEXT
    - description: The card footer
      label: Footer
      name: footer
      required: false
      type: TEXT
    - description: Name of the Icon (see https://framework7.io/icons/ for available icons)
      label: F7 Icon
      name: icon
      required: true
      type: TEXT
    - description: Color scheme for icons and toggles (see https://framework7.io/docs/color-themes.html for available color schemes)
      label: Color
      name: color
      required: true
      type: TEXT
    - context: item
      description: Main toggle item (use for single toggle or as main switch for group)
      label: Item
      name: maintoggle
      required: false
      type: TEXT
    - description: Group toggles (use as group with or without main toggle)
      label: Group toggle Array
      name: grouptogglearray
      required: false
      type: TEXT
  parameterGroups: []
timestamp: Aug 27, 2023, 3:05:01 PM
component: f7-card
config:
  title: =(props.title)
slots:
  default:
    - component: f7-card-content
      slots:
        default:
          - component: f7-swiper
            config:
              init: true
              pagination: "=(props.maintoggle) && (props.grouptogglearray) ? true : false"
              params:
                pagination:
                  clickable: true
                slidesPerView: 1
              style:
                height: 175px
                width: 100%
            slots:
              default:
                - component: f7-swiper-slide
                  config:
                    style:
                      height: 100%
                      width: 100%
                    visible: "=(props.maintoggle) ? true : false"
                  slots:
                    default:
                      - component: f7-col
                        config:
                          class:
                            - display-flex
                            - flex-direction-column
                            - align-items-center
                            - justify-content-space-evenly
                          style:
                            height: 100%
                            width: 100%
                        slots:
                          default:
                            - component: oh-link
                              config:
                                action: toggle
                                actionItem: =props.maintoggle
                              slots:
                                default:
                                  - component: f7-icon
                                    config:
                                      color: '=items[props.maintoggle].state == "ON" ? props.color : items[props.maintoggle].state > 0 ? props.color : "gray"'
                                      f7: =props.icon
                                      size: '=(props.grouptogglearray) ? "100" : "120"'
                            - component: oh-toggle
                              config:
                                colorTheme: =props.color
                                item: =props.maintoggle
                            - component: f7-block
                              config:
                                style:
                                  display: '=(props.grouptogglearray) ? "block" : "none"'
                                  height: 35px
                - component: f7-swiper-slide
                  config:
                    visible: "=(props.grouptogglearray) ? true : false"
                  slots:
                    default:
                      - component: f7-swiper
                        config:
                          params:
                            direction: vertical
                            mousewheel: true
                            scrollbar:
                              hide: true
                            slidesPerView: 1
                          scrollbar: true
                          style:
                            height: 100%
                            width: 100%
                        slots:
                          default:
                            - component: oh-repeater
                              config:
                                for: item
                                fragment: true
                                in: =props.grouptogglearray.split("|")
                              slots:
                                default:
                                  - component: f7-swiper-slide
                                    config:
                                      style:
                                        height: 100%
                                        width: 100%
                                    slots:
                                      default:
                                        - component: f7-col
                                          config:
                                            class:
                                              - display-flex
                                              - flex-direction-column
                                              - align-items-center
                                              - justify-content-space-evenly
                                            style:
                                              height: 100%
                                              width: 100%
                                          slots:
                                            default:
                                              - component: f7-block-title
                                                config:
                                                  style:
                                                    margin-bottom: -2px
                                                    margin-top: 10px
                                                slots:
                                                  default:
                                                    - component: Label
                                                      config:
                                                        text: =loop.item.split("\"")[1]
                                              - component: f7-icon
                                                config:
                                                  color: '=items[loop.item.split("\"")[3]].state == "ON" ? props.color : "gray"'
                                                  f7: =props.icon
                                                  size: 70
                                              - component: oh-toggle
                                                config:
                                                  colorTheme: =props.color
                                                  item: =(loop.item.split("\"")[3])
                                              - component: f7-block
                                                config:
                                                  style:
                                                    display: '=(props.maintoggle) ? "block" : "none"'
                                                    height: 35px
    - component: f7-card-footer
      slots:
        default:
          - component: Label
            config:
              text: =props.footer

The toggle action does not have any default commands to send. It also requires you to set the actionCommand and actionCommandAlt properties.

- component: oh-link
  config:
    action: toggle
    actionItem: =props.maintoggle
    actionCommand: ON
    actionCommandAlt: OFF

Thanks a lot JustinG! This makes sense… :slight_smile: Works perfectly, too :slight_smile:

I have the following widget

image

based on the widget PV status widget for sungrow inverters .

I would like the analyzer to open when I click on the solar panel icon with the mouse. I looked here in the thread for this. This works as long as I am only in the Developer Tools → Widgets.

Section in widget code line 362

                      - component: f7-block
                        config:
                          style:
                            align-items: center
                            display: flex
                            flex-direction: column
                            height: 160px
                            justify-content: center
                            position: absolute
                            width: 290px
                        slots:
                          default:
                            - component: oh-link
                              config:
                                action: analyzer
                                actionAnalyzerItems:
                                  - Sungrow_Inverter_Total_DC_Power
                              slots:
                                default:
                                  - component: oh-icon
                                    config:
                                      actionPropsParameterGroup: solarAction
                                      height: 75px
                                      icon: oh:sungrow:pv
                                      style:
                                        margin-bottom: 10px

If I embed the widget in a page, it no longer works. What could be the reason for this?

Complete widget code
uid: Widget_Sungrow_Inverter_Status
tags:
  - card
  - V1.0
props:
  parameters:
    - default: PV Status
      label: Header Text
      name: headerText
      required: true
      type: TEXT
    - context: item
      default: Sungrow_Inverter_Total_DC_Power
      label: Solar Power
      name: solarPower
      required: true
      type: TEXT
    - context: item
      default: Sungrow_Inverter_Daily_PV_Generation
      description: Solar Energy
      label: Solar Energy
      name: solarEnergy
      required: true
      type: TEXT
    - context: item
      default: Sungrow_Inverter_Load_Power
      description: Current Load Power
      label: Power Consumption Home
      name: loadPower
      required: true
      type: TEXT
    - context: item
      default: Sungrow_Inverter_Daily_Import_Energy
      label: Daily Import Energy
      name: importEnergy
      required: true
      type: TEXT
    - context: item
      default: Sungrow_Inverter_Daily_Direct_Energy_Consumption
      description: Daily Direct Energy Consumption
      name: directEnergyConsumption
      required: true
      type: TEXT
    - context: item
      default: Sungrow_Inverter_Export_Power
      description: Export Power
      name: exportPower
      required: true
      type: TEXT
    - context: item
      default: Sungrow_Inverter_Daily_Export_Energy
      description: Daily Export Energy
      name: exportEnergy
      required: true
      type: TEXT
    - context: item
      default: Sungrow_Inverter_Battery_Level
      description: Battery Level
      name: batteryLevel
      required: true
      type: TEXT
    - context: item
      default: Sungrow_Inverter_Daily_Charge_Energy
      description: Battery Charge Energy
      name: batteryChargeEnergy
      required: true
      type: TEXT
    - context: item
      default: Sungrow_Inverter_Daily_Battery_Discharge_Energy
      description: Battery Discharge Energy
      name: batteryDischargeEnergy
      required: true
      type: TEXT
    - context: item
      default: Sungrow_Inverter_Battery_Power
      description: Battery Power
      name: batteryPower
      required: true
      type: TEXT
  parameterGroups:
    - name: solarAction
      context: action
      label: Solar Action
      description: Action to perform when the solar icon is clicked
    - name: loadAction
      context: action
      label: Load Action
      description: Action to perform when the load icon is clicked
timestamp: Aug 7, 2025, 9:47:44 PM
component: oh-context
config:
  constants: {}
  functions:
    getFormattedState: =(item) => (@item).replace('-', '').replace('kWh',
      'ᵏᵂʰ').replace('kW', 'ᵏᵂ').replace('W', 'ᵂ')
    isNegative: =(item) => @item !== undefined && Number((@item).split('
      ')[0].replace(',', '.')) < 0
    isOnBackupPower: =() => props.backuppower && (@@props.backuppower === 'OPEN' ||
      @@props.backuppower === 'ON')
    isPositive: =(item) => @item !== undefined && Number((@item).split('
      ')[0].replace(',', '.')) > 0
  variable: {}
slots:
  default:
    - component: f7-card
      config:
        style:
          border-radius: var(--f7-card-expandable-border-radius)
          box-shadow: 5px 5px 10px 1px rgba(0,0,0,0.1)
          height: 390px
          margin-left: 5px
          margin-right: 5px
          min-width: 350px
        title: =props.headerText
      slots:
        default:
          - component: f7-card-content
            config:
              style:
                display: flex
                justify-content: center
                padding: 0
            slots:
              default:
                - component: div
                  config:
                    style:
                      position: relative
                      transform: translate(-175px,0)
                  slots:
                    default:
                      - component: f7-block
                        config:
                          style:
                            comment: Line - PV to house
                            background-image: url('data:image/svg+xml,<svg
                              xmlns="http://www.w3.org/2000/svg"><line x1="150"
                              y1="65" x2="150" y2="120"
                              style="stroke:lightgrey;stroke-width:4"/></svg>')
                            border-style: solid
                            border-width: 0px
                            height: 350px
                            left: 0px
                            margin-left: auto
                            margin-right: auto
                            margin-top: auto
                            position: absolute
                            top: 35px
                            width: 350px
                      - component: f7-block
                        config:
                          style:
                            comment: Line - pv to house
                            background-image: url('data:image/svg+xml,<svg
                              xmlns="http://www.w3.org/2000/svg"><line x1="150"
                              y1="65" x2="150" y2="120" style="stroke:rgba(100,
                              150, 200);stroke-width:4"/></svg>')
                            border-style: solid
                            border-width: 0px
                            height: 350px
                            left: 0px
                            margin-left: auto
                            margin-right: auto
                            margin-top: auto
                            position: absolute
                            top: 35px
                            width: 350px
                          visible: =Number.parseFloat(items[props.solarPower].state) > 0
                      - component: f7-block
                        config:
                          style:
                            comment: Path - house to grid
                            background-image: url('data:image/svg+xml,<svg
                              xmlns="http://www.w3.org/2000/svg"><path d="M180
                              75 V90 q0 40 40 40 H260" stroke= "lightgrey"
                              stroke-width="4" fill="none"/></svg>')
                            border-style: solid
                            border-width: 0px
                            height: 350px
                            left: 0px
                            margin-left: auto
                            margin-right: auto
                            margin-top: auto
                            position: absolute
                            top: 150px
                            width: 350px
                      - component: f7-block
                        config:
                          style:
                            comment: Path - house to grid
                            background-image: url('data:image/svg+xml,<svg
                              xmlns="http://www.w3.org/2000/svg"><path d="M180
                              75 V90 q0 40 40 40 H260" style="stroke:rgba(100,
                              150, 200);stroke-width:4" fill="none"/></svg>')
                            border-style: solid
                            border-width: 0px
                            height: 350px
                            left: 0px
                            margin-left: auto
                            margin-right: auto
                            margin-top: auto
                            position: absolute
                            top: 150px
                            width: 350px
                          visible: =Number.parseFloat(items[props.exportPower].state) < 0
                      - component: f7-block
                        config:
                          style:
                            comment: Path - battery to house
                            background-image: url('data:image/svg+xml,<svg
                              xmlns="http://www.w3.org/2000/svg"><path d="M120
                              75 V90 q0 40 -40 40 H60" stroke="lightgrey"
                              stroke-width="4" fill="none"/></svg>')
                            border-style: solid
                            border-width: 0px
                            height: 350px
                            left: 0px
                            margin-left: auto
                            margin-right: auto
                            margin-top: auto
                            position: absolute
                            top: 150px
                            width: 350px
                      - component: f7-block
                        config:
                          style:
                            comment: Path - battery to house
                            background-image: url('data:image/svg+xml,<svg
                              xmlns="http://www.w3.org/2000/svg"><path d="M120
                              75 V90 q0 40 -40 40 H60" stroke="rgba(100, 150,
                              200)" stroke-width= "4" fill="none"/></svg>')
                            border-style: solid
                            border-width: 0px
                            height: 350px
                            left: 0px
                            margin-left: auto
                            margin-right: auto
                            margin-top: auto
                            position: absolute
                            top: 150px
                            width: 350px
                          visible: =Number.parseFloat(items[props.batteryPower].state) > 0 &&
                            Number.parseFloat(items[props.loadPower].state) >
                            Number.parseFloat(items[props.solarPower].state)
                      - component: f7-block
                        config:
                          style:
                            comment: Path - solar to grid
                            background-image: url('data:image/svg+xml,<svg
                              xmlns="http://www.w3.org/2000/svg"><path d="M205
                              40 h30 q40 0 40 40 V215" stroke="lightgrey"
                              stroke-width="4" fill="none"/></svg>')
                            border-style: solid
                            border-width: 0px
                            height: 350px
                            left: 0px
                            margin-left: auto
                            margin-right: auto
                            margin-top: auto
                            position: absolute
                            top: 35px
                            width: 350px
                      - component: f7-block
                        config:
                          style:
                            comment: Path - solar to grid
                            background-image: url('data:image/svg+xml,<svg
                              xmlns="http://www.w3.org/2000/svg"><path d="M205
                              40 h30 q40 0 40 40 V215" stroke="rgba(100, 150,
                              200)" stroke-width="4" fill="none"/></svg>')
                            border-style: solid
                            border-width: 0px
                            height: 350px
                            left: 0px
                            margin-left: auto
                            margin-right: auto
                            margin-top: auto
                            position: absolute
                            top: 35px
                            width: 350px
                          visible: =Number.parseFloat(items[props.exportPower].state) > 0
                      - component: f7-block
                        config:
                          style:
                            comment: Path - solar to battery
                            background-image: url('data:image/svg+xml,<svg
                              xmlns="http://www.w3.org/2000/svg"><path d="M120
                              40 h-55 q-40 0 -40 40 V215" stroke="lightgrey"
                              stroke-width="4" fill="none"/></svg>')
                            border-style: solid
                            border-width: 0px
                            height: 350px
                            left: 0px
                            margin-left: auto
                            margin-right: auto
                            margin-top: auto
                            position: absolute
                            top: 35px
                            width: 350px
                      - component: f7-block
                        config:
                          style:
                            comment: Path - solar to battery
                            background-image: url('data:image/svg+xml,<svg
                              xmlns="http://www.w3.org/2000/svg"><path d="M120
                              40 h-55 q-40 0 -40 40 V215" stroke="rgba(100, 150,
                              200)" stroke-width="4" fill="none"/></svg>')
                            border-style: solid
                            border-width: 0px
                            height: 350px
                            left: 0px
                            margin-left: auto
                            margin-right: auto
                            margin-top: auto
                            position: absolute
                            top: 35px
                            width: 350px
                          visible: =Number.parseFloat(items[props.batteryPower].state) > 0 &&
                            Number.parseFloat(items[props.loadPower].state) <
                            Number.parseFloat(items[props.solarPower].state)
                      - component: f7-block
                        config:
                          style:
                            comment: Line - battery to grid
                            background-image: url('data:image/svg+xml,<svg
                              xmlns="http://www.w3.org/2000/svg"><line x1="60"
                              y1="260" x2="260" y2="260" stroke="lightgrey"
                              stroke-width="4" fill="none"/></svg>')
                            border-style: solid
                            border-width: 0px
                            height: 330px
                            left: 0px
                            margin-left: auto
                            margin-right: auto
                            margin-top: auto
                            position: absolute
                            top: 35px
                            width: 350px
                      - component: f7-block
                        config:
                          style:
                            comment: Line - battery to grid
                            background-image: url('data:image/svg+xml,<svg
                              xmlns="http://www.w3.org/2000/svg"><line x1="60"
                              y1="260" x2="260" y2="260" stroke="rgba(100, 150,
                              200)" stroke-width="4" fill="none"/></svg>')
                            border-style: solid
                            border-width: 0px
                            height: 330px
                            left: 0px
                            margin-left: auto
                            margin-right: auto
                            margin-top: auto
                            position: absolute
                            top: 35px
                            width: 350px
                          visible: =Number.parseFloat(items[props.batteryPower].state) > 0 &&
                            Number.parseFloat(items[props.loadPower].state) >
                            Number.parseFloat(items[props.solarPower].state) &&
                            Number.parseFloat(items[props.batteryPower].state) >
                            Number.parseFloat(items[props.loadPower].state)
                      - component: f7-block
                        config:
                          style:
                            align-items: center
                            display: flex
                            flex-direction: column
                            height: 160px
                            justify-content: center
                            position: absolute
                            width: 290px
                        slots:
                          default:
                            - component: oh-link
                              config:
                                action: analyzer
                                actionAnalyzerItems:
                                  - Sungrow_Inverter_Total_DC_Power
                              slots:
                                default:
                                  - component: oh-icon
                                    config:
                                      actionPropsParameterGroup: solarAction
                                      height: 75px
                                      icon: oh:sungrow:pv
                                      style:
                                        margin-bottom: 10px
                      - component: f7-block
                        config:
                          style:
                            align-items: center
                            display: flex
                            flex-direction: column
                            height: 600px
                            justify-content: center
                            position: absolute
                            width: 550px
                        slots:
                          default:
                            - component: oh-icon
                              config:
                                height: 75px
                                icon: oh:sungrow:grid
                                style:
                                  margin-bottom: 10px
                      - component: f7-block
                        config:
                          style:
                            align-items: center
                            display: flex
                            flex-direction: column
                            height: 390px
                            justify-content: center
                            position: absolute
                            width: 300px
                        slots:
                          default:
                            - component: oh-icon
                              config:
                                actionPropsParameterGroup: loadAction
                                height: 85px
                                icon: oh:sma-energy:house
                                style:
                                  margin-bottom: 10px
                      - component: f7-block
                        config:
                          style:
                            align-items: center
                            display: flex
                            flex-direction: column
                            height: 600px
                            justify-content: center
                            position: absolute
                            width: 0px
                        slots:
                          default:
                            - component: oh-icon
                              config:
                                height: 75x
                                icon: oh:sungrow:battery
                                style:
                                  margin-bottom: 10px
                      - component: f7-block
                        config:
                          style:
                            border-style: solid
                            border-width: 0px
                            height: 350px
                            left: 0px
                            margin-left: auto
                            margin-right: auto
                            margin-top: 10px
                            position: absolute
                            text-align: right
                            width: 350px
                        slots:
                          default:
                            - component: Label
                              config:
                                style:
                                  font-size: 12px
                                  font-weight: bold
                                  left: 130px
                                  position: absolute
                                  top: 0px
                                  width: 60px
                                text: =(items[props.solarPower].state)
                            - component: Label
                              config:
                                style:
                                  font-size: 12px
                                  font-weight: bold
                                  left: 130px
                                  position: absolute
                                  top: 15px
                                  width: 60px
                                text: =(items[props.solarEnergy].state)
                            - component: Label
                              config:
                                style:
                                  font-size: 12px
                                  font-weight: bold
                                  left: 90px
                                  position: absolute
                                  top: 105px
                                  width: 50px
                                text: = Math.min(Number.parseFloat(items[props.loadPower].state),
                                  Number.parseFloat(items[props.solarPower].state))
                                  + " " + items[props.loadPower].state.split("
                                  ")[1]
                            - component: Label
                              config:
                                style:
                                  font-size: 12px
                                  font-weight: bold
                                  left: 90px
                                  position: absolute
                                  top: 120px
                                  width: 50px
                                text: =(items[props.directEnergyConsumption].state)
                            - component: Label
                              config:
                                style:
                                  font-size: 12px
                                  font-weight: bold
                                  left: 120px
                                  position: absolute
                                  top: 215px
                                  width: 50px
                                text: =(items[props.loadPower].state)
                            - component: Label
                              config:
                                style:
                                  font-size: 12px
                                  font-weight: bold
                                  left: 120px
                                  position: absolute
                                  top: 230px
                                  width: 50px
                                text: = (Number.parseFloat(items[props.importEnergy].state) +
                                  Number.parseFloat(items[props.directEnergyConsumption].state)
                                  +
                                  Number.parseFloat(items[props.batteryDischargeEnergy].state)).toFixed(1)
                                  + " " +
                                  items[props.importEnergy].state.split(" ")[1]
                            - component: Label
                              config:
                                style:
                                  font-size: 12px
                                  font-weight: bold
                                  left: 260px
                                  position: absolute
                                  top: 80px
                                  width: 60px
                                text: "=Number.parseFloat(items[props.exportPower].state) > 0 ?
                                  items[props.exportPower].state : '0 W'"
                            - component: Label
                              config:
                                style:
                                  font-size: 12px
                                  font-weight: bold
                                  left: 260px
                                  position: absolute
                                  top: 95px
                                  width: 60px
                                text: =items[props.exportEnergy].state
                            - component: Label
                              config:
                                style:
                                  font-size: 12px
                                  font-weight: bold
                                  left: 180px
                                  position: absolute
                                  top: 225px
                                  width: 60px
                                text: "=Number.parseFloat(items[props.exportPower].state) < 0 ?
                                  Math.abs(Number.parseFloat(items[props.export\
                                  Power].state)) + ' W' : '0 W'"
                            - component: Label
                              config:
                                style:
                                  font-size: 12px
                                  font-weight: bold
                                  left: 180px
                                  position: absolute
                                  top: 240px
                                  width: 60px
                                text: =items[props.importEnergy].state
                            - component: Label
                              config:
                                style:
                                  font-size: 12px
                                  font-weight: bold
                                  left: 20px
                                  position: absolute
                                  top: 80px
                                  width: 60px
                                text: "=Number.parseFloat(items[props.loadPower].state) <
                                  Number.parseFloat(items[props.solarPower].sta\
                                  te) ? items[props.batteryPower].state : '0 W'"
                            - component: Label
                              config:
                                style:
                                  font-size: 12px
                                  font-weight: bold
                                  left: 20px
                                  position: absolute
                                  top: 95px
                                  width: 60px
                                text: =items[props.batteryChargeEnergy].state
                            - component: Label
                              config:
                                style:
                                  font-size: 12px
                                  font-weight: bold
                                  left: 40px
                                  position: absolute
                                  top: 225px
                                  width: 60px
                                text: "=Number.parseFloat(items[props.loadPower].state) >
                                  Number.parseFloat(items[props.solarPower].sta\
                                  te) ? items[props.batteryPower].state : '0 W'"
                            - component: Label
                              config:
                                style:
                                  font-size: 12px
                                  font-weight: bold
                                  left: 40px
                                  position: absolute
                                  top: 240px
                                  width: 60px
                                text: =items[props.batteryDischargeEnergy].state
                            - component: Label
                              config:
                                comment: Battery level
                                style:
                                  font-size: 12px
                                  font-weight: bold
                                  left: -10px
                                  position: absolute
                                  top: 280px
                                  width: 60px
                                text: =items[props.batteryLevel].state
                            - component: Label
                              config:
                                comment: Battery to grid
                                style:
                                  font-size: 12px
                                  font-weight: bold
                                  left: 120px
                                  position: absolute
                                  top: 290px
                                  width: 50px
                                text: "=Number.parseFloat(items[props.batteryPower].state) <= 0 ||
                                  Number.parseFloat(items[props.loadPower].stat\
                                  e) <
                                  Number.parseFloat(items[props.solarPower].sta\
                                  te) ||
                                  Number.parseFloat(items[props.batteryPower].s\
                                  tate) <=
                                  Number.parseFloat(items[props.loadPower].stat\
                                  e) ? '0 W' :
                                  (Number.parseFloat(items[props.batteryPower].\
                                  state) -
                                  Number.parseFloat(items[props.loadPower].stat\
                                  e)).toFixed(1) + ' W'"

This is a z-index issue. It is not that the link doesn’t work when the widget is on a page, it’s that you can’t click on the link because other things are in the way.

The reason for the difference between the widget editor and page behavior is that you have embedded your svg lines in f7-blocks. Part of the css for the widget editor page itself includes a directive that modifies the z-index of all f7-blocks and this spills into the preview pane. This directive is not present when viewing the widget on a page, so there is sometimes a difference in behavior in the case of complex widgets that rely on many f7-block components.

The most robust solution to the problem would be to rework the entire widget to 1) build the svgs directly as svg components instead of embedding them in the blocks and 2) restrict those svgs only to the regions of the card where they should be displayed.

But, that’s a lot of work. The quick solution is just to add a higher z-index (I suspect something simple, such as 5, would do) to the style of the block that has your link in it.

@JustinG thanks for the reply. I’ll probably rebuild the widget in winter as far as svg handling is concerned.

Until then, the tip about z-index has solved my problem.

- component: f7-block
	config:
		style:
			align-items: center
			display: flex
			flex-direction: column
			height: 390px
			justify-content: center
			position: absolute
			width: 300px
			z-index: 4
	slots:
		default:
			- component: oh-link
				config:
					actionPropsParameterGroup: loadAction
				slots:
					default:
						- component: oh-icon
							config:
								height: 85px
								icon: oh:sma-energy:house
								style:
									margin-bottom: 10px