Closed bjornstevens closed 3 years ago
Che k if you can give an ID to modbus then add modbus_id for each sensor. I know it's not documented but it's how usually works
Thanks, that was the exact piece I was missing!
Config now is as follows:
- id: mod1
uart_id: ua1
- id: mod2
uart_id: ua2
uart:
- id: ua1
tx_pin: D1
rx_pin: D2
baud_rate: 9600
#stop_bits: 1
- id: ua2
tx_pin: D5
rx_pin: D6
baud_rate: 9600
#stop_bits: 1
sensor:
- platform: pzemac
current:
name: "PZEM-004T V3 Current"
voltage:
name: "PZEM-004T V3 Voltage"
energy:
name: "PZEM-004T V3 Energy"
power:
name: "PZEM-004T V3 Power"
frequency:
name: "PZEM-004T V3 Frequency"
power_factor:
name: "PZEM-004T V3 Power Factor"
update_interval: 1s
modbus_id: mod1
- platform: pzemac
current:
name: "PZEM-004T_2 V3 Current"
voltage:
name: "PZEM-004T_2 V3 Voltage"
energy:
name: "PZEM-004T_2 V3 Energy"
power:
name: "PZEM-004T_2 V3 Power"
frequency:
name: "PZEM-004T_2 V3 Frequency"
power_factor:
name: "PZEM-004T_2 V3 Power Factor"
update_interval: 1s
modbus_id: mod2
Maybe an extra: but is there a way to sync the requests? Like sync update_interval?
Allright, so now comes the new issue:
Somtimes when the 2 pzem's are synced up, I receive this message. Is there a way to correct this (like putting an request delay of around 100 miliseconds between the scans)?
Start by setting uptade interval to never, to the second pzem
Then you'll need to trigger it manually. Use this action: https://esphome.io/guides/automations.html#component-update-action
You can add an on_value trigger to any sensor of first pzem
Thanks for the reply, it was also exactly what I was looking for! Thanks!
I've now just given my pzemac's ID's and added this:
interval:
- interval: 5s
then:
- lambda: 'id(pzemac1).update();'
- delay: 50ms
- lambda: 'id(pzemac2).update();'
I will close this case for now due to my problem being fixed. Thanks for the help @glmnet !
Operating environment/Installation (Hass.io/Docker/pip/etc.):
ESP (ESP32/ESP8266, Board/Sonoff):
ESP8266, nodemcu amica
ESPHome version (latest production, beta, dev branch)
Affected component:
pzemac
Description of problem:
I can't seem to figure out how to get my 2 pzem-004T's to get read by esphome. The issue seems to rely on that i can't define the 'uart_id' in the pzemac configuration. Is there any workaround for this?
As of now I can only select 1 of the 2 "ua's". Which makes it only possible for me to read out 1 sensor, while I would really love to read out both of them
Problem-relevant YAML-configuration entries:
Logs (if applicable):
Additional information and things you've tried:
I tried playing with the addresses, changing out the modbus to something else (and also can't get it to use different connections) I also tried to change things in the uart, but also without succes. I can only get it to pick 1 of the 2 connections, while i want both.