Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writing Value for EMS_EP_RESERVE #68

Open
hismastersvoice opened this issue Oct 16, 2022 · 5 comments
Open

Writing Value for EMS_EP_RESERVE #68

hismastersvoice opened this issue Oct 16, 2022 · 5 comments

Comments

@hismastersvoice
Copy link

hismastersvoice commented Oct 16, 2022

I tried to write the value for Emergency-Power-Reserve via RSCP to my E3DC
Reading the value works fine.

But if I try to write, I always get NULL back and the value don't change.
Can anybody help me please? Thanks in advance.

I have found that this value is % of the installed batterie capacity, and it is given als float32 eg 25.00 etc.

def set_epr(self, ep_reserve=None, keepAlive=False):

    res = self.sendRequest(
        (
            "EMS_REQ_EP_RESERVE",
            "Container",
            [
                ("EMS_EP_RESERVE", "Float32", ep_reserve),
            ],
        ),
        keepAlive=keepAlive,
    )
@Selaron
Copy link

Selaron commented Oct 16, 2022

After several attempts I did it like that and it worked, setting EP Reserve to 1650 Wh:

from e3dc import E3DC

...

retval = e3dc.rscp.sendRequest(
        (
            "SE_REQ_SET_EP_RESERVE",
            "Container",
            [
                ("SE_PARAM_INDEX", "Uint32", 0),
                ("SE_PARAM_EP_RESERVE", "Float32", 0.0),
                ("SE_PARAM_EP_RESERVE_W", "Float32", 1650.0),
            ],
        )
    );

Idea borrowed from here: https://github.com/nischram/E3dcGui/blob/1ed3dc163287f7227b303e22d4ff20c650143ad0/Rscp/RscpSet.cpp#L105

@hismastersvoice
Copy link
Author

You are my hero ;)
Work well.

Thanks.

@Selaron
Copy link

Selaron commented Oct 21, 2022

Only thing is that for some reason the new value does not update on the touch screen UI, but it actually works.

@hismastersvoice
Copy link
Author

@Selaron

I can confirm this.
The display stays with the old value.

Also reading the set value was a bit difficult.
You only get a % value, but this % is calculated by installed capacity and state of health of the batteries.

For me it work perfectly now.

@Selaron
Copy link

Selaron commented Oct 21, 2022

Using this you can get the Wh reserve setting:

retval = e3dc.rscp.sendRequest(
                ("SE_REQ_EP_RESERVE", "None", None),
    )[2][2][2];

The [2][2][2] extracts the value out of the tuple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants