-
Notifications
You must be signed in to change notification settings - Fork 22
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
S10 fixes #74
base: master
Are you sure you want to change the base?
S10 fixes #74
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution.
I made a few comments.
e3dc/_e3dc.py
Outdated
# Returns the new value of EMS_RES_WEATHER_REGULATED_CHARGE_ENABLED, we need | ||
# to validate this against the desired value, the object looks like this: | ||
# [ "EMS_SET_POWER_SETTINGS", | ||
# "Container", | ||
# [ | ||
# ["EMS_RES_WEATHER_REGULATED_CHARGE_ENABLED", "Char8", 0] | ||
# ] | ||
# ] | ||
|
||
# validate new value | ||
if ( | ||
rscpFindTagIndex(res, "EMS_RES_WEATHER_REGULATED_CHARGE_ENABLED") | ||
== newValue | ||
): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using rscpFindTagIndex
is nice.
EMS_RES_WEATHER_REGULATED_CHARGE_ENABLED
is not returning the actual set value but rather 0 if the new value was set successfully.
Therefore checking against 0 was correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the S10 is behaving differently here? I see things differently here, basically:
A call e3dc.set_weather_regulated_charge(False)
to my S10 always yields this result, with weather regulated charging successfully disabled:
[
"EMS_SET_POWER_SETTINGS",
"Container",
[
[
"EMS_RES_WEATHER_REGULATED_CHARGE_ENABLED",
"Char8",
0
]
]
]
This is a dump of the res structure directly after teh call to sendRequest
. If I call e3dc.set_weather_regulated_charge(True)
, I always get this:
[
"EMS_SET_POWER_SETTINGS",
"Container",
[
[
"EMS_RES_WEATHER_REGULATED_CHARGE_ENABLED",
"Char8",
1
]
]
]
Again, independant of the number of calls, the feature is enabled successfully. This is what I see reverse-engineering my own unit. What I was unable to do though is trying to force an error. So I can't tell how this call behaves if for any reason the S10 could not set the value.
How does your unit behave?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vchrisb should I drop the Weather Regulated Charge changes from this PR until these questions are resolved so that the other changes can be merged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll have a look in the evening at my E3DC how it behaves.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1
is enabling weather regulated charge any other value is disabling it.
The return value is 1
for True
/1
and 0
for all other positive integers.
E3DC API consistency...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you test again?
You shouldn't be able to send 3000
at all, as it is larger than 255
.
Further up you did report the same behavior like me. I do not expect E3DC to implement APIs differently.
set_weather_regulated_charge
should only need to support boolean. We might add type annotations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have created a test run, the code it uses is attached to this file. It basically calls set_weather_regulated_charge
repeatedly and rereads the current state afterwards alongside the return value of the call itself. What I get is this:
WRC state: False
Setting WRC to int 0, got 0, new state: False
Setting WRC to int 1, got -1, new state: True
Setting WRC to int 0, got 0, new state: False
Setting WRC to int 2, got -1, new state: True
Setting WRC to int 0, got 0, new state: False
Setting WRC to int 5, got -1, new state: True
Setting WRC to int 0, got 0, new state: False
Setting WRC to int 3000, got -1, new state: True
Setting WRC to int 0, got 0, new state: False
Setting WRC to int 0, got 0, new state: False
WRC state: False
Explicitly, there seems to be no error when sending 3000 to the API (i understand, that it's an 8 bit type, I'd have expected an exception here, but did not dive further in the code. Maybe python casts this implicitly, but honestly, its probably beside the point. If we define the argument as bool, this will be of no more importance. The Int 3000 correctly runs on an error, the current master code does check this beforehand, so that the 3000 never reaches the E3DC RSCP code. I beg your pardon here, I had another piece of code in my mind.
Essentially, if we break it down to zero/nonzero, we are identical. What I think is, that there are subtle details in the hardware, one returning 0x01 for active, the other 0xFF. I'll rebase this branch onto the current master and build you a new proposal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new version of this branch should now fix this. current test output:
WRC state: False
Setting WRC to int 0, got 0, new state: False
Setting WRC to int 1, got 0, new state: True
Setting WRC to int 0, got 0, new state: False
Setting WRC to int 2, got 0, new state: True
Setting WRC to int 0, got 0, new state: False
Setting WRC to int 5, got 0, new state: True
Setting WRC to int 0, got 0, new state: False
Setting WRC to int 3000, got 0, new state: True
Setting WRC to int 0, got 0, new state: False
Setting WRC to int 0, got 0, new state: False
WRC state: False
This should now correctly give us the result state. Unfortunately, I could not bring the E3DC to actually return an error (no idea how I can get the call to fail), but the happy path does work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't remember that we hand an inconsistency in the past. AFAIK E3DC does ship the same firmware for the different S10 models.
Which model and release version do you have?
It would be great to find other folks to comment on their observations before proceeding.
FWIW the E3DC support was helpful in the past to shed some light on these topics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Contacting support is a good idea (even though I've got one open ticket for 2-3 weeks now w/o response, but not trying will be even less helpful). Unfortunately, in the RSCP-Tags-Official.xlsm there is no clear documentation on the return value. It sure sounds that it schould return the current value.
I've got an S10E from 2015, Firmware Version S10_2023_02, Serial Number starts with 4515... What do you use?
aadd95c
to
df22fef
Compare
- normalize all arguments to a boolean - fix result code detection, some E3DCs report active weather regulation as 1, others as -1 - result code is the new state of weather regulated charging, so we deduce the success value bycomparing with the originally requested value. - Update source code comments accordingly.
@vchrisb How should we continue here, I still think we have some different behviour here depending on unit type. If this is easier for you, we could also take this discussion offline and do it in German language. |
If you need to test with yet another device (S10 X Compact 14), feel free to contact me :-) |
A number of fixes done for my HA integration to work cleanly.
fixes #73: