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

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

[进阶教程] ESPHOME接入培正电表

  [复制链接]

1

主题

50

帖子

195

积分

注册会员

Rank: 2

积分
195
金钱
144
HASS币
0
发表于 2021-5-2 18:37:10 | 显示全部楼层
本帖最后由 kingmos 于 2021-5-2 19:07 编辑

本人属于小白,属于照着前辈脚印画瓢的


esp01s这么写的:
substitutions:
  device_name: masterpower  #设备名称
  wifi_ssid: "Ki6666te"    #WiFi_SSID名称
  wifi_password: "k6666g"    #WiFi密码
  wifi_ssid_AP: "ESPHOME"  
  wifi_password_AP: "ki6666g"  #ap_WiFi密码
  wifi_fast_connect: "true"   #如果SSID是隐藏的,设置为true
  wifi_reboot_timeout: 180s  #WiFi离线多久后重启设备,秒s/分钟min/小时h,不需要此功能设置为0s
  ota_password: "k6666g"    #OTA密码
  api_reboot_timeout: 600s  #与客户端(如Home Assistant)失去连接多久后重启设备,秒s/分钟min/小时h,不需要此功能设置为0s


esphome:
  name: $device_name
  platform: ESP8266
  board: esp01_1m

api:
  reboot_timeout: $api_reboot_timeout
ota:
captive_portal:

logger:
web_server:
wifi:
  ssid: $wifi_ssid
  password: $wifi_password
  manual_ip:
    static_ip: 192.168.111.216 ###根据你路由器地址,设置一个固定IP
    gateway: 192.168.110.1 ###根据你路由器网段填写
    subnet: 255.255.254.0  
  reboot_timeout: $wifi_reboot_timeout
  power_save_mode: none
  fast_connect: $wifi_fast_connect
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: $wifi_ssid_AP
    password: $wifi_password_AP



uart:
  tx_pin: GPIO1
  rx_pin: GPIO3
  baud_rate: 9600
  stop_bits: 1

sensor:
  - platform: pzemac
    current:
      name: "${device_name}_Current"
    voltage:
      name: "${device_name}_Voltage"
    power:
      name: "${device_name}_Power"
    energy:
      name: "${device_name}_Energy"
    frequency:
      name: "${device_name}_Frequency"
    power_factor:
      name: "${device_name}_PowerFactor"
    update_interval: 60s


