『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
楼主: dscao

[经验分享] 电表接入后(阶梯+峰谷)电费算法的改进

  [复制链接]

77

主题

1391

帖子

2万

积分

元老级技术达人

积分
24331
金钱
22900
HASS币
290
 楼主| 发表于 2020-8-26 21:48:25 | 显示全部楼层
为什么今天无法回复或者发布内容呢?
回复

使用道具 举报

77

主题

1391

帖子

2万

积分

元老级技术达人

积分
24331
金钱
22900
HASS币
290
 楼主| 发表于 2020-8-26 22:40:53 | 显示全部楼层
内容稍微长一点提交就:
500 Internal Server Error
nginx
回复

使用道具 举报

77

主题

1391

帖子

2万

积分

元老级技术达人

积分
24331
金钱
22900
HASS币
290
 楼主| 发表于 2020-8-27 09:50:38 | 显示全部楼层
本帖最后由 dscao 于 2020-8-27 09:53 编辑

可放到packages下的dianbiao.yaml中:

----20200826更新

004.jpg

今日、昨日、本月、上月、今年、去年+峰电量、谷电量+峰电费、谷电费各项数据显示,不需要influxdb:
sensor:
#系统日期和时间
- platform: time_date
display_options:
- 'time'
- 'date'
- 'date_time'

#电表时间传感器
- platform: mqtt
name: "shijian"
state_topic: "tele/electric/SENSOR"
qos: 1
#unit_of_measurement: "V"
value_template: "{{ value_json['Time'] }}"

#电压传感器
- platform: mqtt
name: "dianya"
state_topic: "tele/electric/SENSOR"
qos: 1
unit_of_measurement: "V"
value_template: "{{ value_json['ENERGY'].Voltage }}"
#value_template: "{{ value_json.Voltage }}"

#电流传感器
- platform: mqtt
name: "dianliu"
state_topic: "tele/electric/SENSOR"
qos: 1
unit_of_measurement: "A"
value_template: "{{ value_json['ENERGY'].Current }}"
#value_template: "{{ value_json.Current }}"

#功率传感器
- platform: mqtt
name: "gonglv"
state_topic: "tele/electric/SENSOR"
qos: 1
unit_of_measurement: "W"
value_template: "{{ value_json['ENERGY'].Power }}"
#value_template: "{{ value_json.Power }}"

#功率因数传感器
- platform: mqtt
name: "gonglvyinshu"
state_topic: "tele/electric/SENSOR"
qos: 1
unit_of_measurement: "cosΦ"
value_template: "{{ value_json['ENERGY'].Factor }}"
#value_template: "{{ value_json.Factor }}"

#今日电量
- platform: mqtt
name: "jinri_dianliang"
state_topic: "tele/electric/SENSOR"
qos: 1
unit_of_measurement: "kWh"
value_template: "{{ value_json['ENERGY'].Today }}"
#value_template: "{{ value_json.Today }}"

#今日电费(不执行峰谷(跨阶梯时不准))
- platform: template
sensors:
jinri_dianfei:
value_template: >
{% if now().month in [1,3,5,7,8,10,12] %}
{% set date = (31 - now().day) %}
{% elif now().month in [4,6,9,11] %}
{% set date = (30 - now().day) %}
{% elif now().month == 2 and ((now().year-2000) % 4 > 0) %}
{% set date = (28 - now().day) %}
{% elif now().month == 2 and ((now().year-2000) % 4 == 0) %}
{% set date = (29 - now().day) %}
{% endif %}
{% if (date != 0 and (states("sensor.electric") | float - states("sensor.jinri_dianliang") | float + (states("sensor.zuori_dianliang") | float * (date + 1))) | int > 4200) or (date == 0 and states("sensor.electric") | int > 4200) %}
{{(states("sensor.jinri_dianliang") | float * 0.8653) | round(2)}}
{% elif (date != 0 and (states("sensor.electric") | float - states("sensor.jinri_dianliang") | float + (states("sensor.zuori_dianliang") | float * (date + 1))) | int > 2160) or (date == 0 and states("sensor.electric") | int > 2160) %}
{{(states("sensor.jinri_dianliang") | float * 0.6153) | round(2)}}
{% else %}
{{(states("sensor.jinri_dianliang") | float * 0.5653) | round(2)}}
{% endif %}
unit_of_measurement: "RMB"

#昨天用电量
- platform: mqtt
name: "zuori_dianliang"
state_topic: "tele/electric/SENSOR"
qos: 1
unit_of_measurement: "kWh"
value_template: "{{ value_json['ENERGY'].Yesterday }}"
#value_template: "{{ value_json.Yesterday }}"

#昨日电费(不执行峰谷(跨阶梯时不准))
- platform: template
sensors:
zuori_dianfei:
value_template: >
{% if now().month in [1,3,5,7,8,10,12] %}
{% set date = (31 - now().day) %}
{% elif now().month in [4,6,9,11] %}
{% set date = (30 - now().day) %}
{% elif now().month == 2 and ((now().year-2000) % 4 > 0) %}
{% set date = (28 - now().day) %}
{% elif now().month == 2 and ((now().year-2000) % 4 == 0) %}
{% set date = (29 - now().day) %}
{% endif %}
{% if (date != 0 and (states("sensor.electric") | float - states("sensor.jinri_dianliang") | float + (states("sensor.zuori_dianliang") | float * (date + 1))) | int > 4200) or (date == 0 and states("sensor.electric") | int > 4200) %}
{{(states("sensor.zuori_dianliang") | float * 0.8653) | round(2)}}
{% elif (date != 0 and (states("sensor.electric") | float - states("sensor.jinri_dianliang") | float + (states("sensor.zuori_dianliang") | float * (date + 1))) | int > 2160) or (date == 0 and states("sensor.electric") | int > 2160) %}
{{(states("sensor.zuori_dianliang") | float * 0.6153) | round(2)}}
{% else %}
{{(states("sensor.zuori_dianliang") | float * 0.5653) | round(2)}}
{% endif %}
unit_of_measurement: "RMB"

#总用电量 
- platform: mqtt
name: "electric"
state_topic: "tele/electric/SENSOR"
qos: 1
unit_of_measurement: "kWh"
value_template: "{{ value_json['ENERGY'].Total }}"
#value_template: "{{ value_json.Total }}"

#总用电量统计开始时间
- platform: mqtt
name: "totalstarttime"
state_topic: "tele/electric/SENSOR"
qos: 1
value_template: "{{ value_json['ENERGY'].TotalStartTime }}"
#value_template: "{{ value_json.Total }}"

#总电费(不执行峰谷)
- platform: template
sensors:
zongdianfei:
value_template: >
{% if (states("sensor.electric") | int > 4200) %}
{{(((states("sensor.electric")-4200) | float * 0.8653) + (4200-2160) * 0.6153 + 2160 * 0.5653) | round(2)}}
{% elif (states("sensor.electric") | int > 2160) %}
{{(((states("sensor.electric")-2160) | float * 0.6153) + 2160 * 0.5653) | round(2)}}
{% else %}
{{(states("sensor.electric") | float * 0.5653) | round(2)}}
{% endif %}
unit_of_measurement: "RMB"



- platform: template
sensors:
dang_qian_jie_ti:
value_template: >
{% if states("sensor.energy") | float <= 2160 %}
1
{% elif states("sensor.energy") | float >2160 and states("sensor.energy") | float <= 4200 %}
2
{% elif states("sensor.energy") | float > 4200 %}
3
{% else %}
4
{% endif %}
friendly_name: '当前阶梯'
unit_of_measurement: "L"


- platform: template
sensors:
jin_ri_fen_dianliang:
value_template: >
{{(states("sensor.daily_energy_peak") | float + states("sensor.daily_energy_peak2l") | float + states("sensor.daily_energy_peak3l") | float )| round(3)}}
friendly_name: '今日峰电量'
unit_of_measurement: "kWh"
icon_template: mdi:finance

- platform: template
sensors:
jin_ri_gu_dianliang:
value_template: >
{{(states("sensor.daily_energy_offpeak") | float + states("sensor.daily_energy_offpeak2l") | float + states("sensor.daily_energy_offpeak3l") | float )| round(3)}}
friendly_name: '今日谷电量'
unit_of_measurement: "kWh"
icon_template: mdi:finance


- platform: template
sensors:
ben_yue_fen_dianliang:
value_template: >
{{(states("sensor.monthly_energy_peak") | float + states("sensor.monthly_energy_peak2l") | float + states("sensor.monthly_energy_peak3l") | float )| round(3)}}
friendly_name: '本月峰电量'
unit_of_measurement: "kWh"
icon_template: mdi:finance

- platform: template
sensors:
ben_yue_gu_dianliang:
value_template: >
{{(states("sensor.monthly_energy_offpeak") | float + states("sensor.monthly_energy_offpeak2l") | float + states("sensor.monthly_energy_offpeak3l") | float )| round(3)}}
friendly_name: '本月谷电量'
unit_of_measurement: "kWh"
icon_template: mdi:finance

- platform: template
sensors:
jin_nian_fen_dianliang:
value_template: >
{{(states("sensor.yearly_energy_peak") | float + states("sensor.yearly_energy_peak2l") | float + states("sensor.yearly_energy_peak3l") | float )| round(3)}}
friendly_name: '今年峰电量'
unit_of_measurement: "kWh"
icon_template: mdi:finance

- platform: template
sensors:
jin_nian_gu_dianliang:
value_template: >
{{(states("sensor.yearly_energy_offpeak") | float + states("sensor.yearly_energy_offpeak2l") | float + states("sensor.yearly_energy_offpeak3l") | float )| round(3)}}
friendly_name: '今年谷电量'
unit_of_measurement: "kWh"
icon_template: mdi:finance


- platform: template
sensors:
zuo_ri_fen_dianliang:
value_template: >
{{(state_attr("sensor.daily_energy_peak","last_period") | float + state_attr("sensor.daily_energy_peak2l","last_period") | float + state_attr("sensor.daily_energy_peak3l","last_period") | float )| round(3)}}
friendly_name: '昨日峰电量'
unit_of_measurement: "kWh"
icon_template: mdi:finance

- platform: template
sensors:
zuo_ri_gu_dianliang:
value_template: >
{{(state_attr("sensor.daily_energy_offpeak","last_period") | float + state_attr("sensor.daily_energy_offpeak2l","last_period") | float + state_attr("sensor.daily_energy_offpeak3l","last_period") | float )| round(3)}}
friendly_name: '昨日谷电量'
unit_of_measurement: "kWh"
icon_template: mdi:finance


- platform: template
sensors:
shan_yue_fen_dianliang:
value_template: >
{{(state_attr("sensor.monthly_energy_peak","last_period") | float + state_attr("sensor.monthly_energy_peak2l","last_period") | float + state_attr("sensor.monthly_energy_peak3l","last_period") | float )| round(3)}}
friendly_name: '上月峰电量'
unit_of_measurement: "kWh"
icon_template: mdi:finance

- platform: template
sensors:
shan_yue_gu_dianliang:
value_template: >
{{(state_attr("sensor.monthly_energy_offpeak","last_period") | float + state_attr("sensor.monthly_energy_offpeak2l","last_period") | float + state_attr("sensor.monthly_energy_offpeak3l","last_period") | float )| round(3)}}
friendly_name: '上月谷电量'
unit_of_measurement: "kWh"
icon_template: mdi:finance

- platform: template
sensors:
qu_nian_fen_dianliang:
value_template: >
{{(state_attr("sensor.yearly_energy_peak","last_period") | float + state_attr("sensor.yearly_energy_peak2l","last_period") | float + state_attr("sensor.yearly_energy_peak3l","last_period") | float )| round(3)}}
friendly_name: '去年峰电量'
unit_of_measurement: "kWh"
icon_template: mdi:finance

- platform: template
sensors:
qu_nian_gu_dianliang:
value_template: >
{{(state_attr("sensor.yearly_energy_offpeak","last_period") | float + state_attr("sensor.yearly_energy_offpeak2l","last_period") | float + state_attr("sensor.yearly_energy_offpeak3l","last_period") | float )| round(3)}}
friendly_name: '去年谷电量'
unit_of_measurement: "kWh"
icon_template: mdi:finance


- platform: template
sensors:
zuo_ri_fen_dian_fei:
value_template: >
{{(state_attr("sensor.daily_energy_peak","last_period") | float * 0.5953 + state_attr("sensor.daily_energy_peak2l","last_period") | float * 0.6453 + state_attr("sensor.daily_energy_peak3l","last_period") | float * 0.8953 )| round(2)}}
friendly_name: '昨日峰电费'
unit_of_measurement: "RMB"
icon_template: mdi:currency-cny

- platform: template
sensors:
zuo_ri_gu_dian_fei:
value_template: >
{{(state_attr("sensor.daily_energy_offpeak","last_period") | float * 0.3153 + state_attr("sensor.daily_energy_offpeak2l","last_period") | float * 0.3653 + state_attr("sensor.daily_energy_offpeak3l","last_period") | float * 0.6153 )| round(2)}}
friendly_name: '昨日谷电费'
unit_of_measurement: "RMB"
icon_template: mdi:currency-cny

- platform: template
sensors:
zuo_ri_zong_dian_fei:
value_template: >
{{(states("sensor.zuo_ri_fen_dian_fei")|float + states("sensor.zuo_ri_gu_dian_fei")|float) | round(2)}}
unit_of_measurement: "RMB"
friendly_name: '昨日总电费'
icon_template: mdi:currency-cny

- platform: template
sensors:
shan_yue_fen_dian_fei:
value_template: >
{{(state_attr("sensor.monthly_energy_peak","last_period") | float * 0.5953 + state_attr("sensor.monthly_energy_peak2l","last_period") | float * 0.6453 + state_attr("sensor.monthly_energy_peak3l","last_period") | float * 0.8953 )| round(2)}}
friendly_name: '上月峰电费'
unit_of_measurement: "RMB"
icon_template: mdi:currency-cny

- platform: template
sensors:
shan_yue_gu_dian_fei:
value_template: >
{{(state_attr("sensor.monthly_energy_offpeak","last_period") | float * 0.3153 + state_attr("sensor.monthly_energy_offpeak2l","last_period") | float * 0.3653 + state_attr("sensor.monthly_energy_offpeak3l","last_period") | float * 0.6153 )| round(2)}}
friendly_name: '上月谷电费'
unit_of_measurement: "RMB"
icon_template: mdi:currency-cny

- platform: template
sensors:
shan_yue_zong_dian_fei:
value_template: >
{{(states("sensor.shan_yue_fen_dian_fei")|float + states("sensor.shan_yue_gu_dian_fei")|float) | round(2)}}
unit_of_measurement: "RMB"
friendly_name: '上月总电费'
icon_template: mdi:currency-cny


- platform: template
sensors:
qu_nian_fen_dian_fei:
value_template: >
{{(state_attr("sensor.yearly_energy_peak","last_period") | float * 0.5953 + state_attr("sensor.yearly_energy_peak2l","last_period") | float * 0.6453 + state_attr("sensor.yearly_energy_peak3l","last_period") | float * 0.8953 )| round(2)}}
friendly_name: '去年峰电费'
unit_of_measurement: "RMB"
icon_template: mdi:currency-cny

- platform: template
sensors:
qu_nian_gu_dian_fei:
value_template: >
{{(state_attr("sensor.yearly_energy_offpeak","last_period") | float * 0.3153 + state_attr("sensor.yearly_energy_offpeak2l","last_period") | float * 0.3653 + state_attr("sensor.yearly_energy_offpeak3l","last_period") | float * 0.6153 )| round(2)}}
friendly_name: '去年谷电费'
unit_of_measurement: "RMB"
icon_template: mdi:currency-cny

- platform: template
sensors:
qu_nian_zong_dian_fei:
value_template: >
{{(states("sensor.qu_nian_fen_dian_fei")|float + states("sensor.qu_nian_gu_dian_fei")|float) | round(2)}}
unit_of_measurement: "RMB"
friendly_name: '去年总电费'
icon_template: mdi:currency-cny


#今日峰电费
- platform: template
sensors:
jin_ri_fen_dian_fei:
value_template: >
{{((states("sensor.daily_energy_peak") | float * 0.5953) + (states("sensor.daily_energy_peak2l") | float * 0.6453) + (states("sensor.daily_energy_peak2l") | float * 0.8953)) | round(2)}}
friendly_name: '今日峰电费'
unit_of_measurement: "RMB"
icon_template: mdi:currency-cny

#今日谷电费
- platform: template
sensors:
jin_ri_gu_dian_fei:
value_template: >
{{((states("sensor.daily_energy_offpeak") | float * 0.3153) + (states("sensor.daily_energy_offpeak2l") | float * 0.3653) + (states("sensor.daily_energy_offpeak2l") | float * 0.6153)) | round(2)}}
friendly_name: '今日谷电费'
unit_of_measurement: "RMB"
icon_template: mdi:currency-cny

#今日总电费
- platform: template
sensors:
jin_ri_zong_dian_fei:
value_template: >
{{(states("sensor.jin_ri_fen_dian_fei")|float + states("sensor.jin_ri_gu_dian_fei")|float) | round(2)}}
unit_of_measurement: "RMB"
friendly_name: '今日总电费'
icon_template: mdi:currency-cny

#本月峰电费
- platform: template
sensors:
ben_yue_fen_dian_fei:
value_template: >
{{((states("sensor.monthly_energy_peak") | float * 0.5953) + (states("sensor.monthly_energy_peak2l") | float * 0.6453) + (states("sensor.monthly_energy_peak2l") | float * 0.8953)) | round(2)}}
friendly_name: '本月峰电费'
unit_of_measurement: "RMB"
icon_template: mdi:currency-cny

#本月谷电费
- platform: template
sensors:
ben_yue_gu_dian_fei:
value_template: >
{{((states("sensor.monthly_energy_offpeak") | float * 0.3153) + (states("sensor.monthly_energy_offpeak2l") | float * 0.3653) + (states("sensor.monthly_energy_offpeak2l") | float * 0.6153)) | round(2)}}
friendly_name: '本月谷电费'
unit_of_measurement: "RMB"
icon_template: mdi:currency-cny

#本月总电费
- platform: template
sensors:
ben_yue_zong_dian_fei:
value_template: >
{{(states("sensor.ben_yue_fen_dian_fei")|float + states("sensor.ben_yue_gu_dian_fei")|float) | round(2)}}
unit_of_measurement: "RMB"
friendly_name: '本月总电费'
icon_template: mdi:currency-cny


#今年峰电费
- platform: template
sensors:
jin_nian_fen_dian_fei:
value_template: >
{{((states("sensor.yearly_energy_peak") | float * 0.5953) + (states("sensor.yearly_energy_peak2l") | float * 0.6453) + (states("sensor.yearly_energy_peak2l") | float * 0.8953)) | round(2)}}
friendly_name: '今年峰电费'
unit_of_measurement: "RMB"
icon_template: mdi:currency-cny

#今年谷电费
- platform: template
sensors:
jin_nian_gu_dian_fei:
value_template: >
{{((states("sensor.yearly_energy_offpeak") | float * 0.3153) + (states("sensor.yearly_energy_offpeak2l") | float * 0.3653) + (states("sensor.yearly_energy_offpeak2l") | float * 0.6153)) | round(2)}}
friendly_name: '今年谷电费'
unit_of_measurement: "RMB"
icon_template: mdi:currency-cny

#今年总电费
- platform: template
sensors:
jin_nian_zong_dian_fei:
value_template: >
{{(states("sensor.jin_nian_fen_dian_fei")|float + states("sensor.jin_nian_gu_dian_fei")|float) | round(2)}}
unit_of_measurement: "RMB"
friendly_name: '今年总电费'
icon_template: mdi:currency-cny



utility_meter:
energy:
source: sensor.electric
cycle: yearly

daily_energy:
source: sensor.energy
cycle: daily
tariffs:
- peak
- offpeak
- peak2l
- offpeak2l
- peak3l
- offpeak3l

monthly_energy:
source: sensor.energy
cycle: monthly
tariffs:
- peak
- offpeak
- peak2l
- offpeak2l
- peak3l
- offpeak3l

yearly_energy:
source: sensor.energy
cycle: yearly
tariffs:
- peak
- offpeak
- peak2l
- offpeak2l
- peak3l
- offpeak3l




automation:
#元旦清零电表
- id: 'yuan_dan_qing_ling_dian_biao'
alias: 元旦清零电表
trigger:
- platform: template
value_template: '{{ states("sensor.jinri_dianliang") | round(3) == 0.000 }}'
condition:
- condition: template
value_template: '{{ now().strftime("%m-%d") == "01-01" }}'
action:
- data:
payload: '0'
topic: cmnd/electric/EnergyReset2
service: mqtt.publish
- data:
payload: '0'
topic: cmnd/electric/EnergyReset3
service: mqtt.publish
initial_state: false


- alias: fengshi_peak
trigger:
- platform: time
at: '08:00:00'
action:
- choose:
- conditions:
- condition: state
entity_id: sensor.dang_qian_jie_ti
state: '2'
sequence:
- service: utility_meter.select_tariff
data:
entity_id:
- utility_meter.daily_energy
- utility_meter.monthly_energy
- utility_meter.yearly_energy
tariff: peak2l
- conditions:
- condition: state
entity_id: sensor.dang_qian_jie_ti
state: '3'
sequence:
- service: utility_meter.select_tariff
data:
entity_id:
- utility_meter.daily_energy
- utility_meter.monthly_energy
- utility_meter.yearly_energy
tariff: peak3l
default:
- service: utility_meter.select_tariff
data:
entity_id:
- utility_meter.daily_energy
- utility_meter.monthly_energy
- utility_meter.yearly_energy
tariff: peak

- alias: fengshi_offpeak
trigger:
- platform: time
at: '22:00:00'
action:
- choose:
- conditions:
- condition: state
entity_id: sensor.dang_qian_jie_ti
state: '2'
sequence:
- service: utility_meter.select_tariff
data:
entity_id:
- utility_meter.daily_energy
- utility_meter.monthly_energy
- utility_meter.yearly_energy
tariff: offpeak2l
- conditions:
- condition: state
entity_id: sensor.dang_qian_jie_ti
state: '3'
sequence:
- service: utility_meter.select_tariff
data:
entity_id:
- utility_meter.daily_energy
- utility_meter.monthly_energy
- utility_meter.yearly_energy
tariff: offpeak3l
default:
- service: utility_meter.select_tariff
data:
entity_id:
- utility_meter.daily_energy
- utility_meter.monthly_energy
- utility_meter.yearly_energy
tariff: offpeak

- alias: fengshi_jietishengji
trigger:
- platform: state
entity_id: sensor.dang_qian_jie_ti
from: '1'
to: '2'
- platform: state
entity_id: sensor.dang_qian_jie_ti
from: '2'
to: '3'
action:
- choose:
- conditions:
- condition: state
entity_id: sensor.dang_qian_jie_ti
state: '2'
- condition: time
after: '08:00:00'
before: '22:00:00'
sequence:
- service: utility_meter.select_tariff
data:
entity_id:
- utility_meter.daily_energy
- utility_meter.monthly_energy
- utility_meter.yearly_energy
tariff: peak2l
- conditions:
- condition: state
entity_id: sensor.dang_qian_jie_ti
state: '3'
- condition: time
after: '08:00:00'
before: '22:00:00'
sequence:
- service: utility_meter.select_tariff
data:
entity_id:
- utility_meter.daily_energy
- utility_meter.monthly_energy
- utility_meter.yearly_energy
tariff: peak3l
- conditions:
- condition: state
entity_id: sensor.dang_qian_jie_ti
state: '2'
- condition: time
after: '22:00:00'
before: '08:00:00'
sequence:
- service: utility_meter.select_tariff
data:
entity_id:
- utility_meter.daily_energy
- utility_meter.monthly_energy
- utility_meter.yearly_energy
tariff: offpeak2l
- conditions:
- condition: state
entity_id: sensor.dang_qian_jie_ti
state: '3'
- condition: time
after: '22:00:00'
before: '08:00:00'
sequence:
- service: utility_meter.select_tariff
data:
entity_id:
- utility_meter.daily_energy
- utility_meter.monthly_energy
- utility_meter.yearly_energy
tariff: offpeak3l
default: []



homeassistant:
customize:
sensor.date_time:
friendly_name: 系统时间
sensor.shijian:
friendly_name: 电表时间
icon: mdi:timer
sensor.dianya:
friendly_name: 实时电压
icon: mdi:flash 
sensor.dianliu:
friendly_name: 实时电流
icon: mdi:flash-auto 
sensor.gonglv:
friendly_name: 实时功率
#icon: mdi:wikipedia
icon: mdi:speedometer
sensor.gonglvyinshu:
friendly_name: 功率因数
icon: mdi:flash-red-eye
sensor.jinri_dianliang:
friendly_name: 今日电量
icon: mdi:finance
#icon: 'mdi:chart-bar-stacked'
sensor.jinri_dianfei:
friendly_name: 今日电费(不执行峰谷)
icon: mdi:currency-cny
sensor.zuori_dianliang:
friendly_name: 昨日电量
icon: mdi:finance
#icon: 'mdi:chart-bar-stacked'
sensor.zuori_dianfei:
friendly_name: 昨日电费(不执行峰谷)
icon: mdi:currency-cny
sensor.electric:
friendly_name: 总用电量
#icon: mdi:finance
icon: 'mdi:chart-bar-stacked'
sensor.zongdianfei:
friendly_name: 总电费(不执行峰谷)
icon: mdi:currency-cny
sensor.totalstarttime:
friendly_name: 统计开始时间
icon: mdi:timer
sensor.zuori_dianliang:
friendly_name: 昨日电量
icon: mdi:finance
sensor.zuori_fen_dianliang:
friendly_name: 昨日峰电量
icon: mdi:finance
sensor.zuori_gu_dianliang:
friendly_name: 昨日谷电量
icon: mdi:finance
sensor.shanyue_fen_dianliang:
friendly_name: 上月峰电量
icon: mdi:finance
sensor.shanyue_gu_dianliang:
friendly_name: 上月谷电量
icon: mdi:finance 




ui中显示:

      - entities:
- entity: sensor.date_time
- entity: sensor.shijian
- entity: sensor.dianya
- entity: sensor.dianliu
- entity: sensor.gonglv
- entity: sensor.gonglvyinshu
- entity: sensor.jinri_dianliang
- entity: sensor.zuori_dianliang
- entity: sensor.electric
- entity: sensor.zongdianfei
- entity: sensor.totalstarttime
- entity: automation.yuan_dan_qing_ling_dian_biao
- entity: sensor.zuo_ri_fen_dianliang
- entity: sensor.zuo_ri_gu_dianliang
- entity: sensor.jin_ri_fen_dianliang
- entity: sensor.jin_ri_gu_dianliang
- entity: sensor.ben_yue_fen_dianliang
- entity: sensor.ben_yue_gu_dianliang
- entity: sensor.qu_nian_fen_dianliang
- entity: sensor.qu_nian_gu_dianliang
- entity: sensor.jin_nian_fen_dianliang
- entity: sensor.jin_nian_gu_dianliang
- entity: sensor.dang_qian_jie_ti
- entity: sensor.zuo_ri_fen_dian_fei
- entity: sensor.zuo_ri_gu_dian_fei
- entity: sensor.zuo_ri_zong_dian_fei
- entity: sensor.jin_ri_fen_dian_fei
- entity: sensor.jin_ri_gu_dian_fei
- entity: sensor.jin_ri_zong_dian_fei
- entity: sensor.shan_yue_fen_dian_fei
- entity: sensor.shan_yue_gu_dian_fei
- entity: sensor.shan_yue_zong_dian_fei
- entity: sensor.ben_yue_fen_dian_fei
- entity: sensor.ben_yue_gu_dian_fei
- entity: sensor.ben_yue_zong_dian_fei
- entity: sensor.qu_nian_fen_dian_fei
- entity: sensor.qu_nian_gu_dian_fei
- entity: sensor.qu_nian_zong_dian_fei
- entity: sensor.jin_nian_fen_dian_fei
- entity: sensor.jin_nian_gu_dian_fei
- entity: sensor.jin_nian_zong_dian_fei
show_header_toggle: false
title: 家庭总电表
type: entities



