question

mgoldbach avatar image
mgoldbach asked

Is it possible to set generator run time via API or MQTT?

I know it is possible to turn the generator ON / OFF via the API. The documentation does not show how to set the run time. Is there are a parameter or D-bus path for that?

GeneratorMQTTapi dc system
12 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ commented ·

Hi! I’d like to help and give you the answer, but don’t know by heart and I’m not near a computer either.


However, I can help a bit in the right direction: to find out if there is such path (on dbus, and then automatically also on mqtt), configure your relay for generator start/stop and then login to ssh and run dbus-spy. You’ll see all available paths.


Alternatively; read through the source code of generator start/stop:

https://github.com/victronenergy/dbus_generator


If you do find such path; please help me and add it to the dbus wiki page:

https://github.com/victronenergy/venus/wiki/dbus#generator


0 Likes 0 ·
mgoldbach avatar image mgoldbach mvader (Victron Energy) ♦♦ commented ·

Thanks for the guidance @mvader. Ben seems to have discovered the path we need. Now looking for the REST API equivalent.

BTW looking at dbus_generator.py we noticed that "batterymeasurement" is defined twice under "settingsbase", which could be a bug (or a bug waiting to happen).

0 Likes 0 ·
mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ mgoldbach commented ·

Hi, with Rest API you are refering to MQTT; right? I dont think that qualifies as REST.


For MQTT: anything on dbus is also on MQTT. See dbus-mqtt readme for how to translate the dbus service, instance and path to a mqtt topic.


Bug: thanks! We’ll look into that one; I see what you mean.

0 Likes 0 ·
mgoldbach avatar image mgoldbach mvader (Victron Energy) ♦♦ commented ·

Thanks @mvader (Victron Energy Staff) and @ben. What I meant was - is there a way to set startTimer and start as POSTs or PUTs to vrmapi.victronenergy.com (as opposed to communicating with the MQTT server at mqtt.victronenergy.com)

0 Likes 0 ·
mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ mgoldbach commented ·

Hi, no; that is not possible. See those api docs; its reading only

0 Likes 0 ·
ben avatar image ben ♦ mgoldbach commented ·
For completeness, note that you are not required to use the MQTT server at mqtt.victronenergy.com. You can instead choose to use the local MQTT server running on Venus.


If you'll be issuing the commands from the same LAN, talking directly to the device eliminates one potential point of failure.
0 Likes 0 ·
mgoldbach avatar image mgoldbach ben ♦ commented ·

Thank you guys. All clear. One last question. @mvader (Victron Energy Staff) we didn't see ManualStart or ManualStartTimer in the code at https://github.com/victronenergy/dbus_generator. Is that a problem? @ben, I assume you're sure about variables, just double checking.

0 Likes 0 ·
mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ mgoldbach commented ·

Hi again, i dont know more then you; the code is available there.


If I were looking for manual-something. I’d use a search feature.


you’ll have to do that yourselves; I’m not a on request code searcher and reader ;o).

0 Likes 0 ·
ben avatar image ben ♦ mgoldbach commented ·

I'm sure about the variables, at least on my system.

I generally don't immediately adopt the very latest versions for a while, but I doubt that's an issue in this area. My guess is that the startstop values are injected by some other code, somewhere else.

0 Likes 0 ·
ben avatar image ben ♦ ben ♦ commented ·

Yeah, check the code out and search it that way. Don't use the github search.

1 Like 1 ·
mgoldbach avatar image mgoldbach ben ♦ commented ·

Confirmed. It's added by startstop.py

0 Likes 0 ·
mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ ben ♦ commented ·

I’m sure its in that repo

0 Likes 0 ·
1 Answer
ben avatar image
ben answered ·

The D-Bus path you want is com.victronenergy.generator.startstop0/Generator0/ManualStartTimer. The unit is seconds. Write this value first, and then write ManualStart to 1.

2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

mgoldbach avatar image mgoldbach commented ·

Thank you Ben!

Do you know if that is also accessible via the REST API? I know the gen start is available.

0 Likes 0 ·
ben avatar image ben ♦ mgoldbach commented ·

I'm not aware of any REST APIs, so I'm afraid I can't help there.

You could, of course, make your own REST wrapper around MQTT or D-Bus. Or maybe someone has already created a library to do just that.

0 Likes 0 ·

Related Resources

Additional resources still need to be added for this topic

MultiPlus Generator FAQ

GX - Generator auto start/stop

Automatic Generator start/stop

 Hybrid Generators

Virtual switch - Generator start/stop

Additional resources still need to be added for this topic

Victron MQTT readme