Powershell script to start generator via cerbo relay

I am attempting to write a powershell script that starts\stops the generator via the VRM API. I have the code to GET the relays but I see no way to change the values. Anyone have a sample of code or can point me to a solution? Thanks!

Can this not be done via the VRM API?

Not unless you are using mqtt.

I can do MQTT and tried, but I could never find the correct syntax to build my script? Can you advise, or post an example? Never figured the proper “topic” or whatever the correct term is. Appreciate any assistance

I hadn’t tried it in power shell. I just know the only way to have read/write access is through mqtt. That is how the vrm relay control works to the GX.

Have a look using an mqtt explorer to find what you are looking for.

Yes I tried for several days. This 70yr old brain just ain’t what it use to be. Ran into a brick wall trying to understand how to get it to work\find the right topic. Could you assist? I’d really appreciate it!

Whatever lang you prefer to work in is fine. I can use AI to convert.

making progress using mosquitto but cant determine what the correct topic should be. I usually get no results back. who knows the correct topic for generator? Thanks!

Update: got the system data into MQTT explorer, but the generator data does not show. what is the topic got the generator?
tried…
N/systemID/generator/0/#
and
N/systemID/venus/0/#

The topic is

W/systemID/generator/0/ManulStart

That did not work for me, not sure why. I assumed you meant ManualStart. I get all the other mqtt messages from
N/systemID/system/0/#.

One other point I dont understand. I get the message only when I have the VRM portal up on my laptop. When I close the portal they quit updating. Any thoughts why and how to fix. Thanks again!

For mqtt there needs to be a keep alive set as well. So having the vrm keeps the stream alive.
There are a few posts knocking around the forum about it.

W means writable. The n i don’t think are (dont quote me - i am also new to it)

O thats what that keepalive is all about, gotcha!!

what about this not working W/systemID/generator/0/ManualStart

Maybe this can help you?

I usually have local start, have not worked through the api. We don’t always have internet.

The system id part is your unique site id

I am sorry but this doesn’t make sense to me. Do I have to take a different approach or is there some other topic I need. Are you saying I should use this module somehow? I don’t see any examples in the docs. Do you have any accessing the generator properties?

The last few days I been trying MQTT but this is proving to be difficult and I haven’t gotten it to work. Would you or anybody have an example of using this to control the generator?

I need to be able to do this on my windows laptop and my android phone, just like my own personal custom version of VRM. Can this be done?

Thanks!

The docs have addresses for topics.

Probably with node red and node red dashboard.

Powershell as i mentioned before is not something i have used in seriousness.

The other way python as well. I have not used that either as node red is significantly easier to use.

Even this requires knowing what generator and what it communicates as well.
Again the document i linked has examples and known addresses for dbus.

I don’t even know what you are trying exactly (except a custom interface) so being more specific is not possible. Are you wanting local and internet controls?

Yes, trying to write my own customized interface with my systems. This will allow me to do anything I need based on all the other data I can gather. I have backed off a bit and now trying to use mosquitto_pub to publish to the generator/0/ManualStart topic, but even this doesn’t work. If I can get the command line to work, I can build from there. I can see the generator tree in the mosquitto app. Below pic is my mosquitto_pub command line… not working even though it doesn’t give me an error when I execute.. I try the publish in the app and that doesn’t work either. Obviously I have some little thing I don’t have set right…

mosquitto_pub -d -i “Start GenSet” --nodelay -h mqtt110.victronenergy.com -p 8883 -t “W/xxxxxxxx/generator/0/ManualStart” -m “1” --cafile “C:\Users\xxx\Downloads\venus-ca.crt” -u “yyyyyyyyy” -P “xxxxx”

python examples are ok if u have some…

Sorry for the “dummy” questions! Not as good with this tech as I used to be.

I am out of practice as well. It was something i was trying to restart and then… time…

Happy to learn with you.

There are a few [python examples on git hub](https://[quote=“Randy, post:15, topic:26417, username:rfg9585”] python examples are ok if u have some [/quote]). Many use dbus.

Can’t find examples… never used github, very confusing for a rookie. it all looks good but something just isn’t clicking in my mind. do you see one using the generator manualstart ?

did you tried: -m “{“value”: 1}” or in mqtt explorer {“value”: 1}

Your awesome! Got this to work with .bat file -m “{"value": 1}”

and this to work with mqtt explorer {“value”: 1}

Thanks so much!

can you suggest how I could proceed making an app that would run under windows and on my android samsung phone? (html app?)

Do you need local app or over internet?