Advertisement
calas

Codice_Grezzo_Valvole

Dec 20th, 2021
1,254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 18.69 KB | None | 0 0
  1.  
  2. utility_meter:
  3.   meter_valvola_camera_da_letto_giornaliero:
  4.     source: sensor.stat_valvola_camera_da_letto
  5.     cycle: daily
  6.   meter_valvola_camera_da_letto_mesile:
  7.     source: sensor.stat_valvola_camera_da_letto
  8.     cycle: monthly
  9.   meter_valvola_camera_da_letto_annuale:
  10.     source: sensor.stat_valvola_camera_da_letto
  11.     cycle: yearly
  12.  
  13. sensor:
  14.   - platform: template
  15.     sensors:
  16.       netatmo_stato_away:
  17.         friendly_name: 'controllo modalita assente'
  18.         value_template: "{{ state_attr('climate.netatmo_casa','preset_mode') }}"
  19.  
  20.       netatmo_stato:
  21.         friendly_name: 'controllo stato'
  22.         value_template: "{{ state_attr('climate.netatmo_casa','temperature') }}"
  23.  
  24.       netatmo_temperatura_ambiente:
  25.         friendly_name: 'temperatura Ambiente'
  26.         unit_of_measurement: '°C'
  27.         value_template: "{{ state_attr('climate.netatmo_casa','current_temperature')}}"
  28.  
  29.       netatmo_mode:
  30.         friendly_name: 'Stato di funzionamento'
  31.         value_template: "{{ state_attr('climate.netatmo_casa','hvac_modes')}}"
  32.  
  33.       valvola_camera_da_letto:
  34.         friendly_name: 'valvola camera da letto hvac'
  35.         value_template: >
  36.          {% set valvola = state_attr('climate.netatmo_camera_da_letto', 'hvac_action') %}
  37.           {% if valvola == 'idle' %}
  38.             Spenta
  39.           {% elif valvola == 'heating' %}
  40.             Accesa
  41.           {% else %}
  42.             sconosciuto
  43.           {% endif %}
  44.  
  45.   - platform: history_stats # Camera da letto
  46.     name: Stat valvola Camera da letto
  47.     entity_id: sensor.valvola_camera_da_letto
  48.     state: 'Accesa'
  49.     type: time
  50.     start: "{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}"
  51.     end: "{{ now() }}"
  52.  
  53. script:
  54.   temperatura_up:
  55.     sequence:
  56.     - service: climate.set_temperature
  57.       data:
  58.         entity_id: climate.netatmo_camera_da_letto
  59.         temperature: "{{ state_attr('climate.netatmo_camera_da_letto', 'temperature') + 0.5 | float }}"
  60.   temperatura_down:
  61.     sequence:
  62.     - service: climate.set_temperature
  63.       data_template:
  64.         entity_id: "{{ climate_id }}"
  65.         temperature: "{{ state_attr('climate.netatmo_camera_da_letto', 'temperature') - value | float }}"
  66.  
  67.   preset_mode:
  68.     sequence:
  69.       - service: climate.set_preset_mode
  70.         data:
  71.           entity_id: "{{ climate_id }}"
  72.           preset_mode: "{{ preset_mode }}"
  73.  
  74.  
  75.  
  76.  
  77.  
  78. # CARD
  79.  
  80. - type: custom:stack-in-card
  81.   cards:
  82.     - type: custom:button-card
  83.       name: Camera da letto
  84.       entity: climate.netatmo_camera_da_letto
  85.       styles:
  86.         card:
  87.           - height: 200px
  88.         name:
  89.           - padding-left: 50px
  90.           - padding-bottom: 400px
  91.           - font-size: 24px
  92.           - font-weight: 500
  93.         custom_fields:
  94.           bg:
  95.             - position: absolute
  96.             - left: 1%
  97.             - top: 28%
  98.             - height: 110px
  99.             - width: 220px
  100.             - line-height: 165px
  101.             - border-radius: 4%
  102.             - background: orange
  103.             - display: |
  104.                [[[
  105.                   if (entity.attributes.hvac_action == 'heat')
  106.                     return "block";
  107.                   return "none";
  108.                 ]]]
  109.           cerchio:
  110.             - position: absolute
  111.             - left: 5%
  112.             - top: 13%
  113.             - height: 150px
  114.             - width: 150px
  115.             - font-size: 50px
  116.             - font-weight: bold
  117.             - line-height: 160px
  118.             - border-radius: 50%
  119.             - color: black
  120.             - background: white
  121.             - border: 3px solid
  122.             - border-color: gray
  123.           temperatura_impostata:
  124.             - position: absolute
  125.             - left: 14.5%
  126.             - top: 1%
  127.             - height: 65px
  128.             - width: 65px
  129.             - font-size: 25px
  130.             - font-weight: bold
  131.             - line-height: 60px
  132.             - border-radius: 50%
  133.             - border: 3px solid
  134.             - border-color: wite
  135.             - background-color: >
  136.                [[[
  137.                   if (states['climate.netatmo_camera_da_letto'].state == 'auto')
  138.                     return "#181818";
  139.                   return "orange";
  140.                 ]]]
  141.           turn_on:
  142.             - position: absolute
  143.             - left: 18%
  144.             - top: 68%
  145.             - display: |
  146.                [[[
  147.                   if (entity.attributes.hvac_action == 'heat')
  148.                     return "block";
  149.                   return "none";
  150.                 ]]]
  151.           manual:
  152.             - position: absolute
  153.             - left: 2%
  154.             - top: 20%
  155.             - border-radius: 50%
  156.             - display: |
  157.                [[[
  158.                   if (entity.attributes.preset_mode == 'manual')
  159.                     return "block";
  160.                   return "none";
  161.                 ]]]
  162.           minus:
  163.             - position: absolute
  164.             - left: 41%
  165.             - top: 53%
  166.           plus:
  167.             - position: absolute
  168.             - left: 41%
  169.             - top: 27%
  170.           trv:
  171.             - position: absolute
  172.             - left: 3%
  173.             - top: 1%
  174.           lb_programmazione:
  175.             - position: absolute
  176.             - left: 70%
  177.             - top: 41%
  178.           programmazione:
  179.             - position: absolute
  180.             - left: 58%
  181.             - top: 30%
  182.           batteria:
  183.             - position: absolute
  184.             - left: 78%
  185.             - top: 9.5%
  186.           mensile:
  187.             - position: absolute
  188.             - left: 70%
  189.             - top: 58%
  190.           annuale:
  191.             - position: absolute
  192.             - left: 85%
  193.             - top: 58%
  194.           oggi:
  195.             - position: absolute
  196.             - left: 58%
  197.             - top: 58%
  198.       custom_fields:
  199.         bg: |
  200.          [[[
  201.             return `<img
  202.               style="width: 1px"
  203.               src="/local/netatmo/turn_on.png"
  204.               />`
  205.           ]]]
  206.         cerchio: >
  207.          [[[ return states['climate.netatmo_camera_da_letto'].attributes.current_temperature; ]]]
  208.         temperatura_impostata: >
  209.          [[[ return states['climate.netatmo_camera_da_letto'].attributes.temperature; ]]]
  210.         turn_on: |
  211.          [[[
  212.             return `<img
  213.               style="width: 35px"
  214.               src="/local/netatmo/turn_on.png"
  215.               />`
  216.           ]]]
  217.         manual: |
  218.          [[[
  219.             return `<img
  220.               style="width: 35px"
  221.               src="/local/netatmo/manual.png"
  222.               />`
  223.           ]]]
  224.         minus:
  225.           card:
  226.             type: custom:button-card
  227.             icon: mdi:minus
  228.             color: black
  229.             styles:
  230.               card:
  231.                 - height: 60px
  232.                 - width: 60px
  233.                 - background: white
  234.                 - border-radius: 40%
  235.                 - border: 3px solid
  236.                 - border-color: gray
  237.         plus:
  238.           card:
  239.             type: custom:button-card
  240.             icon: mdi:plus
  241.             color: black
  242.             styles:
  243.               card:
  244.                 - height: 60px
  245.                 - width: 60px
  246.                 - background: white
  247.                 - border-radius: 40%
  248.                 - border: 3px solid
  249.                 - border-color: gray
  250.             tap_action:
  251.               action: call-service
  252.               service: script.temperatura_up
  253.               service_data:
  254.                 climate_id: climate.netatmo_camera_da_letto
  255.                 value: 0.5
  256.         trv:
  257.           card:
  258.             type: custom:button-card
  259.             template: no_background
  260.             label: >
  261.             [[[
  262.                return 'TRV: ' + states['climate.netatmo_camera_da_letto'].attributes.heating_power_request + '%';
  263.              ]]]
  264.             name: Avvisi
  265.             show_label: true
  266.             show_name: false
  267.             styles:
  268.               label:
  269.                 - font-size: 12px
  270.         lb_programmazione:
  271.           card:
  272.             type: custom:button-card
  273.             template: no_background
  274.             show_label: true
  275.             label: Programmazione
  276.             styles:
  277.               label:
  278.                 - font-size: 13px
  279.                 - font-weight: 500
  280.                 - opacity: 0.65
  281.         programmazione:
  282.           card:
  283.             type: custom:button-card
  284.             entity: select.netatmo_programmazione
  285.             template: no_background
  286.             name: Programmazione
  287.             layout: icon_name_state
  288.             show_label: false
  289.             show_name: true
  290.             label: Programmazione
  291.             name: >
  292.             [[[
  293.                return states['select.netatmo_programmazione'].state;
  294.              ]]]
  295.             icon: mdi:calendar-clock
  296.             styles:
  297.               icon:
  298.                 - width: 30px
  299.               card:
  300.                 - height: 60px
  301.                 - width: 150px
  302.                 - font-size: 13px
  303.                 - font-weight: 400
  304.                 - justify-self: start
  305.               name:
  306.                 - justify-self: start
  307.                 - font-weight: bold
  308.                 - font-size: 18px
  309.                 - padding-bottom: 15px
  310.         batteria:
  311.           card:
  312.             type: custom:button-card
  313.             template: no_background
  314.             entity: sensor.camera_da_letto_battery_percent
  315.             layout: icon_state
  316.             show_name: false
  317.             show_state: true
  318.             size: 100%
  319.             styles:
  320.               card:
  321.                 - height: 24px
  322.                 - width: 60px
  323.                 - font-size: 14px
  324.                 - border-radius: 15%
  325.                 - background: gray
  326.         mensile:
  327.           card:
  328.             type: custom:button-card #Mensile
  329.             template: no_background
  330.             entity: sensor.meter_valvola_cameretta_mesile
  331.             name: MENSILE
  332.             show_state: true
  333.             show_icon: false
  334.             show_name: true
  335.             show_units: true
  336.             units: '<span style="font-size: 12px; font-weight: 300">h</span>'
  337.             styles:
  338.               name:
  339.                 - font-size: 13px
  340.                 - font-weight: 500
  341.                 - opacity: 0.65
  342.               label:
  343.                 - font-size: 12px
  344.                 - font-weight: 300
  345.               state:
  346.                 - font-size: 15px
  347.                 - font-weight: bold
  348.                 - padding-top: 5px
  349.                 - padding-bottom: 5px
  350.             tap_action:
  351.               action: none
  352.         annuale:
  353.           card:
  354.             type: custom:button-card #Mensile
  355.             template: no_background
  356.             entity: sensor.meter_valvola_cameretta_annuale
  357.             name: ANNUALE
  358.             show_state: true
  359.             show_icon: false
  360.             show_name: true
  361.             show_units: true
  362.             units: '<span style="font-size: 12px; font-weight: 300">h</span>'
  363.             styles:
  364.               name:
  365.                 - font-size: 13px
  366.                 - font-weight: 500
  367.                 - opacity: 0.65
  368.               label:
  369.                 - font-size: 12px
  370.                 - font-weight: 300
  371.               state:
  372.                 - font-size: 15px
  373.                 - font-weight: bold
  374.                 - padding-top: 5px
  375.                 - padding-bottom: 5px
  376.  
  377.             tap_action:
  378.               action: none
  379.         oggi:
  380.           card:
  381.             type: custom:button-card #Mensile
  382.             template: no_background
  383.             entity: sensor.meter_valvola_camera_da_letto_giornaliero
  384.             name: OGGI
  385.             show_state: true
  386.             show_icon: false
  387.             show_name: true
  388.             show_units: true
  389.             units: '<span style="font-size: 12px; font-weight: 300">h</span>'
  390.             styles:
  391.               name:
  392.                 - font-size: 13px
  393.                 - font-weight: 500
  394.                 - opacity: 0.65
  395.               label:
  396.                 - font-size: 12px
  397.                 - font-weight: 300
  398.               state:
  399.                 - font-size: 15px
  400.                 - font-weight: bold
  401.                 - padding-top: 5px
  402.                 - padding-bottom: 5px
  403.             tap_action:
  404.               action: none
  405.             tap_action:
  406.               action: none
  407.     - type: 'custom:button-card'
  408.       template: border-bottom
  409.       variables:
  410.         margin_bottom: 0
  411.         margin_top: 0
  412.  
  413.  
  414.     - type: grid
  415.       square: false
  416.       columns: 5
  417.       cards:
  418.         - type: custom:button-card #Fuori Casa
  419.           template: no_background
  420.           entity: sensor.netatmo_stato_away
  421.           name: Fuori Casa
  422.           icon: mdi:home-export-outline
  423.           size: 25%
  424.           confirmation:
  425.             text: "[[[ return 'Passo alla modalità Fuori Casa?' ]]]"
  426.           styles:
  427.             name:
  428.               - font-size: 13px
  429.               - font-weight: 500
  430.               - opacity: 0.65
  431.             icon:
  432.               - color: >
  433.                  [[[
  434.                     if (entity.state == 'away') return 'orange';
  435.                     else return 'gray';
  436.                   ]]]
  437.  
  438.           tap_action:
  439.             action: call-service
  440.             service: script.preset_mode
  441.             service_data:
  442.               climate_id: climate.netatmo_camera_da_letto
  443.               preset_mode: away
  444.  
  445.         - type: custom:button-card #Boost
  446.           template: no_background
  447.           entity: climate.netatmo_camera_da_letto
  448.           name: Boost
  449.           icon: mdi:fire-alert
  450.           size: 25%
  451.           confirmation:
  452.             text: "[[[ return 'Passo alla modalità Boost?' ]]]"
  453.           styles:
  454.             name:
  455.               - font-size: 13px
  456.               - font-weight: 500
  457.               - opacity: 0.65
  458.             icon:
  459.               - color: >
  460.                  [[[
  461.                     if (entity.state == 'boost') return 'OliveDrab';
  462.                     else return 'gray';
  463.                   ]]]
  464.  
  465.           tap_action:
  466.             action: call-service
  467.             service: script.preset_mode
  468.             service_data:
  469.               climate_id: climate.netatmo_camera_da_letto
  470.               preset_mode: boost
  471.  
  472.         - type: custom:button-card #Antigelo
  473.           template: no_background
  474.           entity: climate.netatmo_camera_da_letto
  475.           name: Antigelo
  476.           icon: mdi:snowflake-alert
  477.           size: 25%
  478.           confirmation:
  479.             text: "[[[ return 'Passo alla modalità Antigelo?' ]]]"
  480.           styles:
  481.             name:
  482.               - font-size: 13px
  483.               - font-weight: 500
  484.               - opacity: 0.65
  485.             icon:
  486.               - color: >
  487.                  [[[
  488.                     if (entity.state == 'Fros Guard') return 'OliveDrab';
  489.                     else return 'gray';
  490.                   ]]]
  491.  
  492.           tap_action:
  493.             action: call-service
  494.             service: script.preset_mode
  495.             service_data:
  496.               climate_id: climate.netatmo_camera_da_letto
  497.               preset_mode: Frost Guard
  498.  
  499.         - type: custom:button-card #Programma
  500.           template: no_background
  501.           entity: climate.netatmo_camera_da_letto
  502.           name: Programma
  503.           icon: mdi:calendar-clock
  504.           size: 25%
  505.           confirmation:
  506.             text: "[[[ return 'Passo alla modalità Programmato?' ]]]"
  507.           styles:
  508.             name:
  509.               - font-size: 13px
  510.               - font-weight: 500
  511.               - opacity: 0.65
  512.             icon:
  513.               - color: >
  514.                  [[[
  515.                     if (entity.state == 'Schedule') return 'OliveDrab';
  516.                     else return 'gray';
  517.                   ]]]
  518.  
  519.           tap_action:
  520.             action: call-service
  521.             service: script.preset_mode
  522.             service_data:
  523.               climate_id: climate.netatmo_camera_da_letto
  524.               preset_mode: Schedule
  525.         # - type: custom:button-card #Mensile
  526.         #   template: no_background
  527.         #   entity: sensor.meter_valvola_cameretta_mesile
  528.         #   name: MENSILE
  529.         #   show_state: true
  530.         #   show_icon: false
  531.         #   show_name: true
  532.         #   show_label: true
  533.         #   show_units: true
  534.         #   units: '<span style="font-size: 12px; font-weight: 300">h</span>'
  535.         #   styles:
  536.         #
  537.         #     name:
  538.         #       - font-size: 13px
  539.         #       - font-weight: 500
  540.         #       - opacity: 0.65
  541.         #     label:
  542.         #       - font-size: 12px
  543.         #       - font-weight: 300
  544.         #     state:
  545.         #       - font-size: 15px
  546.         #       - font-weight: bold
  547.         #       - padding-top: 5px
  548.         #       - padding-bottom: 5px
  549.         #   label: >
  550.        #    [[[
  551.         #      return 'Oggi: ' + states['sensor.meter_valvola_cameretta_giornaliero'].state + 'h';
  552.         #    ]]]
  553.         #   tap_action:
  554.         #     action: none
  555.         #
  556.         # - type: custom:button-card #Mensile
  557.         #   template: no_background
  558.         #   entity: sensor.meter_valvola_cameretta_mesile
  559.         #   name: MENSILE
  560.         #   show_state: true
  561.         #   show_icon: false
  562.         #   show_name: true
  563.         #   show_label: true
  564.         #   show_units: true
  565.         #   units: '<span style="font-size: 12px; font-weight: 300">h</span>'
  566.         #   styles:
  567.         #
  568.         #     name:
  569.         #       - font-size: 13px
  570.         #       - font-weight: 500
  571.         #       - opacity: 0.65
  572.         #     label:
  573.         #       - font-size: 12px
  574.         #       - font-weight: 300
  575.         #     state:
  576.         #       - font-size: 15px
  577.         #       - font-weight: bold
  578.         #       - padding-top: 5px
  579.         #       - padding-bottom: 5px
  580.         #   label: >
  581.         #    [[[
  582.         #      return 'Oggi: ' + states['sensor.meter_valvola_cameretta_giornaliero'].state + 'h';
  583.         #    ]]]
  584.         #   tap_action:
  585.         #     action: none
  586.         - type: custom:button-card
  587.           template: no_background
  588.           entity: binary_sensor.porta_ingresso
  589.           icon: mdi:window-open-variant
  590.           size: 25%
  591.           show_label: true
  592.           show_name: false
  593.           show_state: false
  594.           show_icon: true
  595.           name: Finestra
  596.           label: >
  597.             [[[
  598.               if (entity.state == 'on') return 'Aperta';
  599.               else return 'Chiusa';
  600.             ]]]
  601.           state:
  602.             - value: 'off'
  603.               color: OliveDrab
  604.             - value: 'on'
  605.               color: ORANGERed
  606.           styles:
  607.             # card:
  608.             #   - height: 60px
  609.             #   - width: 75px
  610.             label:
  611.               - font-size: 13px
  612.               - font-weight: 500
  613.               - opacity: 0.65
  614.               - padding-top: 4px
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement