mr-manuel / venus-os_dbus-mqtt-grid

This Venus OS driver gets the data from MQTT and displays it as grid, genset or ac load meter.
MIT License
59 stars 20 forks source link

MQTT Transfers Single Informations #11

Closed Wintersss1 closed 11 months ago

Wintersss1 commented 11 months ago

MQTT Messages are single Phases and not complete json always, how did you get the Smart Meter running?

One message for example is:

{"Time":"2023-11-20T19:19:06","grid":{"L3":63.00}}

Wintersss1 commented 11 months ago

This is my Tasmota Script:

D B ->sensor53 r M 1 +1,3,s,16,9600,grid 1,77070100010800ff@1000,E_in,kWh,E_in,1 1,77070100020800ff@1000,E_out,kWh,E_out,1 1,77070100100700ff@1,Current Consumption,W,power,16 1,77070100240700ff@1,Current Consumption P1,W,power_L1,16 1,77070100380700ff@1,Current Consumption P2,W,power_L2,16 1,770701004c0700ff@1,Current Consumption P3,W,power_L3,16 1,77070100000009ff@#,Server_ID,,Server_ID,0 #

mr-manuel commented 11 months ago

@randomname32

randomname32 commented 11 months ago

My tasmota script is very similar to yours:

>D
>B
=>sensor53 r
>M 1
+1,3,s,0,9600,grid
1,77070100100700ff@1,Current Consumption,W,power,16
1,77070100240700ff@1,Current Consumption P1,W,power_L1,16
1,77070100380700ff@1,Current Consumption P2,W,power_L2,16
1,770701004c0700ff@1,Current Consumption P3,W,power_L3,16
#

It is true that the mqtt messages are very short. Each time tasmota reads one of the values (L1, L2, ...), it directly sends a mqtt message with only that value.

In your first post you said that the mqtt message looks like this:

{"Time":"2023-11-20T19:19:06","grid":{"L3":63.00}}

But according to your script, it should look like this:

{"Time":"2023-11-20T19:19:06","grid":{"power_L3":63.00}}

venus-os_dbus-mqtt-grid looks for jsonpayload["grid"]["power_L3"]).

So, your script looks ok and it should send the messages in the correct format for venus-os_dbus-mqtt-grid. Please double-check the content of the sent mqtt messages. You can see them in the tasmota console.

Apart from that you have to make sure that the mqtt messages are actually sent to venusOS. Either directly, or via another mqtt server/broker.

randomname32 commented 11 months ago

If you want to send the messages directly to venusOS, please edit the MQTT part of config.ini of venus-os_dbus-mqtt-grid:

[MQTT]
; IP addess or FQDN from MQTT server
; "localhost" is allowed, can be used if mqtt server is enabled in venusOS
broker_address = localhost

Additionally you have to enable the MQTT server on your venusOS: https://github.com/victronenergy/dbus-mqtt#set-up

Wintersss1 commented 11 months ago

My tasmota script is very similar to yours:

>D
>B
=>sensor53 r
>M 1
+1,3,s,0,9600,grid
1,77070100100700ff@1,Current Consumption,W,power,16
1,77070100240700ff@1,Current Consumption P1,W,power_L1,16
1,77070100380700ff@1,Current Consumption P2,W,power_L2,16
1,770701004c0700ff@1,Current Consumption P3,W,power_L3,16
#

It is true that the mqtt messages are very short. Each time tasmota reads one of the values (L1, L2, ...), it directly sends a mqtt message with only that value.

In your first post you said that the mqtt message looks like this:

{"Time":"2023-11-20T19:19:06","grid":{"L3":63.00}}

But according to your script, it should look like this:

{"Time":"2023-11-20T19:19:06","grid":{"power_L3":63.00}}

venus-os_dbus-mqtt-grid looks for jsonpayload["grid"]["power_L3"]).

So, your script looks ok and it should send the messages in the correct format for venus-os_dbus-mqtt-grid. Please double-check the content of the sent mqtt messages. You can see them in the tasmota console.

Apart from that you have to make sure that the mqtt messages are actually sent to venusOS. Either directly, or via another mqtt server/broker.

Yes that's correct, I change it to the right Co Version but the log was full of errors because of the Single messages sometimes the total power value is missing. It's also getting shown wrong. I did a rework now with node red that Safes the last value and provides all the value to the Script.. Not the Best way but seems to be working.

Wintersss1 commented 11 months ago

If you want to send the messages directly to venusOS, please edit the MQTT part of config.ini of venus-os_dbus-mqtt-grid:

[MQTT]
; IP addess or FQDN from MQTT server
; "localhost" is allowed, can be used if mqtt server is enabled in venusOS
broker_address = localhost

Additionally you have to enable the MQTT server on your venusOS: https://github.com/victronenergy/dbus-mqtt#set-up

It's enable, I put the ipadress in, so the outcome should be the same

randomname32 commented 11 months ago

the log was full of errors because of the Single messages sometimes the total power value is missing.

I just checked my logfile of dbus-mqtt-grid and I also have some errors there (I wouldn't say it's full though):

2023-11-20 16:33:35.733497500 ERROR:root:Received message is not a valid JSON. Invalid control character at: line 1 column 43 (char 42)

I fetch the mqtt messages also in my iobroker, there I get the following error log:

mqtt.1 2023-11-20 17:33:35.543 warn Cannot parse "grid/meters/SENSOR": {"Time":"2023-11-20T17:33:33","grid":{"p0Jgrid/meter

Does this look like the same issue that you have?

I did not consider it as an issue, because even if a message sometimes gets lost, the next update will come a few seconds later.

But I guess the root cause of that error is in tasmota... I'm not too familiar with mqtt messages, but I don't think the messages get scrambled up during transport...

Wintersss1 commented 11 months ago

No, my Problem is that the Json Strucute is not ok when i only send updates for L3 via Mqtt for example. Than it wants to have the { "grid": { "power": 0.0 } } as minimum and throws an exception.

Can i increase the "speed" so that there are more updates to the Grid Services? I Think there is to much Delay to use this for the ESS.

Wintersss1 commented 11 months ago

Just for your Info, i dont get Errors anymore, even if i have single messages, i had the release Files in there which are from may 2022, thats why i got not the same response. Now with the actual py script its working fine, thanks!

randomname32 commented 11 months ago

Can i increase the "speed" so that there are more updates to the Grid Services? I Think there is to much Delay to use this for the ESS.

I am not aware of any option to increase the update rate of the messages sent from tasmota. My assumption is that the energy meter itself is not able to send its data faster than that... If you want to know more about this issue, it's maybe better to ask the question in a tasmota forum