Advertisement
Guest User

Untitled

a guest
Dec 19th, 2018
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 28.87 KB | None | 0 0
  1. ###############################################################################
  2. #                                                                             #
  3. #                           G R O U P                                         #
  4. #                                                                             #
  5. ###############################################################################
  6. group:
  7. #### ENERGY
  8.   energy_group:
  9.     name: 'Energy'
  10.     entities:
  11.      - sensor.frequencia
  12.       - sensor.corrente
  13.       - sensor.potencia_w
  14.       - sensor.voltagem
  15.  
  16. #### DAILY CONSUMPTIONS
  17.   consumos_diarios:
  18.     name: 'Daily spend'
  19.     entities:
  20.      - sensor.day_energy_vazio
  21.       - sensor.day_energy_fora_vazio
  22.       - sensor.day_energy_total
  23.       - sensor.daily_energia_cost_total
  24.       - history_graph.daily_consumed_energy
  25.  
  26. #### MONTHLY CONSUMPTIONS
  27.   consumos_mensais_janeiro:
  28.     name: 'Montly spend Janeiro'
  29.     entities:
  30.      - sensor.month_energy_vazio_janeiro
  31.       - sensor.month_energy_fora_vazio_janeiro
  32.       - sensor.fatura_energia_janeiro
  33.  
  34.   consumos_mensais_fevereiro:
  35.     name: 'Montly spend Fevereiro'
  36.     entities:
  37.      - sensor.month_energy_vazio_fevereiro
  38.       - sensor.month_energy_fora_vazio_fevereiro
  39.       - sensor.fatura_energia_fevereiro
  40.  
  41.   consumos_mensais_marco:
  42.     name: 'Montly spend Março'
  43.     entities:
  44.      - sensor.month_energy_vazio_marco
  45.       - sensor.month_energy_fora_vazio_marco
  46.       - sensor.fatura_energia_marco
  47.  
  48.   consumos_mensais_abril:
  49.     name: 'Montly spend Abril'
  50.     entities:
  51.      - sensor.month_energy_vazio_abril
  52.       - sensor.month_energy_fora_vazio_abril
  53.       - sensor.fatura_energia_abril
  54.  
  55.   consumos_mensais_maio:
  56.     name: 'Montly spend Maio'
  57.     entities:
  58.      - sensor.month_energy_vazio_maio
  59.       - sensor.month_energy_fora_vazio_maio
  60.       - sensor.fatura_energia_maio
  61.  
  62.   consumos_mensais_junho:
  63.     name: 'Montly spend Junho'
  64.     entities:
  65.      - sensor.month_energy_vazio_junho
  66.       - sensor.month_energy_fora_vazio_junho
  67.       - sensor.fatura_energia_junho
  68.  
  69.   consumos_mensais_julho:
  70.     name: 'Montly spend Julho'
  71.     entities:
  72.      - sensor.month_energy_vazio_julho
  73.       - sensor.month_energy_fora_vazio_julho
  74.       - sensor.fatura_energia_julho
  75.       - history_graph.julho_consumed_energy
  76.  
  77.   consumos_mensais_agosto:
  78.     name: 'Montly spend Agosto'
  79.     entities:
  80.      - sensor.month_energy_vazio_agosto
  81.       - sensor.month_energy_fora_vazio_agosto
  82.       - sensor.fatura_energia_agosto
  83.  
  84.   consumos_mensais_setembro:
  85.     name: 'Montly spend Setembro'
  86.     entities:
  87.      - sensor.month_energy_vazio_setembro
  88.       - sensor.month_energy_fora_vazio_setembro
  89.       - sensor.fatura_energia_setembro
  90.  
  91.   consumos_mensais_outubro:
  92.     name: 'Montly spend Outubro'
  93.     entities:
  94.      - sensor.month_energy_vazio_outubro
  95.       - sensor.month_energy_fora_vazio_outubro
  96.       - sensor.fatura_energia_outubro
  97.  
  98.   consumos_mensais_novembro:
  99.     name: 'Montly spend Novembro'
  100.     entities:
  101.      - sensor.month_energy_vazio_novembro
  102.       - sensor.month_energy_fora_vazio_novembro
  103.       - sensor.fatura_energia_novembro
  104.  
  105.   consumos_mensais_dezembro:
  106.     name: 'Montly spend Dezembro'
  107.     entities:
  108.      - sensor.month_energy_vazio_dezembro
  109.       - sensor.month_energy_fora_vazio_dezembro
  110.       - sensor.fatura_energia_dezembro
  111. #### TOTALIZERS
  112.   totalizadores:
  113.     name: 'Total'
  114.     entities:
  115.      - sensor.house_consumption_total_kwh
  116.       - history_graph.house_consumption_total_euro
  117.  
  118. ###############################################################################
  119. #                                                                             #
  120. #                         S E N S O R                                         #
  121. #                                                                             #
  122. ###############################################################################
  123.  
  124. sensor:
  125.   - platform: mqtt
  126.     state_topic: 'tele/sdm120/SENSOR'
  127.     value_template: '{{ value_json["ENERGY"]["Voltage"] }}'
  128.     name: 'Voltagem'
  129.     unit_of_measurement: "V"
  130.     icon: mdi:speedometer
  131.  
  132.   - platform: mqtt
  133.     state_topic: 'tele/sdm120/SENSOR'
  134.     value_template: '{{ value_json["ENERGY"]["Current"] }}'
  135.     name: 'Corrente'
  136.     unit_of_measurement: "A"
  137.     icon: mdi:speedometer
  138.  
  139.   - platform: mqtt
  140.     state_topic: 'tele/sdm120/SENSOR'
  141.     value_template: '{{ value_json["ENERGY"]["ActivePower"] }}'
  142.     name: "Potência (W)"
  143.     unit_of_measurement: "W"
  144.     icon: mdi:speedometer
  145.  
  146.   - platform: mqtt
  147.     state_topic: 'tele/sdm120/SENSOR'
  148.     value_template: '{{ value_json["ENERGY"]["ApparentPower"] }}'
  149.     name: 'Active apparent power'
  150.     unit_of_measurement: "VA"
  151.     icon: mdi:speedometer
  152.  
  153.   - platform: mqtt
  154.     state_topic: 'tele/sdm120/SENSOR'
  155.     value_template: '{{ value_json["ENERGY"]["ReactivePower"] }}'
  156.     name: 'Reactive apparent power'
  157.     unit_of_measurement: "VAR"
  158.     icon: mdi:speedometer
  159.  
  160.   - platform: mqtt
  161.     state_topic: 'tele/sdm120/SENSOR'
  162.     value_template: '{{ value_json["ENERGY"]["Factor"] }}'
  163.     name: 'Factor Power'
  164.     unit_of_measurement: ""
  165.     icon: mdi:speedometer
  166.  
  167.   - platform: mqtt
  168.     state_topic: 'tele/sdm120/SENSOR'
  169.     value_template: '{{ value_json["ENERGY"]["Frequency"] }}'
  170.     name: 'Frequencia'
  171.     unit_of_measurement: "HZ"
  172.     icon: mdi:speedometer
  173.  
  174.   # - platform: mqtt
  175.   #   state_topic: 'tele/sdm120/SENSOR'
  176.   #   value_template: '{{ value_json["ENERGY"]["ApparentPower"] }}'
  177.   #   name: 'Phase Angle'
  178.   #   unit_of_measurement: "Degree"
  179.   #   icon: mdi:speedometer
  180.  
  181.   - platform: mqtt
  182.     state_topic: 'tele/sdm120/SENSOR'
  183.     value_template: '{{ value_json["ENERGY"]["Total"] }}'
  184.     name: 'Total active energy'
  185.     unit_of_measurement: "Wh"
  186.     icon: mdi:speedometer
  187.  
  188.   # - platform: mqtt
  189.   #   state_topic: 'tele/sdm120/SENSOR'
  190.   #   value_template: '{{ value_json["ENERGY"]["ApparentPower"] }}'
  191.   #   name: 'Total reactive energy'
  192.   #   unit_of_measurement: "Wh"
  193.   #   icon: mdi:speedometer
  194.  
  195.   # - platform: mqtt
  196.   #   state_topic: 'tele/sdm120/SENSOR'
  197.   #   value_template: '{{ value_json["ENERGY"]["ApparentPower"] }}'
  198.   #   name: 'Import active energy'
  199.   #   unit_of_measurement: "Wh"
  200.   #   icon: mdi:speedometer
  201.  
  202.   # - platform: mqtt
  203.   #   state_topic: 'tele/sdm120/SENSOR'
  204.   #   value_template: '{{ value_json["ENERGY"]["ApparentPower"] }}'
  205.   #   name: 'Export active energy'
  206.   #   unit_of_measurement: "Wh"
  207.   #   icon: mdi:speedometer
  208.  
  209.   # - platform: mqtt
  210.   #   state_topic: 'tele/sdm120/SENSOR'
  211.   #   value_template: '{{ value_json["ENERGY"]["ApparentPower"] }}'
  212.   #   name: 'Import reactive energy'
  213.   #   unit_of_measurement: "VARh"
  214.   #   icon: mdi:speedometer
  215.  
  216.   # - platform: mqtt
  217.   #   state_topic: 'tele/sdm120/SENSOR'
  218.   #   value_template: '{{ value_json["ENERGY"]["ApparentPower"] }}'
  219.   #   name: 'Export reactive energy'
  220.   #   unit_of_measurement: "VARh"
  221.   #   icon: mdi:speedometer
  222.  
  223.   - platform: template
  224.     sensors:
  225.       house_consumption_total_kwh:
  226.         friendly_name: 'Total Spend'
  227.         value_template: '{{  ((states.sensor.import_reactive_energy.state | float ) + ( states.sensor.total_active_energy.state | float )) | round(2) }}'
  228.         unit_of_measurement: "kWh"
  229.       # montly_consumption_total_euro_fora_vazio:
  230.       #   friendly_name: 'Montly total fora vazio'
  231.       #   value_template: '{{ (((states.sensor.month_energy_fora_vazio.state | float) * (0.2037 )) | round(2)) }}'
  232.       #   unit_of_measurement: "€"
  233.       # montly_consumption_total_euro_vazio:
  234.       #   friendly_name: 'Montly Total vazio '
  235.       #   value_template: '{{ (((states.sensor.month_energy_vazio.state | float) * (0.0943 )) | round(2)) }}'
  236.       #   unit_of_measurement: "€"
  237.       daily_energia_cost_total:
  238.         friendly_name: "Daily energy cost"
  239.         value_template: >-
  240.           {{ ((float(states.sensor.day_energy_vazio.state) * 0.0954  + float(states.sensor.day_energy_fora_vazio.state) * 0.1897 ) * 1.23 ) | round(2) }}
  241.         unit_of_measurement: "€"
  242.       day_energy_vazio:
  243.         friendly_name: "Daily energy Vazio"
  244.         value_template: >-
  245.           {% if (float(states.sensor.day_energy_total.state) - float(states.sensor.day_energy_fora_vazio.state)) | round (3) >=0 %}
  246.           {{ (float(states.sensor.day_energy_total.state) - float(states.sensor.day_energy_fora_vazio.state)) | round (3)}}
  247.           {% else %}
  248.           0
  249.           {% endif %}
  250.         unit_of_measurement: "kWh"
  251.       fatura_energia_janeiro:
  252.         friendly_name: "Fatura Energia Janeiro"
  253.         value_template: >-
  254.           {{ ((float(states.sensor.month_energy_vazio_janeiro.state) * 0.0954  + float(states.sensor.month_energy_fora_vazio_janeiro.state) * 0.1897 + now().day * 0.1683 + 2.90 ) * 1.23 ) | round(2) }}
  255.         unit_of_measurement: "€"
  256.       fatura_energia_fevereiro:
  257.         friendly_name: "Fatura Energia Fevereiro"
  258.         value_template: >-
  259.           {{ ((float(states.sensor.month_energy_vazio_fevereiro.state) * 0.0954  + float(states.sensor.month_energy_fora_vazio_fevereiro.state) * 0.1897 + now().day * 0.1683 + 2.90 ) * 1.23 ) | round(2) }}
  260.         unit_of_measurement: "€"
  261.       fatura_energia_marco:
  262.         friendly_name: "Fatura Energia Março"
  263.         value_template: >-
  264.           {{ ((float(states.sensor.month_energy_vazio_marco.state) * 0.0954  + float(states.sensor.month_energy_fora_vazio_marco.state) * 0.1897 + now().day * 0.1683 + 2.90 ) * 1.23 ) | round(2) }}
  265.         unit_of_measurement: "€"
  266.       fatura_energia_abril:
  267.         friendly_name: "Fatura Energia Abril"
  268.         value_template: >-
  269.           {{ ((float(states.sensor.month_energy_vazio_abril.state) * 0.0954  + float(states.sensor.month_energy_fora_vazio_abril.state) * 0.1897 + now().day * 0.1683 + 2.90 ) * 1.23 ) | round(2) }}
  270.         unit_of_measurement: "€"
  271.       fatura_energia_maio:
  272.         friendly_name: "Fatura Energia Maio"
  273.         value_template: >-
  274.           {{ ((float(states.sensor.month_energy_vazio_maio.state) * 0.0954  + float(states.sensor.month_energy_fora_vazio_maio.state) * 0.1897 + now().day * 0.1683 + 2.90 ) * 1.23 ) | round(2) }}
  275.         unit_of_measurement: "€"
  276.       fatura_energia_junho:
  277.         friendly_name: "Fatura Energia Junho"
  278.         value_template: >-
  279.           {{ ((float(states.sensor.month_energy_vazio_junho.state) * 0.0954  + float(states.sensor.month_energy_fora_vazio_junho.state) * 0.1897 + now().day * 0.1683 + 2.90 ) * 1.23 ) | round(2) }}
  280.         unit_of_measurement: "€"
  281.       fatura_energia_julho:
  282.         friendly_name: "Fatura Energia Julho"
  283.         value_template: >-
  284.           {{ ((float(states.sensor.month_energy_vazio_julho.state) * 0.0954  + float(states.sensor.month_energy_fora_vazio_julho.state) * 0.1897 + now().day * 0.1683 + 2.90 ) * 1.23 ) | round(2) }}
  285.         unit_of_measurement: "€"
  286.       fatura_energia_agosto:
  287.         friendly_name: "Fatura Energia Agosto"
  288.         value_template: >-
  289.           {{ ((float(states.sensor.month_energy_vazio_agosto.state) * 0.0954  + float(states.sensor.month_energy_fora_vazio_agosto.state) * 0.1897 + now().day * 0.1683 + 2.90 ) * 1.23 ) | round(2) }}
  290.         unit_of_measurement: "€"
  291.       fatura_energia_setembro:
  292.         friendly_name: "Fatura Energia Setembro"
  293.         value_template: >-
  294.           {{ ((float(states.sensor.month_energy_vazio_setembro.state) * 0.0954  + float(states.sensor.month_energy_fora_vazio_setembro.state) * 0.1897 + now().day * 0.1683 + 2.90 ) * 1.23 ) | round(2) }}
  295.         unit_of_measurement: "€"
  296.       fatura_energia_outubro:
  297.         friendly_name: "Fatura Energia Outubro"
  298.         value_template: >-
  299.           {{ ((float(states.sensor.month_energy_vazio_outubro.state) * 0.0954  + float(states.sensor.month_energy_fora_vazio_outubro.state) * 0.1897 + now().day * 0.1683 + 2.90 ) * 1.23 ) | round(2) }}
  300.         unit_of_measurement: "€"
  301.       fatura_energia_novembro:
  302.         friendly_name: "Fatura Energia Novembro"
  303.         value_template: >-
  304.           {{ ((float(states.sensor.month_energy_vazio_novembro.state) * 0.0954  + float(states.sensor.month_energy_fora_vazio_novembro.state) * 0.1897 + now().day * 0.1683 + 2.90 ) * 1.23 ) | round(2) }}
  305.         unit_of_measurement: "€"
  306.       fatura_energia_dezembro:
  307.         friendly_name: "Fatura Energia Dezembro"
  308.         value_template: >-
  309.           {{ ((float(states.sensor.month_energy_vazio_dezembro.state) * 0.0954  + float(states.sensor.month_energy_fora_vazio_dezembro.state) * 0.1897 + now().day * 0.1683 + 2.90 ) * 1.23 ) | round(2) }}
  310.         unit_of_measurement: "€"
  311.  
  312.   - platform: influxdb
  313.     host: !secret influxdb_host
  314.     scan_interval: 120
  315.     # username: !secret influxdb_user
  316.     # password: !secret influxdb_password
  317.     queries:
  318.       - name: day energy fora vazio
  319.         unit_of_measurement: kWh
  320.         where: '"entity_id" = ''potencia_w'' AND time >= ''{{ now().strftime("%Y-%m-%d 08:00:00")}}'' AND time < ''{{ now().strftime("%Y-%m-%d 22:00:00") }}'' tz(''Europe/Lisbon'')'
  321.         measurement: '"W"'
  322.         group_function: 'integral'
  323.         field: '"value",1h'
  324.         value_template: '{{ (value | float / 1000) | round(1) }}'
  325.       - name: day energy total
  326.         unit_of_measurement: kWh
  327.         where: '"entity_id" = ''potencia_w'' AND time >= ''{{ now().strftime("%Y-%m-%d 00:00:00") }}'' tz(''Europe/Lisbon'')'
  328.         measurement: '"W"'
  329.         group_function: 'integral'
  330.         field: '"value",1h'
  331.         value_template: '{{ (value | float / 1000) | round(1) }}'
  332.       # - name: month energy vazio
  333.       #   measurement: '(select last(value),entity_id FROM kWh'
  334.       #   where:  '"entity_id" = ''day_energy_vazio'' and time >= ''{{ now().strftime("%Y-%m-14 00:00:00")}}''-30d group by time(1d) tz(''Europe/Lisbon''))'
  335.       #   group_function: 'sum'
  336.       #   field: 'last'
  337.       #   unit_of_measurement: kWh
  338.       #   value_template: '{{ (value | float) | round(1) }}'
  339.       # - name: month energy fora vazio
  340.       #   measurement: '(select last(value),entity_id FROM kWh'
  341.       #   where:  '"entity_id" = ''day_energy_fora_vazio'' and time >= ''{{ now().strftime("%Y-%m-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  342.       #   group_function: 'sum'
  343.       #   field: 'last'
  344.       #   unit_of_measurement: kWh
  345.       #   value_template: '{{ (value | float) | round(1) }}'
  346.       - name: month energy fora vazio janeiro
  347.         measurement: '(select last(value),entity_id FROM kWh'
  348.         where: '"entity_id" = ''day_energy_fora_vazio'' and time >= ''{{ now().strftime("%Y-12-14 00:00:00")}}'' and time <= ''{{ now().strftime("%Y-01-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  349.         group_function: 'sum'
  350.         field: 'last'
  351.         unit_of_measurement: kWh
  352.         value_template: '{{ (value | float) | round(1) }}'
  353.       - name: month energy fora vazio fevereiro
  354.         measurement: '(select last(value),entity_id FROM kWh'
  355.         where: '"entity_id" = ''day_energy_fora_vazio'' and time >= ''{{ now().strftime("%Y-01-14 00:00:00")}}'' and time <= ''{{ now().strftime("%Y-02-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  356.         group_function: 'sum'
  357.         field: 'last'
  358.         unit_of_measurement: kWh
  359.         value_template: '{{ (value | float) | round(1) }}'
  360.       - name: month energy fora vazio marco
  361.         measurement: '(select last(value),entity_id FROM kWh'
  362.         where: '"entity_id" = ''day_energy_fora_vazio'' and time >= ''{{ now().strftime("%Y-02-14 00:00:00")}}'' and time <= ''{{ now().strftime("%Y-03-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  363.         group_function: 'sum'
  364.         field: 'last'
  365.         unit_of_measurement: kWh
  366.         value_template: '{{ (value | float) | round(1) }}'
  367.       - name: month energy fora vazio abril
  368.         measurement: '(select last(value),entity_id FROM kWh'
  369.         where: '"entity_id" = ''day_energy_fora_vazio'' and time >= ''{{ now().strftime("%Y-03-14 00:00:00")}}'' and time <= ''{{ now().strftime("%Y-04-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  370.         group_function: 'sum'
  371.         field: 'last'
  372.         unit_of_measurement: kWh
  373.         value_template: '{{ (value | float) | round(1) }}'
  374.       - name: month energy fora vazio maio
  375.         measurement: '(select last(value),entity_id FROM kWh'
  376.         where: '"entity_id" = ''day_energy_fora_vazio'' and time >= ''{{ now().strftime("%Y-04-14 00:00:00")}}'' and time <= ''{{ now().strftime("%Y-05-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  377.         group_function: 'sum'
  378.         field: 'last'
  379.         unit_of_measurement: kWh
  380.         value_template: '{{ (value | float) | round(1) }}'
  381.       - name: month energy fora vazio junho
  382.         measurement: '(select last(value),entity_id FROM kWh'
  383.         where: '"entity_id" = ''day_energy_fora_vazio'' and time >= ''{{ now().strftime("%Y-05-14 00:00:00")}}'' and time <= ''{{ now().strftime("%Y-06-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  384.         group_function: 'sum'
  385.         field: 'last'
  386.         unit_of_measurement: kWh
  387.         value_template: '{{ (value | float) | round(1) }}'
  388.       - name: month energy fora vazio julho
  389.         measurement: '(select last(value),entity_id FROM kWh'
  390.         where: '"entity_id" = ''day_energy_fora_vazio'' and time >= ''{{ now().strftime("%Y-06-14 00:00:00")}}'' and time <= ''{{ now().strftime("%Y-07-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  391.         group_function: 'sum'
  392.         field: 'last'
  393.         unit_of_measurement: kWh
  394.         value_template: '{{ (value | float) | round(1) }}'
  395.       - name: month energy fora vazio agosto
  396.         measurement: '(select last(value),entity_id FROM kWh'
  397.         where: '"entity_id" = ''day_energy_fora_vazio'' and time >= ''{{ now().strftime("%Y-07-14 00:00:00")}}'' and time <= ''{{ now().strftime("%Y-08-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  398.         group_function: 'sum'
  399.         field: 'last'
  400.         unit_of_measurement: kWh
  401.         value_template: '{{ (value | float) | round(1) }}'
  402.       - name: month energy fora vazio setembro
  403.         measurement: '(select last(value),entity_id FROM kWh'
  404.         where: '"entity_id" = ''day_energy_fora_vazio'' and time >= ''{{ now().strftime("%Y-08-14 00:00:00")}}'' and time <= ''{{ now().strftime("%Y-09-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  405.         group_function: 'sum'
  406.         field: 'last'
  407.         unit_of_measurement: kWh
  408.         value_template: '{{ (value | float) | round(1) }}'
  409.       - name: month energy fora vazio outubro
  410.         measurement: '(select last(value),entity_id FROM kWh'
  411.         where: '"entity_id" = ''day_energy_fora_vazio'' and time >= ''{{ now().strftime("%Y-09-14 00:00:00")}}'' and time <= ''{{ now().strftime("%Y-10-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  412.         group_function: 'sum'
  413.         field: 'last'
  414.         unit_of_measurement: kWh
  415.         value_template: '{{ (value | float) | round(1) }}'
  416.       - name: month energy fora vazio novembro
  417.         measurement: '(select last(value),entity_id FROM kWh'
  418.         where: '"entity_id" = ''day_energy_fora_vazio'' and time >= ''{{ now().strftime("%Y-10-14 00:00:00")}}'' and time <= ''{{ now().strftime("%Y-11-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  419.         group_function: 'sum'
  420.         field: 'last'
  421.         unit_of_measurement: kWh
  422.         value_template: '{{ (value | float) | round(1) }}'
  423.       - name: month energy fora vazio dezembro
  424.         measurement: '(select last(value),entity_id FROM kWh'
  425.         where: '"entity_id" = ''day_energy_fora_vazio'' and time >= ''{{ now().strftime("%Y-11-14 00:00:00")}}'' and time <= ''{{ now().strftime("%Y-12-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  426.         group_function: 'sum'
  427.         field: 'last'
  428.         unit_of_measurement: kWh
  429.         value_template: '{{ (value | float) | round(1) }}'
  430.  
  431.       - name: month energy vazio janeiro
  432.         measurement: '(select last(value),entity_id FROM kWh'
  433.         where: '"entity_id" = ''day_energy_vazio'' and time >= ''{{ now().strftime("%Y-12-14 00:00:00")}}'' and time <= ''{{ now().strftime("%Y-01-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  434.         group_function: 'sum'
  435.         field: 'last'
  436.         unit_of_measurement: kWh
  437.         value_template: '{{ (value | float) | round(1) }}'
  438.       - name: month energy vazio fevereiro
  439.         measurement: '(select last(value),entity_id FROM kWh'
  440.         where: '"entity_id" = ''day_energy_vazio'' and time >= ''{{ now().strftime("%Y-01-14 00:00:00")}}'' and time <= ''{{ now().strftime("%Y-02-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  441.         group_function: 'sum'
  442.         field: 'last'
  443.         unit_of_measurement: kWh
  444.         value_template: '{{ (value | float) | round(1) }}'
  445.       - name: month energy vazio marco
  446.         measurement: '(select last(value),entity_id FROM kWh'
  447.         where: '"entity_id" = ''day_energy_vazio'' and time >= ''{{ now().strftime("%Y-02-14 00:00:00")}}'' and time <= ''{{ now().strftime("%Y-03-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  448.         group_function: 'sum'
  449.         field: 'last'
  450.         unit_of_measurement: kWh
  451.         value_template: '{{ (value | float) | round(1) }}'
  452.       - name: month energy vazio abril
  453.         measurement: '(select last(value),entity_id FROM kWh'
  454.         where: '"entity_id" = ''day_energy_vazio'' and time >= ''{{ now().strftime("%Y-03-14 00:00:00")}}'' and time <= ''{{ now().strftime("%Y-04-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  455.         group_function: 'sum'
  456.         field: 'last'
  457.         unit_of_measurement: kWh
  458.         value_template: '{{ (value | float) | round(1) }}'
  459.       - name: month energy vazio maio
  460.         measurement: '(select last(value),entity_id FROM kWh'
  461.         where: '"entity_id" = ''day_energy_vazio'' and time >= ''{{ now().strftime("%Y-04-14 00:00:00")}}'' and time <= ''{{ now().strftime("%Y-05-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  462.         group_function: 'sum'
  463.         field: 'last'
  464.         unit_of_measurement: kWh
  465.         value_template: '{{ (value | float) | round(1) }}'
  466.       - name: month energy vazio junho
  467.         measurement: '(select last(value),entity_id FROM kWh'
  468.         where: '"entity_id" = ''day_energy_vazio'' and time >= ''{{ now().strftime("%Y-05-14 00:00:00")}}'' and time <= ''{{ now().strftime("%Y-06-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  469.         group_function: 'sum'
  470.         field: 'last'
  471.         unit_of_measurement: kWh
  472.         value_template: '{{ (value | float) | round(1) }}'
  473.       - name: month energy vazio julho
  474.         measurement: '(select last(value),entity_id FROM kWh'
  475.         where: '"entity_id" = ''day_energy_vazio'' and time >= ''{{ now().strftime("%Y-06-14 00:00:00")}}'' and time <= ''{{ now().strftime("%Y-07-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  476.         group_function: 'sum'
  477.         field: 'last'
  478.         unit_of_measurement: kWh
  479.         value_template: '{{ (value | float) | round(1) }}'
  480.       - name: month energy vazio agosto
  481.         measurement: '(select last(value),entity_id FROM kWh'
  482.         where: '"entity_id" = ''day_energy_vazio'' and time >= ''{{ now().strftime("%Y-07-14 00:00:00")}}'' and time <= ''{{ now().strftime("%Y-08-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  483.         group_function: 'sum'
  484.         field: 'last'
  485.         unit_of_measurement: kWh
  486.         value_template: '{{ (value | float) | round(1) }}'
  487.       - name: month energy vazio setembro
  488.         measurement: '(select last(value),entity_id FROM kWh'
  489.         where: '"entity_id" = ''day_energy_vazio'' and time >= ''{{ now().strftime("%Y-08-14 00:00:00")}}'' and time <= ''{{ now().strftime("%Y-09-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  490.         group_function: 'sum'
  491.         field: 'last'
  492.         unit_of_measurement: kWh
  493.         value_template: '{{ (value | float) | round(1) }}'
  494.       - name: month energy vazio outubro
  495.         measurement: '(select last(value),entity_id FROM kWh'
  496.         where: '"entity_id" = ''day_energy_vazio'' and time >= ''{{ now().strftime("%Y-09-14 00:00:00")}}'' and time <= ''{{ now().strftime("%Y-10-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  497.         group_function: 'sum'
  498.         field: 'last'
  499.         unit_of_measurement: kWh
  500.         value_template: '{{ (value | float) | round(1) }}'
  501.       - name: month energy vazio novembro
  502.         measurement: '(select last(value),entity_id FROM kWh'
  503.         where: '"entity_id" = ''day_energy_vazio'' and time >= ''{{ now().strftime("%Y-10-14 00:00:00")}}'' and time <= ''{{ now().strftime("%Y-11-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  504.         group_function: 'sum'
  505.         field: 'last'
  506.         unit_of_measurement: kWh
  507.         value_template: '{{ (value | float) | round(1) }}'
  508.       - name: month energy vazio dezembro
  509.         measurement: '(select last(value),entity_id FROM kWh'
  510.         where: '"entity_id" = ''day_energy_vazio'' and time >= ''{{ now().strftime("%Y-11-14 00:00:00")}}'' and time <= ''{{ now().strftime("%Y-12-14 00:00:00")}}''group by time(1d) tz(''Europe/Lisbon''))'
  511.         group_function: 'sum'
  512.         field: 'last'
  513.         unit_of_measurement: kWh
  514.         value_template: '{{ (value | float) | round(1) }}'
  515.  
  516. ###############################################################################
  517. #                                                                             #
  518. #                         HISTORY GRAPH                                       #
  519. #                                                                             #
  520. ###############################################################################
  521.  
  522.  
  523. history_graph:
  524.   graph_energia_daily:
  525.     name: Daily Consumed Energy
  526.     entities:
  527.      - sensor.day_energy_total
  528.       - sensor.day_energy_vazio
  529.       - sensor.day_energy_fora_vazio
  530.     hours_to_show: 48
  531.     refresh: 30
  532.   graph_energia_montly_julho:
  533.     name: Julho Consumed Energy
  534.     entities:
  535.      - sensor.month_energy_vazio_julho
  536.       - sensor.month_energy_fora_vazio_julho
  537.     hours_to_show: 48
  538.     refresh: 30
  539.  
  540. ###############################################################################
  541. #                                                                             #
  542. #                        C O S T U M I Z E                                    #
  543. #                                                                             #
  544. ###############################################################################
  545.  
  546.  
  547. homeassistant:
  548.   customize:
  549. #### ENERGIA
  550.     sensor.energy_volt:
  551.       icon: mdi:speedometer
  552.     sensor.energy_hertz:
  553.       icon: mdi:speedometer
  554.     sensor.energy_amp:
  555.       icon: mdi:speedometer
  556.       show_last_changed: true
  557.     sensor.energy_watt:
  558.       icon: mdi:speedometer
  559.       show_last_changed: true
  560.     sensor.energy_power_wh:
  561.       icon: mdi:speedometer
  562.       show_last_changed: true
  563.     sensor.energy_apparent_power:
  564.       icon: mdi:speedometer
  565.       show_last_changed: true
  566.     sensor.daily_energia_cost_total:
  567.       icon: mdi:currency-eur
  568.       show_last_changed: true
  569.     sensor.fatura_energia:
  570.       icon: mdi:currency-eur
  571.       show_last_changed: true
  572.     sensor.montly_consumption_total_euro_fora_vazio:
  573.       icon: mdi:currency-eur
  574.       show_last_changed: true
  575.     sensor.montly_consumption_total_euro_vazio:
  576.       icon: mdi:currency-eur
  577.       show_last_changed: true
  578.     sensor.export_active_energy:
  579.       hidden: true
  580.     sensor.export_reactive_energy:
  581.       hidden: true
  582.     sensor.factor_power:
  583.       hidden: true
  584.     sensor.phase_angle:
  585.       hidden: true
  586.     sensor.total_reactive_energy:
  587.       hidden: true
  588.     sensor.total_active_energy:
  589.       hidden: true
  590.     sensor.reactive_apparent_power:
  591.       hidden: true
  592.     sensor.import_active_energy:
  593.       hidden: true
  594.     sensor.import_reactive_energy:
  595.       hidden: true
  596.     sensor.active_apparent_power:
  597.       hidden: true
  598.  
  599. #### CONSUMOS DIÁRIOS
  600.     sensor.consumption_daily_total_kwh:
  601.       icon: mdi:sigma
  602.       show_last_changed: true
  603.     sensor.consumption_daily_total_euro:
  604.       icon: mdi:currency-eur
  605.       show_last_changed: true
  606.     sensor.consumption_daily_total_kwh_fora_de_vazio:
  607.       icon: mdi:circle
  608.     sensor.consumption_daily_total_kwh_vazio:
  609.       icon: mdi:circle-outline
  610.  
  611. #### CONSUMOS MENSAIS
  612.     sensor.consumption_monthly_total_kwh:
  613.       icon: mdi:sigma
  614.       show_last_changed: true
  615.     sensor.consumption_monthly_total_euro:
  616.       icon: mdi:currency-eur
  617.       show_last_changed: true
  618.     sensor.consumption_monthly_total_kwh_fora_de_vazio:
  619.       icon: mdi:circle
  620.     sensor.consumption_monthly_total_kwh_vazio:
  621.       icon: mdi:circle-outline
  622.  
  623. #### TOTALIZADORES
  624.     sensor.house_consumption_total_kwh:
  625.       icon: mdi:sigma
  626.       show_last_changed: true
  627.     sensor.house_consumption_total_euro:
  628.       icon: mdi:currency-eur
  629.       show_last_changed: true
  630.     sensor.house_consumption_total_fora_de_vazio:
  631.       icon: mdi:circle
  632.     sensor.house_consumption_total_vazio:
  633.       icon: mdi:circle-outline
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement