freakent / dbus-mqtt-devices

A driver for Victron VenusOS GX devices to support use of dbus-mqtt/flashmq-mqtt
MIT License
123 stars 24 forks source link

Energy Ac/L1/Energy/Reverse not working as expected #91

Closed patatman closed 9 months ago

patatman commented 9 months ago

Version

0.6.4 (current)

What version of VenusOS are you running on your GX device

3.20 (current release)

Does this issue occur during installation or at runtime ?

Runtime

Is there a Discussion thread for this issue? Please paste a link.

No response

What is the issue you are actually experiencing?

I'm trying to create a small script which reads data from DSMR-reader send to a MQTT broker, and send it to the victron MQTT broker. So far so good, and I've mapped out most of the values correctly. I've followed I've read: https://github.com/victronenergy/venus/wiki/dbus#grid-and-genset-meter to map all the data I have from DSMR to the corresponding Victron topics.

After running the script the entire day, I noticed my Victron values weren't updated when I was sending power back to the grid.

The snippet sending data to the topic in Victron is:

        elif msg.topic == f"{DSMR_TOPIC}/reading/phase_currently_returned_l1":
            wattage = float(msg.payload.decode("utf-8")) * 1000
            publish_to_victron(f"W/{portal_id}/grid/{device_instance}/Ac/L1/Energy/Reverse", wattage)

This value is in Kw, so I multiply it by 1000 to get the W value, which I then publish to the Victron bus on Ac/L1/Energy/Reverse topic. But this doesn't seem to do anything.

If I manually try to send the message on this topic, nothing happens. The only way I can get the victron to display a negative number, is by sending data to the /Ac/L1/Energy/Forward or /Ac/L1/Power with a negative sign in front of it (e.g. -2).

My main questions:

It might be a stupid mistake, so sorry if this confuses you.

If this is not installation related, what does the status payload look like that you are publishing to the driver to register your device?

No response

Relevant log output

No response

freakent commented 9 months ago

I'm not familar with sending grid data to dbus, but usually you have to send data as json payloads. for example

{
    "value": 23.2
}

You appear to be sending a float instead of a json string.

I would always advice you start with something simple like creating a test Temperature device. There are examples in the samples folder.

(moving this to Discussions as it doesn't appear to be a driver defect)