Shelly EM - Consumo Total De Casa

olá pessoal. recebi na semana passado o shelly EM com pinça de 50A…

já tenho alguma coisa configurado no HA…mas existem aqui pormenores que gostaria de alterar:

por exemplo adicionei sensores utility meter mas gostaria que mostrasse valores em Kwh.,

gostaria de adicionar um grafico identico ao existente, só que me mostrasse o consumo de casa mes…

PS: Nao sei se as contas que o utility meter faz estão corretas, reparei tambem que ontem 17/01 (Primeiro dia do shelly EM), ao criar o grafico ele adicionou a primeira barra no dia 1…nao deveria estar no dia 17???

Obrigado

esta a minha config:


sensor:

  - platform: mqtt
    name: "Consumo Geral Instantaneo" 
    state_topic: "shellies/shellyem-xxx/emeter/0/power"
    qos: 1
    unit_of_measurement: "W"
    icon: mdi:gauge
    
    
  - platform: mqtt
    name: "Tensão De Entrada" 
    state_topic: "shellies/shellyem-xxx/emeter/0/voltage"
    qos: 1
    unit_of_measurement: "V"
    icon: mdi:chart-line-variant    
    
    
#######

  - platform: sql
    db_url: mysql://xxx:yyy@core-mariadb/custom_data
    queries:
      - name: consumo_geral_casa
        query: >-
          SELECT
              CONCAT(
                  '[',
                  GROUP_CONCAT(DAY(date) SEPARATOR ','),
                  ']'
              ) AS labels,
              CONCAT(
                  '[',
                  GROUP_CONCAT(consumo_energia_diaria_de_casa SEPARATOR ','),
                  ']'
              ) AS data,
              CONCAT(
                  '["',
                    GROUP_CONCAT(IF(`consumo_energia_diaria_de_casa` >= 2.2, 'red', IF(`consumo_energia_diaria_de_casa` < 2.199, 'green', 'orange')) SEPARATOR '","'),
                  '"]'
              ) AS colors,
              ROUND(SUM(consumo_energia_diaria_de_casa), 2) AS total,
              FORMAT(round(((sum(consumo_energia_diaria_de_casa) * 0.1587 + (0.2618*31))*1.23), 2), 2) AS 'total_eur',
              'info in attributes' AS value
          FROM consumo_energia_diaria
          WHERE MONTH(date) = MONTH(CURRENT_DATE);
        column: "value"


    

#########################################
    
utility_meter:
  diario:
    source: sensor.consumo_geral_instantaneo
    cycle: daily

  mensal:
    source: sensor.consumo_geral_instantaneo
    cycle: monthly

########################################


########################################

automation:



  - alias: "Registo Diario - Consumo Geral De Casa"
    initial_state: true
    trigger:
      - platform: state
        entity_id: sensor.diario
    action:
      - service: shell_command.daily_insert_mysql
        data_template:
          table: consumo_energia_diaria 
          value: >
            {{ trigger.to_state.state }}
          column: >
            {% if trigger.entity_id == "sensor.diario" %}
              consumo_energia_diaria_de_casa
            {% endif %}

será que no Shelly EM tambem se aplica isto:???

Pessoal, deixo aqui a minha config que fiz para o meu Shelly EM.
poderá ajudar alguem… :wink:

Este está instalado meu quadro geral de casa, onde está medir todo o consumo que tenho…

sensor:

  - platform: mqtt
    name: "Consumo Geral Instantaneo" 
    state_topic: "shellies/shellyem-E454A0/emeter/0/power"
    qos: 1
    unit_of_measurement: "W"
    icon: mdi:gauge
    
  - platform: mqtt
    name: "Tensão De Entrada" 
    state_topic: "shellies/shellyem-E454A0/emeter/0/voltage"
    qos: 1
    unit_of_measurement: "V"
    icon: mdi:chart-line-variant    
    
  - platform: rest
    name: Registo Total Do Shelly
    resource: http://192.168.100.16/status
    username: 1234
    password: 4321
    authentication: basic
    value_template: '{{ value_json.emeters.0.total | int /1000 }}'
    scan_interval: 300
    unit_of_measurement: W   
    
    
  - platform: template
    sensors:
      registos_mensais:
        friendly_name: Diário | Mensal 
        value_template: "{{ states.sensor.diario.state }} W  |  {{ states.sensor.mensal.state }} W"
                                         
    
    
#######################

  - platform: sql
    db_url: mysql://xxx:yyy@core-mariadb/custom_data
    queries:
      - name: consumo_geral_casa
        query: >-
          SELECT
              CONCAT(
                  '[',
                  GROUP_CONCAT(DAY(date) SEPARATOR ','),
                  ']'
              ) AS labels,
              CONCAT(
                  '[',
                  GROUP_CONCAT(consumo_energia_diaria_de_casa SEPARATOR ','),
                  ']'
              ) AS data,
              CONCAT(
                  '["',
                    GROUP_CONCAT(IF(`consumo_energia_diaria_de_casa` >= 2.2, 'red', IF(`consumo_energia_diaria_de_casa` < 2.199, 'green', 'orange')) SEPARATOR '","'),
                  '"]'
              ) AS colors,
              ROUND(SUM(consumo_energia_diaria_de_casa), 2) AS total,
              FORMAT(round(((sum(consumo_energia_diaria_de_casa) * 0.1587 + (0.2618*31))*1.23), 2), 2) AS 'total_eur',
              'info in attributes' AS value
          FROM consumo_total_energia
          WHERE MONTH(date) = MONTH(CURRENT_DATE);
        column: "value"

######################################################


  - platform: sql
    db_url: mysql://xxx:yyy@core-mariadb/custom_data
    queries:
      - name: Energia Total Mensal
        column: "attributes"
        query: >-
          SELECT
             CONCAT('[', GROUP_CONCAT(`month` ORDER BY `order` SEPARATOR ','), ']') AS labels,
             CONCAT('[', GROUP_CONCAT(`consumo_energia_diaria_de_casa` ORDER BY `order` SEPARATOR ','), ']') AS data,
             'info in attributes' AS 'attributes'
           FROM
           (
          	SELECT
          	  ROUND(SUM(`consumo_energia_diaria_de_casa`), 2) AS 'consumo_energia_diaria_de_casa',
          	  CONCAT('"',MONTHNAME(date), ' ', YEAR(date),'"') AS 'month',
          	  DATE(`date`) AS 'order'
          	FROM `consumo_total_energia`
          	GROUP BY MONTH(`date`), YEAR(`date`)
          	ORDER BY `date` DESC
          	LIMIT 12
          ) AS `something`;
        
        
        
        
    

#########################################
    
utility_meter:
  diario:
    source: sensor.registo_total_do_shelly
    cycle: daily

  mensal:
    source: sensor.registo_total_do_shelly
    cycle: monthly


########################################


########################################

automation:

### REGISTAR VALORES NA BASE DE DADOS

  - alias: "Registo Diario - Consumo Geral De Casa"
    initial_state: true
    trigger:
      - platform: state
        entity_id: sensor.diario
    action:
      - service: shell_command.daily_insert_mysql
        data_template:
          table: consumo_total_energia 
          value: >
            {{ trigger.to_state.state }}
          column: >
            {% if trigger.entity_id == "sensor.diario" %}
              consumo_energia_diaria_de_casa
            {% endif %}

  - title: shelly 
    path: shelly
    badges: []
    cards:
      - cards:
          - cards:
              - entity: sensor.consumo_geral_instantaneo
                max: 1000
                min: 0
                name: Consumo Actual / Instantâneo
                severity:
                  green: 200
                  red: 700
                  yellow: 500
                theme: default
                type: gauge
              - entity: sensor.tensao_de_entrada
                max: 260
                min: 0
                name: Tensão De Entrada
                severity:
                  green: 230
                  red: 270
                  yellow: 250
                theme: default
                type: gauge
            type: horizontal-stack
        type: vertical-stack
      - type: entities
        entities:
          - entity: sensor.registos_mensais
        title: 'Consumo:'
      - chart: bar
        custom_options:
          showLegend: false
        data:
          datasets:
            - backgroundColor: '${states["sensor.consumo_geral_casa"].attributes.colors}'
              borderWidth: 1
              data: '${states["sensor.consumo_geral_casa"].attributes.data}'
              label: Kwh
          labels: '${states["sensor.consumo_geral_casa"].attributes.labels}'
        entity_row: false
        options:
          scales:
            yAxes:
              - ticks:
                  beginAtZero: true
          title:
            display: true
            text: >
              ${"Consumo Geral De Casa - Mês Corrente > " +
              states["sensor.consumo_geral_casa"].attributes.total + " Kwh"}
        type: 'custom:chartjs-card'
      - chart: bar
        custom_options:
          showLegend: false
        data:
          datasets:
            - backgroundColor: '${states["sensor.energia_total_mensal"].attributes.colors}'
              borderWidth: 1
              data: '${states["sensor.energia_total_mensal"].attributes.data}'
              label: Kwh
          labels: '${states["sensor.energia_total_mensal"].attributes.labels}'
        entity_row: false
        options:
          scales:
            yAxes:
              - ticks:
                  beginAtZero: true
          title:
            display: true
            text: |
              Consumo Total Mensal
        type: 'custom:chartjs-card'
      - type: history-graph
        entities:
          - entity: sensor.consumo_geral_instantaneo
        hours_to_show: 24
        refresh_interval: 0

AJUDA:

agora tenho um grafico que me mostra o consumo de todos os dias do mes corrente, mas para o proximo mês este desaparece e comeca um novo…

preciso de ajuda para criar um sensor tipo input select onde me iria mostar o grafico do mes escolhido…

É POSSIVEL?

Obrigado

É possível mas não é neste tópico é no tópico onde seguiste esse tutorial dos gráficos e da base de dados.


Copyright © 2017-2021. Todos os direitos reservados
CPHA.pt - info@cpha.pt


FAQ | Termos de Serviço/Regras | Política de Privacidade