Advertisement
tiwing

Weather Panel Code

Feb 6th, 2025
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 15.65 KB | None | 0 0
  1. type: vertical-stack
  2. cards:
  3.   - type: custom:decluttering-card
  4.     template: normal_title
  5.     variables:
  6.       - content: Weather
  7.       - sub-content: null
  8.   - square: false
  9.     type: grid
  10.     cards:
  11.       - type: picture-elements
  12.         image: /local/dashboard_photos/transparent/~transparent-1-1.png
  13.         card_mod:
  14.           style: |
  15.            ha-card {
  16.                   background:
  17.                   /* top, transparent red, faked with gradient */
  18.                   linear-gradient(
  19.                     rgba(0, 0, 0, 0),
  20.                     rgba(0, 0, 0, 0)
  21.                   ),
  22.                   /* bottom, image */
  23.                   url("/local/dashboard_photos/temperature_humidity.jpg");
  24.                   background-size: cover;
  25.                   #background-size: contain;
  26.                   #background-size: auto;
  27.                   #background-size: auto auto;
  28.                   background-repeat: no-repeat;
  29.                   background-position: center left;
  30.                 }
  31.         elements:
  32.           - type: image
  33.             tap_action: none
  34.             double_tap_action: none
  35.             hold_action: none
  36.             image: /local/dashboard_photos/wind_turbine_2.jpg
  37.             style:
  38.               transform: none
  39.               transform-origin: top right
  40.               top: 2%
  41.               right: 2%
  42.               width: 35%
  43.             card_mod:
  44.               style: |
  45.                :host {
  46.                   opacity: 0.8;
  47.                   border-radius: 8px;
  48.                   {% if is_state('binary_sensor.porch1_porch_zone_person_occupancy','on') %}
  49.                     border: 2px dashed red;
  50.                   {% elif is_state('binary_sensor.porch_mot_sticky','on') %}
  51.                     border: 2px solid red;
  52.                   {% else %}
  53.                     border: 2px solid grey;
  54.                   {% endif %}
  55.                 }
  56.           - type: state-label
  57.             style:
  58.               transform: none
  59.               transform-origin: top left
  60.               left: 63%
  61.               top: 1%
  62.               font-size: 90%
  63.             card_mod:
  64.               style: |
  65.                :host {
  66.                       {% set lev = states('sensor.astroweather_backyard_10m_wind_speed')|float(0) %}
  67.                       {% if lev > 50  %}
  68.                         color: red;
  69.                         top: 1%;
  70.                       {% elif lev > 30 %}
  71.                         color: rgb(255,165,0);
  72.                         top: 1%;
  73.                       {% elif lev < 1  %}
  74.                         opacity: 0;
  75.                         top: 999%;
  76.                       {% else %}
  77.                         color: silver;
  78.                         top: 1%;
  79.                       {% endif %}
  80.                 }
  81.             entity: sensor.astroweather_backyard_10m_wind_speed
  82.             prefix: "Speed: "
  83.           - type: state-label
  84.             style:
  85.               transform: none
  86.               transform-origin: top left
  87.               left: 63%
  88.               font-size: 90%
  89.             card_mod:
  90.               style: |
  91.                :host {
  92.                       {% set lev = states('sensor.lincoln_wind_gust')|float(0) %}
  93.                       {% if lev <= states('sensor.astroweather_backyard_10m_wind_speed')|float(0) %}
  94.                         opacity: 0;
  95.                         top: 999%;
  96.                       {% elif lev > 65  %}
  97.                         color: red;
  98.                         top: 6%;
  99.                       {% elif lev > 40 %}
  100.                         color: rgb(255,165,0);
  101.                         top: 6%;
  102.                       {% elif lev < 1 %}
  103.                         opacity: 0;
  104.                         top: 999%;
  105.                       {% else %}
  106.                         color: silver;
  107.                         top: 6%;
  108.                       {% endif %}
  109.                 }
  110.             entity: sensor.lincoln_wind_gust
  111.             prefix: "Gust: "
  112.           - type: conditional
  113.             conditions:
  114.               - condition: numeric_state
  115.                 entity: sensor.astroweather_backyard_10m_wind_speed
  116.                 above: 0
  117.             title: wind direction
  118.             elements:
  119.               - type: state-label
  120.                 style:
  121.                   left: 80%
  122.                   top: 20%
  123.                   font-size: 170%
  124.                   font-weight: 700
  125.                   color: white
  126.                 entity: sensor.astroweather_backyard_10m_wind_direction
  127.           - type: state-label
  128.             style:
  129.               transform: none
  130.               left: 63%
  131.               font-size: 90%
  132.             card_mod:
  133.               style: |
  134.                :host {
  135.                       {% set lev = states('sensor.lincoln_chance_of_precip')|float(0) %}
  136.                       {% if lev > 70  %}
  137.                         color: silver;
  138.                         top: 25%;
  139.                       {% elif lev > 90 %}
  140.                         color: orange;
  141.                         top: 25%;
  142.                       {% elif lev < 1  %}
  143.                         opacity: 0;
  144.                         top: 999%;
  145.                       {% else %}
  146.                         color: silver;
  147.                         top: 25%;
  148.                       {% endif %}
  149.                 }
  150.             entity: sensor.lincoln_chance_of_precip
  151.             prefix: "POP: "
  152.           - type: state-label
  153.             style:
  154.               transform: none
  155.               transform-origin: top left
  156.               left: 63%
  157.               top: 30%
  158.               font-size: 90%
  159.             card_mod:
  160.               style: |
  161.                :host {
  162.                       {% set lev = states('sensor.outdoor_front_pressure')|float(0) %}
  163.                       {% if lev > 1010  %}
  164.                         color: lightgreen;
  165.                       {% elif lev < 990 %}
  166.                         color: salmon;
  167.                       {% else %}
  168.                         color: silver;
  169.                       {% endif %}
  170.                   }
  171.             entity: sensor.outdoor_front_pressure
  172.             prefix: "Pressure: "
  173.           - type: state-label
  174.             style:
  175.               transform: none
  176.               transform-origin: top right
  177.               right: 41%
  178.               top: 1%
  179.               font-size: 120%
  180.             prefix: "Temp: "
  181.             card_mod:
  182.               style: |
  183.                 :host {
  184.                     {% set lev = states('sensor.outdoor_front_temp')|float(0) %}
  185.                     {% if lev < -7 %}
  186.                       color: lightblue;
  187.                       text-shadow: 1px 1px 4px blue;
  188.                       font-weight: 700;
  189.                     {% elif lev > 27 %}
  190.                       color: crimson;
  191.                       text-shadow: 1px 1px 4px salmon;
  192.                       font-weight: 700;
  193.                     {% else %}
  194.                       color: white;
  195.                     {% endif %}
  196.                 }
  197.             entity: sensor.outdoor_temp
  198.           - type: state-label
  199.             prefix: "Humidity: "
  200.             style:
  201.               transform: none
  202.               transform-origin: top right
  203.               right: 41%
  204.               top: 10%
  205.               font-size: 120%
  206.               color: white
  207.             entity: sensor.outdoor_humidity
  208.           - type: state-label
  209.             style:
  210.               transform: none
  211.               right: 41%
  212.               top: 19%
  213.               font-size: 120%
  214.             card_mod:
  215.               style: |
  216.                :host {
  217.                     {% set lev = states('sensor.calc_feels_like')|float(0) %}
  218.                     {% if lev < -7 %}
  219.                       color: lightblue;
  220.                       text-shadow: 1px 1px 4px blue;
  221.                       font-weight: 700;
  222.                      
  223.                     {% elif lev > 27 %}
  224.                       color: crimson;
  225.                       text-shadow: 1px 1px 4px salmon;
  226.                       font-weight: 700;
  227.                       top: 50%;
  228.                     {% else %}
  229.                       color: white;
  230.                     {% endif %}
  231.                 }
  232.             entity: sensor.calc_feels_like
  233.             prefix: "Feels: "
  234.           - type: state-label
  235.             style:
  236.               transform: none
  237.               right: 41%
  238.               top: 28%
  239.               font-size: 120%
  240.             entity: sensor.openweathermap_uv_index
  241.             card_mod:
  242.               style: |
  243.                :host {
  244.                     {% set lev = states('sensor.openweathermap_uv_index')|float(0) %}
  245.                     {% if lev > 8 %}
  246.                       color: red;
  247.                       text-shadow: 1px 1px 4px crimson;
  248.                       font-weight: 700;
  249.                      
  250.                     {% elif lev > 6 %}
  251.                       color: orange;
  252.                       text-shadow: 1px 1px 4px salmon;
  253.                       font-weight: 700;
  254.                       top: 50%;
  255.                     {% else %}
  256.                       color: silver;
  257.                     {% endif %}
  258.                 }
  259.           - type: custom:mini-graph-card
  260.             style:
  261.               transform: none
  262.               transform-origin: bottom right
  263.               bottom: 32%
  264.               right: 2%
  265.               width: 100%
  266.               scale: 1.3
  267.             entities:
  268.              - sensor.outdoor_temp
  269.             graph: line
  270.             hour24: false
  271.             hours_to_show: 24
  272.             points_per_hour: 6
  273.             decimals: 1
  274.             name: Raw Temp
  275.             show:
  276.               extrema: false
  277.               icon: false
  278.               name: false
  279.               legend: false
  280.               labels: false
  281.               state: false
  282.             color_thresholds:
  283.               - value: -20
  284.                 color: "#08306b"
  285.               - value: -16
  286.                 color: "#08519c"
  287.               - value: -12
  288.                 color: "#2171b5"
  289.               - value: -10
  290.                 color: "#4292c6"
  291.               - value: -8
  292.                 color: "#6baed6"
  293.               - value: -6
  294.                 color: "#9ecae1"
  295.               - value: -4
  296.                 color: "#c6dbef"
  297.               - value: -2
  298.                 color: "#deebf7"
  299.               - value: 0
  300.                 color: "#ffffff"
  301.               - value: 2
  302.                 color: "#ffffff"
  303.               - value: 4
  304.                 color: "#fee0d2"
  305.               - value: 6
  306.                 color: "#fcbba1"
  307.               - value: 9
  308.                 color: "#fc9272"
  309.               - value: 12
  310.                 color: "#fb6a4a"
  311.               - value: 15
  312.                 color: "#ef3b2c"
  313.               - value: 18
  314.                 color: "#cb181d"
  315.               - value: 22
  316.                 color: "#a50f15"
  317.               - value: 26
  318.                 color: "#8a0113"
  319.               - value: 30
  320.                 color: "#bf021b"
  321.             card_mod:
  322.               style: |
  323.                ha-card {
  324.                   font-size: 90% !important;
  325.                   padding-top: 30px !important;
  326.                   background: rgba(0,0,0,0) !important;
  327.                 }
  328.                 :host {
  329.                   width: 40% !important;
  330.                   border: 1px solid grey;
  331.                   border-radius: 8px;
  332.                 }
  333.           - type: state-label
  334.             style:
  335.               transform: none
  336.               left: 45%
  337.               bottom: 50%
  338.               font-size: 90%
  339.               color: white
  340.             entity: sensor.dummy_blank_sensor
  341.             prefix: Temp (24h)
  342.           - type: state-label
  343.             style:
  344.               transform: none
  345.               transform-origin: bottom left
  346.               left: 45%
  347.               bottom: 45%
  348.               font-size: 80%
  349.               color: white
  350.             entity: sensor.min_outdoor_temp_24
  351.             prefix: "Min: "
  352.           - type: state-label
  353.             style:
  354.               transform: none
  355.               left: 45%
  356.               bottom: 41%
  357.               font-size: 80%
  358.               color: white
  359.             entity: sensor.min_outdoor_temp_24_tm
  360.           - type: state-label
  361.             style:
  362.               transform: none
  363.               transform-origin: bottom right
  364.               right: 2%
  365.               bottom: 45%
  366.               font-size: 80%
  367.               color: white
  368.             entity: sensor.max_outdoor_temp_24
  369.             prefix: "Max: "
  370.           - type: state-label
  371.             style:
  372.               transform: none
  373.               right: 2%
  374.               bottom: 41%
  375.               font-size: 80%
  376.               color: white
  377.             entity: sensor.max_outdoor_temp_24_tm
  378.           - type: custom:mini-graph-card
  379.             style:
  380.               transform: none
  381.               transform-origin: bottom right
  382.               bottom: 2%
  383.               right: 2%
  384.               width: 100%
  385.               scale: 1.3
  386.             entities:
  387.              - sensor.outdoor_humidity
  388.             graph: line
  389.             hour24: false
  390.             hours_to_show: 24
  391.             points_per_hour: 6
  392.             decimals: 1
  393.             name: Humidity
  394.             show:
  395.               extrema: false
  396.               icon: false
  397.               name: false
  398.               legend: false
  399.               labels: false
  400.               state: false
  401.             color_thresholds:
  402.               - value: 0
  403.                 color: rgb(240,0,0)
  404.               - value: 12
  405.                 color: rgb(200,66,13)
  406.               - value: 22
  407.                 color: rgb(194,134,62)
  408.               - value: 32
  409.                 color: rgb(105,173,56)
  410.               - value: 42
  411.                 color: rgb(117,203,190)
  412.               - value: 52
  413.                 color: rgb(56,174,173)
  414.               - value: 62
  415.                 color: rgb(45,157,173)
  416.               - value: 72
  417.                 color: rgb(35,147,167)
  418.               - value: 82
  419.                 color: rgb(15,132,253)
  420.               - value: 92
  421.                 color: rgb(0,70,214)
  422.             card_mod:
  423.               style: |
  424.                ha-card {
  425.                   font-size: 90% !important;
  426.                   padding-top: 30px !important;
  427.                   background: rgba(0,0,0,0) !important;
  428.                 }
  429.                 :host {
  430.                   width: 40% !important;
  431.                   border: 1px solid grey;
  432.                   border-radius: 8px;
  433.                 }
  434.           - type: state-label
  435.             style:
  436.               transform: none
  437.               left: 45%
  438.               bottom: 20%
  439.               font-size: 90%
  440.               color: white
  441.             entity: sensor.dummy_blank_sensor
  442.             prefix: Humidity (24h)
  443.           - type: state-label
  444.             style:
  445.               transform: none
  446.               left: 45%
  447.               top: 77%
  448.               font-size: 80%
  449.               color: white
  450.             entity: sensor.min_outdoor_humidity_24
  451.             prefix: "Min: "
  452.           - type: state-label
  453.             style:
  454.               transform: none
  455.               left: 45%
  456.               top: 81%
  457.               font-size: 80%
  458.               color: white
  459.             entity: sensor.min_outdoor_humidity_24_tm
  460.           - type: state-label
  461.             style:
  462.               transform: none
  463.               transform-origin: top right
  464.               right: 2%
  465.               top: 77%
  466.               font-size: 80%
  467.               color: white
  468.             entity: sensor.max_outdoor_humidity_24
  469.             prefix: "Max: "
  470.           - type: state-label
  471.             style:
  472.               transform: none
  473.               right: 2%
  474.               top: 81%
  475.               font-size: 80%
  476.               color: white
  477.             entity: sensor.max_outdoor_humidity_24_tm
  478.     columns: 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement