Closed rradar closed 3 years ago
Can't reproduce, I copied the exact config you had above (added upper_devicename substitution too) and don't see that message in the logs.
Do you have multiple UART buses defined in your config? Can you also make sure the firmware you compiled is running on the device? Thanks!
I double checked and have the exact config running.
The only other setting I have regarding uart is that the logger is disabled (actually their is no reason because I use software serial and not the hardware one...):
logger:
baud_rate: 0
Ok, then I don't know what it could be - tried with baud_rate: 0 too here but couldn't replicate.
Could you try opening up the <NODE_NAME>/main.cpp
file and copying all the lines related to uart
(a Ctrl+F/grep for uart is probably enough)
All uart related lines I could find in the main.cpp
using namespace uart;
uart::UARTComponent *uart_uartcomponent;
// logger:
// baud_rate: 0
// logs: {}
// esp8266_store_log_strings_in_flash: true
// tx_buffer_size: 512
// id: logger_logger
// level: DEBUG
// hardware_uart: UART0
logger_logger = new logger::Logger(0, 512, logger::UART_SELECTION_UART0);
logger_logger->pre_setup();
App.register_component(logger_logger);
// uart:
// tx_pin: 14
// rx_pin: 13
// baud_rate: 9600
// stop_bits: 1
// id: uart_uartcomponent
uart_uartcomponent = new uart::UARTComponent();
App.register_component(uart_uartcomponent);
// modbus:
// uart_id: uart_uartcomponent
// id: modbus_modbus
modbus_modbus = new modbus::Modbus();
App.register_component(modbus_modbus);
App.register_component(my_time);
uart_uartcomponent->set_baud_rate(9600);
uart_uartcomponent->set_tx_pin(14);
uart_uartcomponent->set_rx_pin(13);
uart_uartcomponent->set_stop_bits(1);
pzemac_pzemac->set_parent(modbus_modbus);
pzemac_pzemac->set_address(0x01);
modbus_modbus->register_device(pzemac_pzemac);
wifi_info_ssidwifiinfo = new wifi_info::SSIDWiFiInfo();
App.register_component(wifi_info_ssidwifiinfo);
modbus_modbus->set_uart_parent(uart_uartcomponent);
And just checked the log again:
[00:05:00][C][uart:145]: UART Bus:
[00:05:00][C][uart:147]: TX Pin: GPIO14
[00:05:00][C][uart:150]: RX Pin: GPIO13
[00:05:00][C][uart:152]: Baud Rate: 9600 baud
[00:05:00][C][uart:153]: Stop bits: 1
[00:05:00][C][uart:157]: Using software serial
[00:05:00][C][modbus:096]: Modbus:
[00:05:00][E][uart:388]: Invalid stop bits: Integration requested stop_bits 2 but you have 1!
The issue is here:
uart_uartcomponent->set_stop_bits(1);
But I don't understand how that can happen if you have stop_bits: 2
in your config.
If I type in stop_bits: 2
I get the following generated cpp:
uart_uartcomponent->set_stop_bits(2);
I hate to say it but it looks an awful lot like user error to me - please make absolutely sure the config you're compiling contains exactly these lines:
uart:
tx_pin: 14
rx_pin: 13
baud_rate: 9600
stop_bits: 2
I created a new config from the scratch and the error isn't printed anymore when I set:
uart:
tx_pin: 14
rx_pin: 13
baud_rate: 9600
stop_bits: 2
but downside from this configuration is that no readings from the pzem004t v3 happen anymore. All pzem related sensors have a unavailable
in home assistant and doesn't get updated.
Log:
[17:11:17][I][app:100]: ESPHome version 1.14.2 compiled on Nov 17 2019, 17:09:49
[17:11:17][C][wifi:409]: WiFi:
[17:11:17][C][wifi:277]: SSID: '...'
[17:11:17][C][wifi:278]: IP Address: ....
[17:11:17][C][wifi:280]: BSSID: ...
[17:11:17][C][wifi:281]: Hostname: 'mains'
[17:11:17][C][wifi:285]: Signal strength: -14 dB ▂▄▆█
[17:11:17][V][wifi:287]: Priority: 0.0
[17:11:17][C][wifi:289]: Channel: ...
[17:11:17][C][wifi:290]: Subnet: ...
[17:11:17][C][wifi:291]: Gateway: ...
[17:11:17][C][wifi:292]: DNS1: ...
[17:11:17][C][wifi:293]: DNS2: (IP unset)
[17:11:17][V][sensor:013]: 'Mains Total Daily Energy': Received new state 0.000000
[17:11:17][D][sensor:092]: 'Mains Total Daily Energy': Sending state 0.00000 kWh with 3 decimals of accuracy
[17:11:17][C][uart:145]: UART Bus:
[17:11:17][C][uart:147]: TX Pin: GPIO14
[17:11:17][C][uart:150]: RX Pin: GPIO13
[17:11:17][C][uart:152]: Baud Rate: 9600 baud
[17:11:17][C][uart:153]: Stop bits: 2
[17:11:17][C][uart:157]: Using software serial
[17:11:17][C][modbus:096]: Modbus:
[17:11:17][C][uptime.sensor:030]: Uptime Sensor 'Mains Uptime'
[17:11:17][C][uptime.sensor:030]: Unit of Measurement: 's'
[17:11:17][C][uptime.sensor:030]: Accuracy Decimals: 0
[17:11:17][C][uptime.sensor:030]: Icon: 'mdi:timer'
[17:11:17][V][uptime.sensor:030]: Unique ID: '60019485dd1e-uptime'
[17:11:17][C][template.sensor:021]: Template Sensor 'Mains Uptime Days'
[17:11:17][C][template.sensor:021]: Unit of Measurement: 'days'
[17:11:17][C][template.sensor:021]: Accuracy Decimals: 1
[17:11:17][C][template.sensor:021]: Icon: 'mdi:clock-start'
[17:11:17][C][template.sensor:022]: Update Interval: 60.0s
[17:11:17][C][template.text_sensor:020]: Template Sensor 'Mains Hardware'
[17:11:17][C][template.text_sensor:020]: Icon: 'mdi:tag'
[17:11:17][C][logger:175]: Logger:
[17:11:17][C][logger:176]: Level: VERBOSE
[17:11:17][C][logger:177]: Log Baud Rate: 0
[17:11:17][C][logger:178]: Hardware UART: UART0
[17:11:17][C][status:034]: Status Binary Sensor 'Mains Status'
[17:11:17][C][status:034]: Device Class: 'connectivity'
[17:11:17][C][pzemac:061]: PZEMAC:
[17:11:17][C][pzemac:062]: Address: 0x01
[17:11:17][C][pzemac:063]: Voltage 'Mains Voltage'
[17:11:17][C][pzemac:063]: Unit of Measurement: 'V'
[17:11:17][C][pzemac:063]: Accuracy Decimals: 1
[17:11:17][C][pzemac:063]: Icon: 'mdi:flash'
[17:11:17][C][pzemac:064]: Current 'Mains Current'
[17:11:17][C][pzemac:064]: Unit of Measurement: 'A'
[17:11:17][C][pzemac:064]: Accuracy Decimals: 3
[17:11:17][C][pzemac:064]: Icon: 'mdi:current-ac'
[17:11:17][C][pzemac:065]: Power 'Mains Power'
[17:11:17][C][pzemac:065]: Unit of Measurement: 'W'
[17:11:17][C][pzemac:065]: Accuracy Decimals: 1
[17:11:17][C][pzemac:065]: Icon: 'mdi:power'
[17:11:17][C][pzemac:066]: Frequency 'Mains Frequency'
[17:11:17][C][pzemac:066]: Unit of Measurement: 'hz'
[17:11:17][C][pzemac:066]: Accuracy Decimals: 1
[17:11:17][C][pzemac:066]: Icon: 'mdi:current-ac'
[17:11:17](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[17:11:17](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[17:11:17](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[17:11:17](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[17:11:17][C][total_daily_energy:022]: Total Daily Energy 'Mains Total Daily Energy'
[17:11:17][C][total_daily_energy:022]: Unit of Measurement: 'kWh'
[17:11:17][C][total_daily_energy:022]: Accuracy Decimals: 3
[17:11:17][C][total_daily_energy:022]: Icon: 'mdi:counter'
[17:11:17][C][integration:020]: Integration Sensor 'Mains Energy Meter'
[17:11:17][C][integration:020]: Unit of Measurement: 'kWh'
[17:11:17][C][integration:020]: Accuracy Decimals: 3
[17:11:17][C][integration:020]: Icon: 'mdi:counter'
[17:11:17][C][restart:021]: Restart Switch 'Mains Restart'
[17:11:17][C][restart:021]: Icon: 'mdi:restart'
[17:11:17][C][homeassistant.time:010]: Home Assistant Time:
[17:11:17][C][homeassistant.time:011]: Timezone: '...'
[17:11:17][C][version.text_sensor:015]: Version Text Sensor 'Mains Version'
[17:11:17][C][version.text_sensor:015]: Icon: 'mdi:new-box'
[17:11:17][V][version.text_sensor:015]: Unique ID: '60019485dd1e-version'
[17:11:17][C][web_server:120]: Web Server:
[17:11:17][C][web_server:121]: Address: mains.local:80
[17:11:17][C][ota:029]: Over-The-Air Updates:
[17:11:17][C][ota:030]: Address: mains.local:8266
[17:11:17][C][ota:032]: Using Password.
[17:11:17][C][api:095]: API Server:
[17:11:17][C][api:096]: Address: mains.local:6053
[17:11:17][C][wifi_signal.sensor:009]: WiFi Signal 'Mains Signal'
[17:11:17][C][wifi_signal.sensor:009]: Unit of Measurement: 'dB'
[17:11:17][C][wifi_signal.sensor:009]: Accuracy Decimals: 0
[17:11:17][C][wifi_signal.sensor:009]: Icon: 'mdi:wifi'
[17:11:17][V][wifi_signal.sensor:009]: Unique ID: '60019485dd1e-wifisignal'
[17:11:17][C][wifi_info:009]: WifiInfo IPAddress 'Mains IP'
[17:11:17][C][wifi_info:009]: Icon: 'mdi:ip-network'
[17:11:17][V][wifi_info:009]: Unique ID: '60019485dd1e-wifiinfo-ip'
[17:11:17][C][wifi_info:010]: WifiInfo SSID 'Mains SSID'
[17:11:17][C][wifi_info:010]: Icon: 'mdi:access-point-network'
[17:11:17][V][wifi_info:010]: Unique ID: '60019485dd1e-wifiinfo-ssid'
[17:11:17][C][wifi_info:011]: WifiInfo BSSID 'Mains BSSID'
[17:11:17][C][wifi_info:011]: Icon: 'mdi:access-point-network'
[17:11:17][V][wifi_info:011]: Unique ID: '60019485dd1e-wifiinfo-bssid'
[17:11:27][V][api.connection:563]: Hello from client: 'Home Assistant 0.101.2 (...)'
[17:11:27][D][api.connection:579]: Client 'Home Assistant 0.101.2 (...)' connected successfully!
[17:11:27][D][time:029]: Synchronized time: Sun Nov 17 17:11:27 2019
[17:11:34][V][sensor:013]: 'Mains Uptime Days': Received new state 0.000150
[17:11:34][D][sensor:092]: 'Mains Uptime Days': Sending state 0.00015 days with 1 decimals of accuracy
[17:11:58][V][sensor:013]: 'Mains Signal': Received new state -17.000000
[17:11:58][D][sensor:092]: 'Mains Signal': Sending state -17.00000 dB with 0 decimals of accuracy
[17:12:03][V][sensor:013]: 'Mains Uptime': Received new state 71.833000
[17:12:03][D][sensor:092]: 'Mains Uptime': Sending state 71.83300 s with 0 decimals of accuracy
[17:12:34][V][sensor:013]: 'Mains Uptime Days': Received new state 0.000831
[17:12:34][D][sensor:092]: 'Mains Uptime Days': Sending state 0.00083 days with 1 decimals of accuracy
[17:12:58][V][sensor:013]: 'Mains Signal': Received new state -14.000000
[17:12:58][D][sensor:092]: 'Mains Signal': Sending state -14.00000 dB with 0 decimals of accuracy
[17:13:03][V][sensor:013]: 'Mains Uptime': Received new state 131.832993
[17:13:03][D][sensor:092]: 'Mains Uptime': Sending state 131.83299 s with 0 decimals of accuracy
[17:13:04][I][ota:046]: Boot seems successful, resetting boot loop counter.
Setting it to:
uart:
tx_pin: 14
rx_pin: 13
baud_rate: 9600
# stop_bits: 2
will cause the error message to be printed again but will recover the function of the pzem004t v3 (gives readings again and publishes it).
Log:
[17:16:08][I][app:100]: ESPHome version 1.14.2 compiled on Nov 17 2019, 17:15:11
[17:16:08][C][wifi:409]: WiFi:
[17:16:08][C][wifi:277]: SSID: '...'
[17:16:08][C][wifi:278]: IP Address: ...
[17:16:08][C][wifi:280]: BSSID: ...
[17:16:08][C][wifi:281]: Hostname: 'mains'
[17:16:08][C][wifi:285]: Signal strength: -14 dB ▂▄▆█
[17:16:08][V][wifi:287]: Priority: 0.0
[17:16:08][C][wifi:289]: Channel: ...
[17:16:08][C][wifi:290]: Subnet: ...
[17:16:08][C][wifi:291]: Gateway: ...
[17:16:08][C][wifi:292]: DNS1: ...
[17:16:08][C][wifi:293]: DNS2: (IP unset)
[17:16:08][V][sensor:013]: 'Mains Total Daily Energy': Received new state 0.000000
[17:16:08][D][sensor:092]: 'Mains Total Daily Energy': Sending state 0.00000 kWh with 3 decimals of accuracy
[17:16:08][C][uart:145]: UART Bus:
[17:16:08][C][uart:147]: TX Pin: GPIO14
[17:16:08][C][uart:150]: RX Pin: GPIO13
[17:16:08][C][uart:152]: Baud Rate: 9600 baud
[17:16:08][C][uart:153]: Stop bits: 1
[17:16:08][C][uart:157]: Using software serial
[17:16:08][C][modbus:096]: Modbus:
[17:16:08][E][uart:388]: Invalid stop bits: Integration requested stop_bits 2 but you have 1!
[17:16:08][C][uptime.sensor:030]: Uptime Sensor 'Mains Uptime'
[17:16:08][C][uptime.sensor:030]: Unit of Measurement: 's'
[17:16:08][C][uptime.sensor:030]: Accuracy Decimals: 0
[17:16:08][C][uptime.sensor:030]: Icon: 'mdi:timer'
[17:16:08](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[17:16:08][C][template.sensor:021]: Template Sensor 'Mains Uptime Days'
[17:16:08][C][template.sensor:021]: Unit of Measurement: 'days'
[17:16:08][C][template.sensor:021]: Accuracy Decimals: 1
[17:16:08][C][template.sensor:021]: Icon: 'mdi:clock-start'
[17:16:08][C][template.sensor:022]: Update Interval: 60.0s
[17:16:08][C][template.text_sensor:020]: Template Sensor 'Mains Hardware'
[17:16:08][C][template.text_sensor:020]: Icon: 'mdi:tag'
[17:16:08][C][logger:175]: Logger:
[17:16:08][C][logger:176]: Level: VERBOSE
[17:16:08][C][logger:177]: Log Baud Rate: 0
[17:16:08][C][logger:178]: Hardware UART: UART0
[17:16:08][C][status:034]: Status Binary Sensor 'Mains Status'
[17:16:08][C][status:034]: Device Class: 'connectivity'
[17:16:08][C][pzemac:061]: PZEMAC:
[17:16:08][C][pzemac:062]: Address: 0x01
[17:16:08][C][pzemac:063]: Voltage 'Mains Voltage'
[17:16:08][C][pzemac:063]: Unit of Measurement: 'V'
[17:16:08][C][pzemac:063]: Accuracy Decimals: 1
[17:16:08][C][pzemac:063]: Icon: 'mdi:flash'
[17:16:08][C][pzemac:064]: Current 'Mains Current'
[17:16:08][C][pzemac:064]: Unit of Measurement: 'A'
[17:16:08][C][pzemac:064]: Accuracy Decimals: 3
[17:16:08][C][pzemac:064]: Icon: 'mdi:current-ac'
[17:16:08][C][pzemac:065]: Power 'Mains Power'
[17:16:08][C][pzemac:065]: Unit of Measurement: 'W'
[17:16:08][C][pzemac:065]: Accuracy Decimals: 1
[17:16:08][C][pzemac:065]: Icon: 'mdi:power'
[17:16:08][C][pzemac:066]: Frequency 'Mains Frequency'
[17:16:08][C][pzemac:066]: Unit of Measurement: 'hz'
[17:16:08][C][pzemac:066]: Accuracy Decimals: 1
[17:16:08][C][pzemac:066]: Icon: 'mdi:current-ac'
[17:16:08](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[17:16:08](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[17:16:08](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[17:16:08](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[17:16:08][C][total_daily_energy:022]: Total Daily Energy 'Mains Total Daily Energy'
[17:16:08][C][total_daily_energy:022]: Unit of Measurement: 'kWh'
[17:16:08][C][total_daily_energy:022]: Accuracy Decimals: 3
[17:16:08][C][total_daily_energy:022]: Icon: 'mdi:counter'
[17:16:08][C][integration:020]: Integration Sensor 'Mains Energy Meter'
[17:16:08][C][integration:020]: Unit of Measurement: 'kWh'
[17:16:08][C][integration:020]: Accuracy Decimals: 3
[17:16:08][C][integration:020]: Icon: 'mdi:counter'
[17:16:08][C][restart:021]: Restart Switch 'Mains Restart'
[17:16:08][C][restart:021]: Icon: 'mdi:restart'
[17:16:08][C][homeassistant.time:010]: Home Assistant Time:
[17:16:08][C][homeassistant.time:011]: Timezone: '...'
[17:16:08][C][version.text_sensor:015]: Version Text Sensor 'Mains Version'
[17:16:08][C][version.text_sensor:015]: Icon: 'mdi:new-box'
[17:16:08][V][version.text_sensor:015]: Unique ID: '60019485dd1e-version'
[17:16:08][C][web_server:120]: Web Server:
[17:16:08][C][web_server:121]: Address: mains.local:80
[17:16:08][C][ota:029]: Over-The-Air Updates:
[17:16:08][C][ota:030]: Address: mains.local:8266
[17:16:08][C][ota:032]: Using Password.
[17:16:08][C][api:095]: API Server:
[17:16:08][C][api:096]: Address: mains.local:6053
[17:16:08][C][wifi_signal.sensor:009]: WiFi Signal 'Mains Signal'
[17:16:08][C][wifi_signal.sensor:009]: Unit of Measurement: 'dB'
[17:16:08][C][wifi_signal.sensor:009]: Accuracy Decimals: 0
[17:16:08][C][wifi_signal.sensor:009]: Icon: 'mdi:wifi'
[17:16:08][V][wifi_signal.sensor:009]: Unique ID: '60019485dd1e-wifisignal'
[17:16:08][C][wifi_info:009]: WifiInfo IPAddress 'Mains IP'
[17:16:08][C][wifi_info:009]: Icon: 'mdi:ip-network'
[17:16:08][V][wifi_info:009]: Unique ID: '60019485dd1e-wifiinfo-ip'
[17:16:08][C][wifi_info:010]: WifiInfo SSID 'Mains SSID'
[17:16:08][C][wifi_info:010]: Icon: 'mdi:access-point-network'
[17:16:08][V][wifi_info:010]: Unique ID: '60019485dd1e-wifiinfo-ssid'
[17:16:08][C][wifi_info:011]: WifiInfo BSSID 'Mains BSSID'
[17:16:08][C][wifi_info:011]: Icon: 'mdi:access-point-network'
[17:16:08][V][wifi_info:011]: Unique ID: '60019485dd1e-wifiinfo-bssid'
[17:16:12][D][pzemac:046]: PZEM AC: V=235.2 V, I=3.093 A, P=577.7 W, F=49.9 Hz, PF=0.79
[17:16:12][V][sensor:013]: 'Mains Voltage': Received new state 235.199997
[17:16:12][D][sensor:092]: 'Mains Voltage': Sending state 235.20000 V with 1 decimals of accuracy
[17:16:12][V][sensor:013]: 'Mains Current': Received new state 3.093000
[17:16:12][D][sensor:092]: 'Mains Current': Sending state 3.09300 A with 3 decimals of accuracy
[17:16:12][V][sensor:013]: 'Mains Power': Received new state 577.700012
[17:16:12][D][sensor:092]: 'Mains Power': Sending state 577.70001 W with 1 decimals of accuracy
[17:16:12][V][sensor:013]: 'Mains Total Daily Energy': Received new state 0.805089
[17:16:12][D][sensor:092]: 'Mains Total Daily Energy': Sending state 0.00081 kWh with 3 decimals of accuracy
[17:16:12][V][sensor:013]: 'Mains Energy Meter': Received new state 3.382913
[17:16:12][D][sensor:092]: 'Mains Energy Meter': Sending state 2349.00342 kWh with 3 decimals of accuracy
Hi, do I need a PZEM soldering resistor (Pzem 004t V1.0)? And what do you use ESP8266 or ESP32? I try everything with the Wemos d1 mini, nothing can be seen.
@MariusLaurinaitis please don't use this issue for unrelated Q/A. Start a new issue or ask on the HA forums.
I am using the integration with stop_bits: 1
. Won't work if I set to 2.
The integration gives the warning Invalid stop bits: Integration requested stop_bits 2 but you have 1!
as described. I propose a change to the integration's default values. Which should be 1.
My pzems are V3 with esphome 1.4.3. Using with
platform: ESP8266
board: nodemcuv2
@MariusLaurinaitis please don't use this issue for unrelated Q/A. Start a new issue or ask on the HA forums.
Thank you, my fault
I lost two nights before I found this solution!
# stop_bits: 2
I lost two nights before I found this solution!
# stop_bits: 2
THANK YOU!! :sob:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I'm going to submit a documentation patch removing that line from the example
Operating environment/Installation (Hass.io/Docker/pip/etc.):
ESP (ESP32/ESP8266, Board/Sonoff):
Affected component:
Description of problem:
Everything works like expected but the log prints a error message regarding stop bits.
Problem-relevant YAML-configuration entries:
Logs (if applicable):
Additional information and things you've tried:
I also tested with
and
but the error keeps showing up