回复

使用道具 举报

9

主题

527

帖子

2350

积分

金牌会员

Rank: 6Rank: 6

积分
2350
金钱
1823
HASS币
0
发表于 2020-9-6 12:04:24 | 显示全部楼层
强帖留名。
回复

使用道具 举报

2

主题

29

帖子

1311

积分

金牌会员

Rank: 6Rank: 6

积分
1311
金钱
1282
HASS币
0
发表于 2020-9-10 09:07:53 | 显示全部楼层
留着备用吧。
回复

使用道具 举报

70

主题

596

帖子

3409

积分

论坛元老

Rank: 8Rank: 8

积分
3409
金钱
2813
HASS币
0
发表于 2020-9-10 20:13:02 | 显示全部楼层
本帖最后由 lrving163 于 2020-9-10 20:14 编辑

一直用tasmota,但老是不准。想换esphome试下。大神,请教下。我只要这个效果,那代码如何写?找了好多教程也没有今日电量和总电量。感谢。 11.jpg
回复

使用道具 举报

3

主题

321

帖子

2891

积分

论坛积极会员

积分
2891
金钱
2570
HASS币
10
发表于 2020-9-14 13:43:57 | 显示全部楼层
lrving163 发表于 2020-9-10 20:13
一直用tasmota,但老是不准。想换esphome试下。大神,请教下。我只要这个效果,那代码如何写?找了好多教程 ...

跟tasmota和esphome的关系不会很大,用电量统计是PZEM自己的,它们只是从PZEM里读了一下数据而已
回复

使用道具 举报

70

主题

596

帖子

3409

积分

论坛元老

Rank: 8Rank: 8

积分
3409
金钱
2813
HASS币
0
发表于 2020-9-14 15:06:00 | 显示全部楼层
tcwj2008 发表于 2020-9-14 13:43
跟tasmota和esphome的关系不会很大,用电量统计是PZEM自己的,它们只是从PZEM里读了一下数据而已 ...

但如何在ESPHOME读出总电量和今天‘昨日电量?
回复

使用道具 举报

3

主题

321

帖子

2891

积分

论坛积极会员

积分
2891
金钱
2570
HASS币
10
发表于 2020-9-14 15:47:40 | 显示全部楼层
lrving163 发表于 2020-9-14 15:06
但如何在ESPHOME读出总电量和今天‘昨日电量?

这些我都是在node-red里算的,node-red里读取存储,以后转存成xls表格,还可以自己做图表分析。esphome好像是pzem的一些原始数据,没有做额外的处理。
回复

使用道具 举报

70

主题

596

帖子

3409

积分

论坛元老

Rank: 8Rank: 8

积分
3409
金钱
2813
HASS币
0
发表于 2020-9-14 16:25:51 | 显示全部楼层
tcwj2008 发表于 2020-9-14 15:47
这些我都是在node-red里算的,node-red里读取存储,以后转存成xls表格,还可以自己做图表分析。espho ...

哦。好的。一直想接触NODE,但老是安装不上。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-25 06:11 , Processed in 0.189112 second(s), 32 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表