question

mysik avatar image
mysik asked

Variable grid set point

Hi,

I would like to set different "grid setpoint" for example from 0:00 to 6:00 have it at 500W, from 6:00 till 16:00 at 100W, from 16:00 till 19:00 at 0W and from 19:00 till 0:00 at 50W (everyday the same pattern). Will it be possible to do it using MQTT and some script implemented on my VenuxGX??? Anyone made anything similar to what I want to do? At the moment I'm researching the option to install node-red on VenusGX, but just wondering if just a simple script option isn't easier. What do you think? Any suggestions welcomed.

ESS
3 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.

João Rosado avatar image João Rosado commented ·

i'm intereted in this option

0 Likes 0 ·
thanar avatar image thanar commented ·

I am also interested.

0 Likes 0 ·
Show more comments
4 Answers
mikhail-petukhov avatar image
mikhail-petukhov answered ·

If you are a little familiar with Linux, the easiest way to use the crontab to run a set of scripts directly on a VenusGX. Each script runs at its own time and writes the required value to dbus. The Venus OS timezone does not match the one set in the menu settings and this should be taken into account when creating entries in the crontab. There are other methods of course for local . I haven't found an easy way to write the value to dbus yet, but writing the value via modbus works fine.

from pymodbus.constants import Defaults
from pymodbus.constants import Endian
from pymodbus.client.sync import ModbusTcpClient as ModbusClient

Defaults.Timeout = 25
Defaults.Retries = 5
client = ModbusClient('localhost', port='502')
result = client.write_register(2700, 600, unit=100)

2700 - register ESS control loop setpoint

600 - value (600W)

100 - VenusGX

This script will set the ESS control loop setpoint to 600W

1 comment
2 |3000

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

shaneyake avatar image shaneyake commented ·

You can run this command from Cron or in terminal directly.

dbus -y com.victronenergy.settings /Settings/CGwacs/AcPowerSetPoint SetValue 0

With 0 being value you want.

0 Likes 0 ·
shaneyake avatar image
shaneyake answered ·

Yes, you can change the setpoint via Modbus TCP or MQTT. Modbus is super simple.

This kind of programing is easiestly done with the Large firmware using NodeRed
https://www.victronenergy.com/live/venus-os:large

It would be as simple as inject at this time, this value to ESS setpoint. No worrying about scripts, crashing, etc. NodeRed can be accessed from VRM too, which is nice.

If you are going to run NodeRed, I tend to recommend the Cerbo but the Venus will run it fine just don't try do to many things.

2 |3000

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

mikhail-petukhov avatar image
mikhail-petukhov answered ·

@shaneyak thanks, your idea is the best!

crontab entry example for "from 6:00 at 100W"

0 6 * * * /usr/bin/dbus/dbus -y com.victronenergy.settings /Settings/CGwacs/AcPowerSetPoint SetValue 100
2 |3000

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

banne avatar image
banne answered ·

A small noobs addition although this is an old thread but it was useless for me as it was not complete... The sample crontab above here is wrong, it has a "dbus" to many in the directory. The actual way to do this is as follows:

Login to SSH via Terminal/Putty etc as superuser (search how to set a Victron superuser and activate SSH)

Create an executable bash script (search how to make this, quite easy, see sample script here below)

Save it

Create a crontab with command crontab -e

Set the time as below MM HH * * * /

00 20 * * * /data/home/root/avond-file.sh
00 05 * * * /data/home/root/ochtend-file.sh

BUT use the UTC time to start. It will NOT start on local timezone time. Very confusing (took me 3 hours to find out the used time is not the local time...) but it is what it is

If you want to use a minus value, set -- -x (where x is the value you want to set)

The negative value script:

#!/bin/bash
set -e

/usr/bin/dbus -y com.victronenergy.settings /Settings/CGwacs/AcPowerSetPoint SetValue -- -1700

The positive script

#!/bin/bash
set -e

/usr/bin/dbus -y com.victronenergy.settings /Settings/CGwacs/AcPowerSetPoint SetValue 1700

Also very handy, if you want to see what is going wrong with your crontab use this command for logging

tail -f /data/log/messages
2 |3000

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