Replies: 61 comments 235 replies
-
|
It get multiple registers? count? |
Beta Was this translation helpful? Give feedback.
-
|
I will try it later |
Beta Was this translation helpful? Give feedback.
-
|
Dont work with api only? |
Beta Was this translation helpful? Give feedback.
-
|
Working code ###
#sensor:
- platform: modbus_component
#modbus_id: modbus_serial
id: meter1
address: 0x1
sensors:
- id: raw_voltage_1
name: "EB1 Voltage L1"
address: 0x006C
offset: 0
unit_of_measurement: "V"
modbus_functioncode: "read_input_registers"
value_type: U_SINGLE
scale_factor: 0.1
accuracy_decimals: 1
icon: mdi:flash
- id: raw_current_1
name: "EB1 Current L1"
address: 0x006C
offset: 1
unit_of_measurement: "A"
modbus_functioncode: "read_input_registers"
value_type: U_SINGLE
scale_factor: 0.1
accuracy_decimals: 1
icon: mdi:power-socket
- id: raw_voltage_2
name: "EB1 Voltage L2"
address: 0x006C
offset: 2
unit_of_measurement: "V"
modbus_functioncode: "read_input_registers"
value_type: U_SINGLE
scale_factor: 0.1
accuracy_decimals: 1
icon: mdi:flash
- id: raw_current_2
name: "EB1 Current L2"
address: 0x006C
offset: 3
unit_of_measurement: "A"
modbus_functioncode: "read_input_registers"
value_type: U_SINGLE
scale_factor: 0.1
accuracy_decimals: 1
icon: mdi:power-socket
- id: raw_voltage_3
name: "EB1 Voltage L3"
address: 0x006C
offset: 4
unit_of_measurement: "V"
modbus_functioncode: "read_input_registers"
value_type: U_SINGLE
scale_factor: 0.1
accuracy_decimals: 1
icon: mdi:flash
- id: raw_current_3
name: "EB1 Current L3"
address: 0x006C
offset: 5
unit_of_measurement: "A"
modbus_functioncode: "read_input_registers"
value_type: U_SINGLE
scale_factor: 0.1
accuracy_decimals: 1
icon: mdi:power-socket
- id: raw_current_total
name: "EB1 Current Total"
address: 0x006C
offset: 6
unit_of_measurement: "A"
modbus_functioncode: "read_input_registers"
value_type: U_SINGLE
scale_factor: 0.1
accuracy_decimals: 1
icon: mdi:power-socket
### |
Beta Was this translation helpful? Give feedback.
-
|
Do you have queue? Or some congestion control? I can only send one command per second to my meter. Between sends at least 1s is mandatory |
Beta Was this translation helpful? Give feedback.
-
|
UDOUBLE [17:53:46][D][ModbusComponent:031]: Modbus data 32 |
Beta Was this translation helpful? Give feedback.
-
|
Dont fix error 32 > 16 @@ -19,6 +19,9 @@ void ModbusComponent::setup() { this->create_register_ranges(); }
bool ModbusComponent::send_next_command_() {
if (!command_queue_.empty()) {
auto &command = command_queue_.front();
delay(500); //
delay(500); // will fail lint
delay(500); //
command->send();
if (!command->on_data_func) // No handler remove from queue directly after sending
command_queue_.pop(); |
Beta Was this translation helpful? Give feedback.
-
- id: raw_power_1
name: "EB1 Power L1"
address: 0x0073
offset: 0
unit_of_measurement: "W"
modbus_functioncode: "read_input_registers"
value_type: U_DOUBLE
scale_factor: 1
accuracy_decimals: 1
icon: mdi:power-plug |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
Here I suppose you won't get help from glmnet which is very valuable. Btw: I'm not esphome expert but your code seems nice to me. And the approach is quite similar to my first attempt :-). I'd suggest you to switch back to original discussion and kick in your pull request. |
Beta Was this translation helpful? Give feedback.
-
sensor_entry = sensor.SENSOR_SCHEMA.extend(
{
cv.Optional(CONF_MODBUS_FUNCTIONCODE): cv.enum(MODBUS_FUNCTION_CODE),
cv.Optional(CONF_ADDRESS): cv.int_,
cv.Optional(CONF_OFFSET): cv.int_,
cv.Optional(CONF_BITMASK, default=0xFFFF): cv.int_,
cv.Optional(CONF_VALUE_TYPE): cv.enum(SENSOR_VALUE_TYPE),
cv.Optional(CONF_SCALE_FACTOR): cv.float_,
}
)You don't really need offset and scale_factor: they are already provided by offset and multiply filters |
Beta Was this translation helpful? Give feedback.
-
command_throttle: time in ms between sending modbus commands
epever: A 32 bit value like pv input value is returned inb 2 registers EBL Box: A 32 bit value like pv input value is returned in 2 registers
|
Beta Was this translation helpful? Give feedback.
-
|
I think I know why 8 bytes instead of 4 bytes were returned . |
Beta Was this translation helpful? Give feedback.
-
|
Raw bytes are OK. In tasmota we have: uu - single byte But is somewhat regex stuff Second NOT Second register start at half of first |
Beta Was this translation helpful? Give feedback.
-
|
You need fix register count [02:09:45][V][ModbusComponent:365]: Command sent 4 0x73 21
[02:09:45][V][modbus:046]: Modbus recieved Byte 1 (0X1)
[02:09:45][V][modbus:046]: Modbus recieved Byte 132 (0X84)
[02:09:45][V][modbus:046]: Modbus recieved Byte 129 (0X81)
[02:09:45][V][modbus:046]: Modbus recieved Byte 131 (0X83)
[02:09:45][V][modbus:046]: Modbus recieved Byte 96 (0X60)
[02:09:45][W][modbus:096]: Modbus error function code: 0x84 exception: 129
[02:09:45][E][ModbusComponent:063]: Modbus error function code: 0x4 exception: 129
[02:09:45][W][ModbusComponent:072]: last command: expected response size=42 function code=0x4 register adddress = 0x73 registers count=21 payload size=0 |
Beta Was this translation helpful? Give feedback.
-
|
Hi As I read the documentation for the meter, all 3 above are INT32 with LSW->MSW. All setting in the meter are default. Output is (where only first one are in a valid range: I tried various addresses, offsets and value_types, but no luck. |
Beta Was this translation helpful? Give feedback.
-
|
I'm away this week and will try to answer next week.
|
Beta Was this translation helpful? Give feedback.
-
How would I set the following?
I have When I watch the log viewer I'm not getting any data back from the device. I'm using a ESP32 dev board and I have tried setting the UART to different TX/RX pins, but still can't get any data. Wiring:Config:external_components:
### https://github.com/martgras/esphome/tree/modbus_component/esphome/components/modbus_controller
- source:
type: git
url: https://github.com/martgras/esphome
ref: modbus_component
components: [ modbus_controller ]
uart:
id: solark_uart
tx_pin: 16
rx_pin: 17
baud_rate: 9600
parity: none
data_bits: 8
stop_bits: 1
# RTU Settings: Baud rate: 9600bps, Parity: None, Data Bits: 8, Stop Bits: 1
modbus_controller:
uart_id: solark_uart
command_throttle: 1s
id: solark
address: 0x01
update_interval: 30s
sensor:
- platform: modbus_controller
modbus_controller_id: solark
name: "SolArk Battery Voltage"
address: 0xB7 #0x3000 183 #
offset: 0
unit_of_measurement: "V"
modbus_functioncode: "read_input_registers"
value_type: U_WORD
accuracy_decimals: 2
filters:
- multiply: 0.01 |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
The 2999 vs 3000 is as I understand just an offset of starting counting
from 0 vs 1.
But don't confuse that with the offset option. That's defined in the docs
here:
https://github.com/martgras/esphome/tree/modbus_component/esphome/components/modbus_controller#format.
You should always read up on value_type
…On Mon, Sep 6, 2021 at 10:09 AM Andrzej ***@***.***> wrote:
Thanks for the reply, but still there's small shade of not understanding
left.
As the example - the value is float, so it's "longer" in bytes than int
[take more bytes] it has to be offset.
But if my energy meter only has int's, then do I need to offset more than
1?
And I can see address 2999 referenced to 3000 in documentation, so I guess
offset here was '1'?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#11 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEAWSUNJQTE3FCYKADHKWP3UARSLNANCNFSM4ZCEHTHA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Beta Was this translation helpful? Give feedback.
-
|
Promoting the testing tree with a breaking change :) breaking changesI am going to archive this fork and not update it anymore.
external_components:
# use GitHub
- source:
type: git
url: https://github.com/martgras/esphome
ref: testing
components: [modbus, modbus_controller]
Other changes in the testing tree
See the readme in testing for more details about the new features |
Beta Was this translation helpful? Give feedback.
-
|
I'm also trying to improve the docs but not really my favorite job. https://webtestesphome.z1.web.core.windows.net/components/modbus_controller.html brings you directly to the controller Feel free to add to it or correct my typos and other errors :) |
Beta Was this translation helpful? Give feedback.
-
|
FYI.
I suspect it is related to esphome/aioesphomeapi#87 See also esphome/issues#2427 |
Beta Was this translation helpful? Give feedback.
-
|
The modbus_controller component is now part of esphome. esphome#1779 has been merged. Thanks for all your input - without it the component would lack a lot of features. Your feedback encouraged me to keep improving. |
Beta Was this translation helpful? Give feedback.
-
|
Congratulations. It was a long and hard way for you ;-) . Here is the updated YAML File for the Heidelberg Wallbox. |
Beta Was this translation helpful? Give feedback.
-
|
Hey I just enabled the wiki feature. |
Beta Was this translation helpful? Give feedback.
-
|
Tricky to troubleshoot without the device 🙂
Can you remove a couple of registers. Maybe I made a mistake when I converted the yaml you provided
May start a test with only the first register defined in YAML.
|
Beta Was this translation helpful? Give feedback.
-
|
You add `force_new_range: true` to one of the sensor in the middle.
That will result in a new request starting at that request.
I guess your assumption is correct that there is a limit somewhere
|
Beta Was this translation helpful? Give feedback.
-
|
Hi Martin,
https://paste.kr33.de/?a7a3f2f3d8a20e6d#4hrL7K4KTzD8MBb6RMzUMnBuSeuEiNXmKdfpB7gGVEU7 |
Beta Was this translation helpful? Give feedback.
-
|
Die deutsche Doku ist schon ok auch wenn ich aus Bayern komme 🙂
Switching back to English for anyone else following.
I'll have a look at it tomorrow.
<http://www.9folders.com/>
|
Beta Was this translation helpful? Give feedback.









Uh oh!
There was an error while loading. Please reload this page.
-
👋 Welcome!
We’re using Discussions as a place to connect with other members of our community. We hope that you:
build together 💪.
To get started, comment below with an introduction of yourself and tell us about what you do with this community.
Beta Was this translation helpful? Give feedback.
All reactions