artem-sedykh / mini-climate-card

Minimalistic climate card for Home Assistant Lovelace UI
MIT License
281 stars 19 forks source link

[feature-request] add `fire-dom-event` to `tap_actions:` #101

Closed e2m32 closed 1 year ago

e2m32 commented 1 year ago

broser_mod uses fire-dom-event actions for popups. This action is built in HA frontend, but is not included in mini-climate-card.

Explanation: https://github.com/thomasloven/hass-browser_mod/releases/tag/1.3.0

HA Core Code: https://github.com/home-assistant/frontend/blob/8d13745c6b822a76f6724e32c2b10bf57ae645e7/src/panels/lovelace/common/handle-action.ts#L137

Button Card Feature Request: https://github.com/custom-cards/button-card/issues/429

Example yaml (currently doesn't work):

type: custom:mini-climate
entity: climate.test
tap_action:
  action: fire-dom-event
  browser_mod:
    service: browser_mod.more_info
    data:
      entity: climate.test

thread of trying to figure out the issue that I am having: https://github.com/thomasloven/hass-browser_mod/issues/413#issuecomment-1281272831


I tried adding the fire-dom-event to the .js file as a case:, but I don't know what I'm doing and it didn't work 😆

regevbr commented 1 year ago

v2.4.0 released please let me know if that works for you

e2m32 commented 1 year ago

That was fast. Thank you @regevbr

I just tested, but it is not working. I tried setting

logger: 
  default: debug

but I don't see anything in the log that relates to lovelace failing...

These are the lovelace entries that I am testing:

  # lovelace view:
  - theme: Backend-selected
    title: test_bm_popup-cards
    path: test-bm-popup-cards
    badges: []
    cards:
      # this is a browser_mod popup card. it is hidden when not in lovelace's edit mode
      - type: custom:popup-card
        entity: sun.sun
        title: Custom popup
        dismissable: true
        card:
          type: markdown
          content: This replaces the more-info dialog
     # when this card is clicked, the above popup card opens. this is basic `browser_mod` more-info override
      - type: entity
        entity: sun.sun

     # this is the browser_mod popup card I am testing with mini-climate card
      - type: custom:popup-card
        entity: climate.test
        title: Climate Test Custom popup
        dismissable: true
        card:
          type: markdown
          content: This replaces the more-info dialog. climate.test
     # mini-climate: test call-service. This was working before 2.4.0, but now is not working... 
     # the problem with this implementation is that it opens the popup in every browser_mod 
     # registered browser at the same time.
      - type: custom:mini-climate
        entity: climate.test
        name: test call-service
        tap_action:
          action: call-service
          service: browser_mod.more_info
          service_data:
            entity: climate.test

     # mini-climate: test fire-dom-event more-info. 
     # doesn't work in 2.3.1 or 2.4.0
      - type: thermostat
        entity: climate.test
      - type: custom:mini-climate
        entity: climate.test
        name: test fire-dom-event:more-info
        tap_action:
          action: fire-dom-event
          browser_mod:
            service: browser_mod.more_info
            data:
              entity: climate.test

     # mini-climate test fire-dom-event popup
     # doesn't work in 2.3.1 or 2.4.0
      - type: custom:mini-climate
        entity: climate.test
        name: test fire-dom-event:popup
        tap_action:
          action: fire-dom-event
          browser_mod:
            service: browser_mod.popup
            data:
              title: fde-popup
              content: test
regevbr commented 1 year ago

There is a bug, fix is on the way :-)

regevbr commented 1 year ago

fixed in 2.4.1

e2m32 commented 1 year ago

Just updated and tested... still not working. 😞 I am using the same tests as stated above.

This one is working again though (was working in 2.3.1):

     # mini-climate: test call-service. This was working before 2.4.0, but now is not working... 
     # the problem with this implementation is that it opens the popup in every browser_mod 
     # registered browser at the same time.
      - type: custom:mini-climate
        entity: climate.test
        name: test call-service
        tap_action:
          action: call-service
          service: browser_mod.more_info
          service_data:
            entity: climate.test
regevbr commented 1 year ago

for me it works with your setting exactly.... Are you sure you migrated to browser mod 2 properly - they have detailed instructions on how to do that

regevbr commented 1 year ago

Peek 2022-10-19 09-30

e2m32 commented 1 year ago

Thank you @regevbr. I just tested it this morning and it's working. Maybe I didn't fully clear my browser cache after upgrading. I'm not sure. Thank you so much!!