thomasloven / hass-browser_mod

🔹 A Home Assistant integration to turn your browser into a controllable entity and media player
MIT License
1.34k stars 186 forks source link

Action in popup sended in infinite loop #517

Closed PolestarWx closed 1 year ago

PolestarWx commented 1 year ago

The problem

Description of the problem

I created a scene that use a WLED entity, but if I use scene.turn_on in a browser mod popup, I cannot turn_off the light, it turn off but turn_on again one second after, it seems like the action of turning on the scene is contently activated once clicked. The only option is to clear cache of browser. Other control are ok but the device seems to go unavailable more often once the scene is activated (seems to be flood my too many request). It does the same things with wled preset.

Lovelace card with browser_mod popup

type: custom:mushroom-light-card
entity: light.wled_1
name: Treillis
fill_container: true
use_light_color: true
show_brightness_control: true
show_color_control: true
show_color_temp_control: true
collapsible_controls: true
tap_action:
  action: toggle
layout: default
secondary_info: state
hold_action:
  action: fire-dom-event
  browser_mod:
    service: browser_mod.popup
    data:
      title: Wled
      content:
        type: grid
        square: false
        columns: 1
        cards:
          - type: grid
            square: false
            columns: 4
            cards:
              - type: tile
                entity: scene.treillis_sunrise
                card_mod:
                  style: |
                    ha-card > .tile > .info { display: none }
                    ha-card > .tile { justify-content: center }
                icon_tap_action:
                  action: call-service
                  service: scene.turn_on
                  service_data:
                    entity_id: scene.treillis_sunrise
              - type: tile
                entity: scene.treillis_sunrise
                card_mod:
                  style: |
                    ha-card > .tile > .info { display: none }
                    ha-card > .tile { justify-content: center }
                icon_tap_action:
                  action: call-service
                  service: scene.turn_on
                  service_data:
                    entity_id: scene.treillis_sunrise
              - type: tile
                entity: scene.treillis_sunrise
                card_mod:
                  style: |
                    ha-card > .tile > .info { display: none }
                    ha-card > .tile { justify-content: center }
                icon_tap_action:
                  action: call-service
                  service: scene.turn_on
                  service_data:
                    entity_id: scene.treillis_sunrise
              - type: tile
                entity: scene.treillis_sunrise
                card_mod:
                  style: |
                    ha-card > .tile > .info { display: none }
                    ha-card > .tile { justify-content: center }
                icon_tap_action:
                  action: call-service
                  service: scene.turn_on
                  service_data:
                    entity_id: scene.treillis_sunrise
          - type: custom:light-entity-card
            entity: light.wled_1
            hide_header: true
            child_card: true
            persist_features: true
            brightness: false
            color_picker: false
          - type: entities
            entities:
              - entity: select.wled_1_color_palette
                name: Color palette
              - entity: number.wled_1_intensity
                name: Intensity
              - entity: number.wled_1_speed
                name: Speed
              - entity: switch.wled_1_reverse
                name: Reverse
              - entity: sensor.wled_1_max_current
              - entity: sensor.wled_1_estimated_current

Screenshot of the problem

image