log是这样的:
INFO Reading configuration config/masterpower.yaml...
INFO Starting log output from 192.168.111.216 using esphome API
INFO Connecting to 192.168.111.216:6053 (192.168.111.216)
INFO Successfully connected to 192.168.111.216
[18:19:46][I][app:105]: ESPHome version 1.16.2 compiled on May  1 2021, 00:08:20
[18:19:46][C][wifi:443]: WiFi:
[18:19:46][C][wifi:303]:   SSID: [redacted]
[18:19:46][C][wifi:304]:   IP Address: 192.168.111.216
[18:19:46][C][wifi:306]:   BSSID: [redacted]
[18:19:46][C][wifi:307]:   Hostname: 'masterpower'
[18:19:46][C][wifi:311]:   Signal strength: -32 dB ▂▄▆█
[18:19:46][C][wifi:315]:   Channel: 1
[18:19:46][C][wifi:316]:   Subnet: 255.255.254.0
[18:19:46][C][wifi:317]:   Gateway: 192.168.110.1
[18:19:46][C][wifi:318]:   DNS1: (IP unset)
[18:19:46][C][wifi:319]:   DNS2: (IP unset)
[18:19:46][C][uart_esp8266:075]: UART Bus:
[18:19:46][C][uart_esp8266:077]:   TX Pin: GPIO1
[18:19:46][C][uart_esp8266:080]:   RX Pin: GPIO3
[18:19:46][C][uart_esp8266:081]:   RX Buffer Size: 256
[18:19:46][C][uart_esp8266:083]:   Baud Rate: 9600 baud
[18:19:46][C][uart_esp8266:084]:   Data Bits: 8
[18:19:46][C][uart_esp8266:085]:   Parity: NONE
[18:19:46][C][uart_esp8266:086]:   Stop bits: 1
[18:19:46][C][uart_esp8266:088]:   Using hardware serial interface.
[18:19:46][W][uart:041]:   You're using the same serial port for logging and the UART component. Please disable logging over the serial port by setting logger->baud_rate to 0.
[18:19:46][C][modbus:096]: Modbus:
[18:19:46][E][uart:054]:   Invalid stop bits: Integration requested stop_bits 2 but you have 1!
[18:19:46][C][logger:185]: Logger:
[18:19:46][C][logger:186]:   Level: DEBUG
[18:19:46][C][logger:187]:   Log Baud Rate: 115200
[18:19:46][C][logger:188]:   Hardware UART: UART0
[18:19:46][C][pzemac:068]: PZEMAC:
[18:19:46][C][pzemac:069]:   Address: 0x01
[18:19:46][C][pzemac:070]: Voltage 'masterpower_Voltage'
[18:19:46][C][pzemac:070]:   Unit of Measurement: 'V'
[18:19:46][C][pzemac:070]:   Accuracy Decimals: 1
[18:19:46][C][pzemac:070]:   Icon: 'mdi:flash'
[18:19:46][C][pzemac:071]: Current 'masterpower_Current'
[18:19:46][C][pzemac:071]:   Unit of Measurement: 'A'
[18:19:46][C][pzemac:071]:   Accuracy Decimals: 3
[18:19:46][C][pzemac:071]:   Icon: 'mdi:current-ac'
[18:19:46][C][pzemac:072]: Power 'masterpower_Power'
[18:19:46][C][pzemac:072]:   Unit of Measurement: 'W'
[18:19:46][C][pzemac:072]:   Accuracy Decimals: 1
[18:19:46][C][pzemac:072]:   Icon: 'mdi:power'
[18:19:46][C][pzemac:073]: Energy 'masterpower_Energy'
[18:19:46][C][pzemac:073]:   Unit of Measurement: 'KwH'
[18:19:46][C][pzemac:073]:   Accuracy Decimals: 1
[18:19:46][C][pzemac:073]:   Icon: 'mdi:power'
[18:19:46][C][pzemac:074]: Frequency 'masterpower_Frequency'
[18:19:46](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[18:19:46](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[18:19:46](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[18:19:46](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[18:19:46](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[18:19:46](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[18:19:46][C][pzemac:075]:   Icon: 'mdi:flash'
[18:19:46][C][captive_portal:169]: Captive Portal:
[18:19:46][C][web_server:132]: Web Server:
[18:19:46][C][web_server:133]:   Address: 192.168.111.216:80
[18:19:47][C][ota:029]: Over-The-Air Updates:
[18:19:47][C][ota:030]:   Address: 192.168.111.216:8266
[18:19:47][C][api:095]: API Server:
[18:19:47][C][api:096]:   Address: 192.168.111.216:6053

1.现在还读不到数据,看来是esp有问题,应该怎么写呢?
2.[W][uart:041]:   You're using the same serial port for logging and the UART component. Please disable logging over the serial port by setting logger->baud_rate to 0.
串口很忙吗,日志数据都读串口是不是没啥问题
3.[18:32:04][E][uart:054]:   Invalid stop bits: Integration requested stop_bits 2 but you have 1!
停止位是啥意思?
4.Message skipped because it was too big to fit in TCP buffer - This is only cosmetic
这是啥意思?
回复

使用道具 举报

1

主题

50

帖子

195

积分

注册会员

Rank: 2

积分
195
金钱
144
HASS币
0
发表于 2021-5-2 18:41:12 | 显示全部楼层
[18:34:51](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[18:34:51](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[18:34:51](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[18:34:51](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[18:34:51](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[18:34:51](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[18:34:51](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[18:34:51][C][ota:030]:   Address: 192.168.111.216:8266
[18:34:51][C][api:095]: API Server:
[18:34:51][C][api:096]:   Address: 192.168.111.216:6053
[18:34:55][D][pzemac:049]: PZEM AC: V=223.8 V, I=0.035 A, P=0.8 W,  en=0.0 Wh, F=50.0 Hz, PF=0.10
[18:34:55][D][sensor:092]: 'masterpower_Voltage': Sending state 223.80000 V with 1 decimals of accuracy
[18:34:55][D][sensor:092]: 'masterpower_Current': Sending state 0.03500 A with 3 decimals of accuracy
[18:34:55][D][sensor:092]: 'masterpower_Power': Sending state 0.80000 W with 1 decimals of accuracy
[18:34:55][D][sensor:092]: 'masterpower_Energy': Sending state 0.00200 KwH with 1 decimals of accuracy
[18:34:55][D][sensor:092]: 'masterpower_Frequency': Sending state 50.00000 Hz with 1 decimals of accuracy
[18:34:55][D][sensor:092]: 'masterpower_PowerFactor': Sending state 0.10000  with 2 decimals of accuracy
[18:35:55][D][pzemac:049]: PZEM AC: V=223.3 V, I=0.035 A, P=0.8 W,  en=0.0 Wh, F=50.0 Hz, PF=0.10
[18:35:55][D][sensor:092]: 'masterpower_Voltage': Sending state 223.30000 V with 1 decimals of accuracy
[18:35:55][D][sensor:092]: 'masterpower_Current': Sending state 0.03500 A with 3 decimals of accuracy
[18:35:55][D][sensor:092]: 'masterpower_Power': Sending state 0.80000 W with 1 decimals of accuracy
[18:35:55][D][sensor:092]: 'masterpower_Energy': Sending state 0.00200 KwH with 1 decimals of accuracy
[18:35:55][D][sensor:092]: 'masterpower_Frequency': Sending state 50.00000 Hz with 1 decimals of accuracy
[18:35:55][D][sensor:092]: 'masterpower_PowerFactor': Sending state 0.10000  with 2 decimals of accuracy
[18:36:55][D][pzemac:049]: PZEM AC: V=223.2 V, I=0.035 A, P=0.8 W,  en=0.0 Wh, F=50.0 Hz, PF=0.10
[18:36:55][D][sensor:092]: 'masterpower_Voltage': Sending state 223.20000 V with 1 decimals of accuracy
[18:36:55][D][sensor:092]: 'masterpower_Current': Sending state 0.03500 A with 3 decimals of accuracy
[18:36:55][D][sensor:092]: 'masterpower_Power': Sending state 0.80000 W with 1 decimals of accuracy
[18:36:55][D][sensor:092]: 'masterpower_Energy': Sending state 0.00200 KwH with 1 decimals of accuracy
[18:36:55][D][sensor:092]: 'masterpower_Frequency': Sending state 50.00000 Hz with 1 decimals of accuracy
[18:36:55][D][sensor:092]: 'masterpower_PowerFactor': Sending state 0.10000  with 2 decimals of accuracy
[18:37:55][D][pzemac:049]: PZEM AC: V=223.3 V, I=0.035 A, P=0.8 W,  en=0.0 Wh, F=49.9 Hz, PF=0.10
[18:37:55][D][sensor:092]: 'masterpower_Voltage': Sending state 223.30000 V with 1 decimals of accuracy
[18:37:55][D][sensor:092]: 'masterpower_Current': Sending state 0.03500 A with 3 decimals of accuracy
[18:37:55][D][sensor:092]: 'masterpower_Power': Sending state 0.80000 W with 1 decimals of accuracy
[18:37:55][D][sensor:092]: 'masterpower_Energy': Sending state 0.00200 KwH with 1 decimals of accuracy
[18:37:55][D][sensor:092]: 'masterpower_Frequency': Sending state 49.90000 Hz with 1 decimals of accuracy
[18:37:55][D][sensor:092]: 'masterpower_PowerFactor': Sending state 0.10000  with 2 decimals of accuracy
[18:38:55][D][pzemac:049]: PZEM AC: V=223.4 V, I=0.035 A, P=0.8 W,  en=0.0 Wh, F=49.9 Hz, PF=0.10
[18:38:55][D][sensor:092]: 'masterpower_Voltage': Sending state 223.39999 V with 1 decimals of accuracy
[18:38:55][D][sensor:092]: 'masterpower_Current': Sending state 0.03500 A with 3 decimals of accuracy
[18:38:55][D][sensor:092]: 'masterpower_Power': Sending state 0.80000 W with 1 decimals of accuracy
[18:38:55][D][sensor:092]: 'masterpower_Energy': Sending state 0.00200 KwH with 1 decimals of accuracy
[18:38:55][D][sensor:092]: 'masterpower_Frequency': Sending state 49.90000 Hz with 1 decimals of accuracy
[18:38:55][D][sensor:092]: 'masterpower_PowerFactor': Sending state 0.10000  with 2 decimals of accuracy


咦,之前怎么也不行,刚重新刷新就出来了。。。
但上面的警告和错误还在的
回复

使用道具 举报

8

主题

86

帖子

910

积分

论坛DIY达人

积分
910
金钱
824
HASS币
10
发表于 2021-8-3 08:44:34 | 显示全部楼层
学习学习
回复

使用道具 举报

0

主题

5

帖子

28

积分

新手上路

Rank: 1

积分
28
金钱
23
HASS币
0
发表于 2021-9-4 22:03:20 | 显示全部楼层
学习学习
回复

使用道具 举报

3

主题

91

帖子

1038

积分

金牌会员

Rank: 6Rank: 6

积分
1038
金钱
947
HASS币
0
发表于 2021-9-15 10:16:10 | 显示全部楼层
66666666666666
回复

使用道具 举报

3

主题

45

帖子

961

积分

高级会员

Rank: 4

积分
961
金钱
916
HASS币
0
发表于 2021-9-18 19:59:09 | 显示全部楼层
学习一下
回复

使用道具 举报

0

主题

37

帖子

575

积分

高级会员

Rank: 4

积分
575
金钱
538
HASS币
0
发表于 2021-10-3 19:05:41 | 显示全部楼层
研究研究
回复

使用道具 举报

0

主题

48

帖子

419

积分

中级会员

Rank: 3Rank: 3

积分
419
金钱
371
HASS币
0
发表于 2021-10-4 09:55:38 | 显示全部楼层
學習學習
回复

使用道具 举报

0

主题

23

帖子

517

积分

高级会员

Rank: 4

积分
517
金钱
494
HASS币
0
发表于 2021-10-9 23:19:27 | 显示全部楼层
右胆大包天圧
回复

使用道具 举报

1

主题

37

帖子

687

积分

高级会员

Rank: 4

积分
687
金钱
650
HASS币
0
发表于 2021-10-9 23:36:33 | 显示全部楼层
学习了 感谢分享
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-5-6 17:28 , Processed in 0.632439 second(s), 30 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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