thomasloven / lovelace-state-switch

🔹Dynamically replace lovelace cards depending on occasion
MIT License
382 stars 27 forks source link

Card width too big in version 3 #14

Closed VDRainer closed 4 years ago

VDRainer commented 4 years ago

After updating to version 3, the width of a state-switched card ( https://github.com/gurbyz/power-wheel-card ) is too big. 20191212_11:01:39_001 Back on version 2, all is OK. 20191212_11:00:18_001

          - type: custom:state-switch
            entity: sensor.e3dc_pv_batt_power_stat
            states:

              batt:
                type: "custom:power-wheel-card"
                title: Leistungsverteilung
                solar_power_entity: sensor.e3dc_battery_power_neg2pos
                grid_power_production_entity: sensor.e3dc_net_power_neg2pos_only
                grid_power_consumption_entity: sensor.e3dc_net_power_pos_only
                home_icon: mdi:home-outline
                solar_icon: mdi:car-battery
                grid_icon: mdi:transmission-tower
                color_icons: true
                consuming_color: var(--my-green)
                producing_color: var(--my-yellow)

              sun:
                type: "custom:power-wheel-card"
                title: Leistungsverteilung
                solar_power_entity: sensor.e3dc_pv_total
                grid_power_production_entity: sensor.e3dc_net_power_neg2pos_only
                grid_power_consumption_entity: sensor.e3dc_net_power_pos_only
                home_icon: mdi:home-outline
                solar_icon: mdi:white-balance-sunny
                grid_icon: mdi:transmission-tower
                color_icons: true
                consuming_color: var(--my-green)
                producing_color: var(--my-yellow)

              sun_batt:
                type: "custom:power-wheel-card"
                title: Leistungsverteilung
                solar_power_entity: sensor.e3dc_pv_batt_power
                grid_power_production_entity: sensor.e3dc_net_power_neg2pos_only
                grid_power_consumption_entity: sensor.e3dc_net_power_pos_only
                home_icon: mdi:home-outline
                solar_icon: mdi:solar-power
                grid_icon: mdi:transmission-tower
                color_icons: true
                consuming_color: var(--my-green)
                producing_color: var(--my-yellow)
kloggy commented 4 years ago

I can confirm that with v3 I also seem to get an incorrectly sized card. In my case I also get a horizontal scroll bar.

The state-switch card causing this is at the bottom of vertical-stack which has some buttons in a horizontal stack above it and another vertical stack next to it.

image

      - type: custom:state-switch
        entity: sensor.current_light_level_sensor
        states:
          Brightness:
            type: entities
            entities: 
              - input_number.sitting_room_brightness_sensor_threshold
              - input_datetime.sitting_room_lights_not_on_before_time
              - entity: input_number.sitting_room_motion_timer_overrun
                name: Motion Timer Overrun
              - entity: input_number.sitting_room_motion_timer_tv_extension
                name: Motion Timer TV Extension
              - input_datetime.sitting_room_lights_normal_off_time
              - binary_sensor.dark_sitting_room
              - timer.sitting_room_motion
              - binary_sensor.sitting_room_lights_normally_on
              - entity: sensor.sitting_room_black_vase_light
                name: Black Vase Light (Sonoff03)
                icon: mdi:wifi
              - entity: sensor.sitting_room_chinese_vase_light
                name: Chinese Vase Light (Sonoff04)
                icon: mdi:wifi
          SmartWeather:
            type: entities
            entities:
              - input_number.sitting_room_smartweather_average_illuminance_sensor_threshold
              - input_datetime.sitting_room_lights_not_on_before_time
              - entity: input_number.sitting_room_motion_timer_overrun
                name: Motion Timer Overrun
              - entity: input_number.sitting_room_motion_timer_tv_extension
                name: Motion Timer TV Extension
              - input_datetime.sitting_room_lights_normal_off_time
              - binary_sensor.dark_sitting_room
              - timer.sitting_room_motion
              - binary_sensor.sitting_room_lights_normally_on
              - entity: sensor.sitting_room_black_vase_light
                name: Black Vase Light (Sonoff03)
                icon: mdi:wifi
              - entity: sensor.sitting_room_chinese_vase_light
                name: Chinese Vase Light (Sonoff04)
                icon: mdi:wifi