Scene.yaml

  name: Treillis_Sunrise
  entities:
    light.wled_1:
      effect_list:
      - Android
      - Aurora
      - Blends
      - Blink
      - Blink Rainbow
      - Bouncing Balls
      - Bpm
      - Breathe
      - Candle
      - Candle Multi
      - Candy Cane
      - Chase
      - Chase 2
      - Chase 3
      - Chase Flash
      - Chase Flash Rnd
      - Chase Rainbow
      - Chase Random
      - Chunchun
      - Colorful
      - Colorloop
      - Colortwinkles
      - Colorwaves
      - Dancing Shadows
      - Dissolve
      - Dissolve Rnd
      - Drip
      - Dynamic
      - Dynamic Smooth
      - Fade
      - Fairy
      - Fairytwinkle
      - Fill Noise
      - Fire 2012
      - Fire Flicker
      - Fireworks
      - Fireworks 1D
      - Fireworks Starburst
      - Flow
      - Glitter
      - Gradient
      - Halloween
      - Halloween Eyes
      - Heartbeat
      - ICU
      - Juggle
      - Lake
      - Lighthouse
      - Lightning
      - Loading
      - Meteor
      - Meteor Smooth
      - Multi Comet
      - Noise 1
      - Noise 2
      - Noise 3
      - Noise 4
      - Noise Pal
      - Oscillate
      - Pacifica
      - Palette
      - Percent
      - Phased
      - Phased Noise
      - Plasma
      - Police
      - Popcorn
      - Pride 2015
      - Railway
      - Rain
      - Rainbow
      - Rainbow Runner
      - Random Colors
      - Ripple
      - Ripple Rainbow
      - Running
      - Running Dual
      - Saw
      - Scan
      - Scan Dual
      - Scanner
      - Scanner Dual
      - Sine
      - Sinelon
      - Sinelon Dual
      - Sinelon Rainbow
      - Solid
      - Solid Glitter
      - Solid Pattern
      - Solid Pattern Tri
      - Sparkle
      - Sparkle Dark
      - Sparkle+
      - Spots
      - Spots Fade
      - Stream
      - Stream 2
      - Strobe
      - Strobe Mega
      - Strobe Rainbow
      - Sunrise
      - Sweep
      - Sweep Random
      - TV Simulator
      - Tetrix
      - Theater
      - Theater Rainbow
      - Traffic Light
      - Tri Fade
      - Tri Wipe
      - Twinkle
      - Twinklecat
      - Twinklefox
      - Twinkleup
      - Two Dots
      - Washing Machine
      - Wipe
      - Wipe Random
      supported_color_modes:
      - rgb
      icon: mdi:led-strip-variant
      friendly_name: wled
      supported_features: 36
      color_mode: rgb
      brightness: 145
      hs_color:
      - 37.647
      - 100
      rgb_color:
      - 255
      - 160
      - 0
      xy_color:
      - 0.569
      - 0.411
      effect: Aurora
      state: 'on'
    select.wled_1_color_palette:
      options:
      - '* Color 1'
      - '* Color Gradient'
      - '* Colors 1&2'
      - '* Colors Only'
      - '* Random Cycle'
      - Analogous
      - April Night
      - Aqua Flash
      - Atlantica
      - Aurora
      - Aurora 2
      - Autumn
      - Beach
      - Beech
      - Blink Red
      - Breeze
      - C9
      - C9 2
      - C9 New
      - Candy
      - Candy2
      - Cloud
      - Cyane
      - Default
      - Departure
      - Drywet
      - Fairy Reaf
      - Fire
      - Forest
      - Grintage
      - Hult
      - Hult 64
      - Icefire
      - Jul
      - Landscape
      - Lava
      - Light Pink
      - Lite Light
      - Magenta
      - Magred
      - Ocean
      - Orange & Teal
      - Orangery
      - Party
      - Pastel
      - Pink Candy
      - Rainbow
      - Rainbow Bands
      - Red & Blue
      - Red Flash
      - Red Reaf
      - Red Shift
      - Red Tide
      - Retro Clown
      - Rewhi
      - Rivendell
      - Sakura
      - Semi Blue
      - Sherbet
      - Splash
      - Sunset
      - Sunset 2
      - Temperature
      - Tertiary
      - Tiamat
      - Toxy Reaf
      - Vintage
      - Yelblu
      - Yelblu Hot
      - Yellowout
      - Yelmag
      icon: mdi:palette-outline
      friendly_name: Color palette
      state: Orange & Teal
    number.wled_1_speed:
      min: 0
      max: 255
      step: 1
      mode: auto
      icon: mdi:speedometer
      friendly_name: Speed
      state: '97'
  icon: mdi:weather-sunny
  metadata:
    light.wled_1:
      entity_only: true
    select.wled_1_color_palette:
      entity_only: true
    number.wled_1_speed:
      entity_only: true

What version of Home Assistant Core has the issue?

2023.1.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Wled

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

PolestarWx commented 1 year ago

This is the debug log of wled integration, after clicking on the lovelace tile

2023-01-20 16:51:41.869 INFO (MainThread) [homeassistant.components.wled] Fetching wled data recovered
2023-01-20 16:51:41.869 DEBUG (MainThread) [homeassistant.components.wled] Finished fetching wled data in 1.808 seconds (success: True)
2023-01-20 16:51:43.306 DEBUG (MainThread) [homeassistant.components.wled] Manually updated wled data
2023-01-20 16:51:44.686 INFO (MainThread) [homeassistant.components.wled] Connection to the WLED WebSocket on 192.168.3.220 has been closed
2023-01-20 16:51:54.630 INFO (MainThread) [homeassistant.components.wled] Fetching wled data recovered
2023-01-20 16:51:54.631 DEBUG (MainThread) [homeassistant.components.wled] Finished fetching wled data in 1.570 seconds (success: True)
2023-01-20 16:51:56.069 INFO (MainThread) [homeassistant.components.wled] Connection to the WLED WebSocket on 192.168.3.220 has been closed
2023-01-20 16:52:05.884 INFO (MainThread) [homeassistant.components.wled] Fetching wled data recovered
2023-01-20 16:52:05.885 DEBUG (MainThread) [homeassistant.components.wled] Finished fetching wled data in 1.824 seconds (success: True)
2023-01-20 16:52:07.096 INFO (MainThread) [homeassistant.components.wled] Connection to the WLED WebSocket on 192.168.3.220 has been closed
2023-01-20 16:53:15.496 DEBUG (MainThread) [homeassistant.components.wled] Finished fetching wled data in 1.436 seconds (success: True)
2023-01-20 16:53:22.203 DEBUG (MainThread) [homeassistant.components.wled] Manually updated wled data
2023-01-20 16:53:24.213 DEBUG (MainThread) [homeassistant.components.wled] Manually updated wled data
2023-01-20 16:53:26.242 DEBUG (MainThread) [homeassistant.components.wled] Manually updated wled data
2023-01-20 16:53:28.985 DEBUG (MainThread) [homeassistant.components.wled] Manually updated wled data
2023-01-20 16:53:30.989 DEBUG (MainThread) [homeassistant.components.wled] Manually updated wled data
2023-01-20 16:53:32.998 DEBUG (MainThread) [homeassistant.components.wled] Manually updated wled data
2023-01-20 16:53:35.066 INFO (MainThread) [homeassistant.components.wled] Connection to the WLED WebSocket on 192.168.3.220 has been closed
2023-01-20 16:53:43.300 INFO (MainThread) [homeassistant.components.wled] Fetching wled data recovered
2023-01-20 16:53:43.300 DEBUG (MainThread) [homeassistant.components.wled] Finished fetching wled data in 1.239 seconds (success: True)
2023-01-20 16:53:43.885 DEBUG (MainThread) [homeassistant.components.wled] Manually updated wled data
2023-01-20 16:53:44.524 DEBUG (MainThread) [homeassistant.components.wled] Manually updated wled data
2023-01-20 16:53:46.527 DEBUG (MainThread) [homeassistant.components.wled] Manually updated wled data
2023-01-20 16:53:48.538 DEBUG (MainThread) [homeassistant.components.wled] Manually updated wled data
2023-01-20 16:53:58.719 DEBUG (MainThread) [homeassistant.components.wled] Finished fetching wled data in 0.658 seconds (success: True)
PolestarWx commented 1 year ago

Found the culprit, the infinite requests was because of custom:light-entity-card in the browser mod popup