mlamberts78 / weather-chart-card

Custom weather card with charts.
MIT License
311 stars 38 forks source link

Rename `visibility` custom entity configuration to `visibility_entity` #252

Open pawelma opened 1 month ago

pawelma commented 1 month ago

WHAT

Renames the visibility card option config variable to visibility_entity.

⚠️ It will introduce breaking change for people who were using visibility custom sensor. After this change it will have to be renamed to visibility_entity:warning:

WHY

So that it won't clash with visibility card configuration in home assistant. The clash were making card fail when any condition for native HA visibility were set.

HA visibility screen Card alternative entities before change Card alternative entities after change
image image image

Config yaml prior the change:

type: custom:weather-chart-card
entity: weather.house
show_main: false
show_temperature: false
show_current_condition: false
show_attributes: true
show_time: false
show_time_seconds: false
show_day: false
show_date: false
show_humidity: false
show_pressure: false
show_wind_direction: false
show_wind_speed: false
show_sun: false
show_feels_like: false
show_dew_point: false
show_wind_gust_speed: false
show_visibility: true
show_last_changed: false
use_12hour_format: false
icons_size: 25
animated_icons: false
icon_style: style1
autoscroll: false
forecast:
  precipitation_type: rainfall
  show_probability: false
  labels_font_size: "11"
  precip_bar_size: "100"
  style: style1
  show_wind_forecast: false
  condition_icons: false
  round_temp: false
  type: daily
  number_of_forecasts: "1"
  disable_animation: false
units:
  speed: ""
visibility:
  condition: screen
  media_query: "(min-width: 768px)"

Config yaml after the change:

type: custom:weather-chart-card
entity: weather.house
show_main: false
show_temperature: false
show_current_condition: false
show_attributes: true
show_time: false
show_time_seconds: false
show_day: false
show_date: false
show_humidity: false
show_pressure: false
show_wind_direction: false
show_wind_speed: false
show_sun: false
show_feels_like: false
show_dew_point: false
show_wind_gust_speed: false
show_visibility: true
show_last_changed: false
use_12hour_format: false
icons_size: 25
animated_icons: false
icon_style: style1
autoscroll: false
forecast:
  precipitation_type: rainfall
  show_probability: false
  labels_font_size: "11"
  precip_bar_size: "100"
  style: style1
  show_wind_forecast: false
  condition_icons: false
  round_temp: false
  type: daily
  number_of_forecasts: "1"
  disable_animation: false
units:
  speed: ""
visibility:
  - condition: screen
    media_query: "(min-width: 768px)"
visibility_entity: sensor.fan_speed

Card not rendered before change when visibility condition (not visibility card options) filled:

image

Card rendered after change:

image
folfy commented 1 week ago

I think ideally all "alternative sensor" attributes would be grouped into a dedicated dictionary, similar to the "forecast" entity, which would allow preserving a consist naming convention. This would be a bigger change and break all sensor attributes tho, so would be good to at least merge this PR, to fix both visibility condition and visibility entity attributes with HA 2024.6+