-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[ferroamp] Binding for Ferroamp 20241010 #17536
base: main
Are you sure you want to change the base?
Conversation
This is the binding for local connection to the Ferroamp Energy System Signed-off-by: Örjan Backsell <[email protected]>
Changes done in FerroampHandlerFactory.java Signed-off-by: Örjan Backsell <[email protected]>
Hi @lsiepel , |
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.
As it had some passes before i keep this short. Left comments mainly looking at the readme. Some suggestions need to be adapted on multiple places. The binding is improving, so good to see progress.
|
||
The following configuration parameters are available. | ||
|
||
| Name | Type | Description | Default | Required | Advanced | |
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.
According to the thing-types.xml the eso and esm parameters are missing.
Would be nice if these setting scould be auto detected by the binding instead of manually configuring.
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.
Changed in README.
I will think about auto detect.
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.
Eso and Esm modules seems not to be so very common so I think we leave these 2 as optional in configuration.
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.
Still wondering if you can in someway detect if SSO1-4, ESM or ESO is present by using the API ?
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.
20241115
Changes done regarded to SSO's, they are now detected automatically.
Eso and Esm modules seems not to be so very common so I think we leave these 2 as optional in configuration, and the very same for the battery.
bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/ferroamp.xml
Outdated
Show resolved
Hide resolved
Please, see each Conversion for latest answers. |
Changes done in README.md, 20241010 Örjan Backsell <[email protected]> Signed-off-by: Örjan Backsell <[email protected]>
Done changes in EhubParameters.java, FerroampBindingConstants.java, FerroampChannelConfiguration.java, ferroamp.xml, README.md Signed-off-by: Örjan Backsell <[email protected]>
Changes done in: EsmParameters.java EsoParameters.java ferroamp.xml FerroampBindingConstants.java FerroampChannelConfiguration.java README.md SsoParameters.java Signed-off-by: Örjan Backsell <[email protected]>
Changes done in README.md Signed-off-by: Örjan Backsell <[email protected]>
Changes done, Please see Reply...regarded to each conversion Signed-off-by: Örjan Backsell <[email protected]>
Changes done in FerroampHandler.java Signed-off-by: Örjan Backsell <[email protected]>
Please, see each Conversion for latest answers Signed-off-by: Örjan Backsell <[email protected]>
Hi, @lsiepel, finally have I found a solution for the, for me very embarrassing misstake to forgot about the first part of sign-off in one commit. |
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.
Another round with suggested improvements. Hopefully this will lead to more improvements. Please verify the changes you make match the asked changes or comment what you did and why, as that helps to speed up.
Have not yet looked at too much java code. I did notice quit verbose json handling with element indices and all that. Might be perfectly sane, but usually when you have json, it is best to use proper DTO's. But first let's fix the already made comments.
Oh yes, another question, did you consider to use channel groups ? They seem a perfect fit for the sso, as you could define 1 set of channels and duplicate it for each group.
} | ||
|
||
public static List<String> getChannelParametersEhub() { | ||
final List<String> channelParametersEhub = Arrays.asList("grid-frequency", "ace-current-l1", "ace-current-l2", |
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.
- This method does not seem to be used anywhere.
- Use the defined
FerroampBindingConstants
where possible.
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.
20241107
Deleted the class. Has been used earlier, but I have missed to delete it.
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.
Did you forget to push these changes as it is still there.
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.
20241111, Deleted
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.
20241115
I had a look at channel-groups, but I think it look like it's the very same lines just split into several xml files instead of one thing-types.xml
} | ||
|
||
public static List<String> getChannelParametersEsm() { | ||
final List<String> channelParametersEsm = Arrays.asList("esm-unique-identifier", "esm-soh", "esm-soc", |
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.
Please use the channel string constants defined in FerroampBindingConstants.java
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.
20241107
Deleted the class. Has been used earlier, but I have missed to delete it.
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.
20241111, Deleted
} | ||
|
||
public static List<String> getChannelParametersEso() { | ||
final List<String> channelParametersEso = Arrays.asList("eso-unique-identifier", "eso-measured-voltage-battery", |
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.
Please use the channel string constants defined in FerroampBindingConstants.java
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.
20241107
Deleted the class. Has been used earlier, but I have missed to delete it.
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.
20241111, Deleted
public class SsoParameters { | ||
|
||
public static List<String> getChannelParametersSso() { | ||
final List<String> channelParametersSs0 = Arrays.asList("id", "measured-voltage-pv-string", |
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.
Please use the channel string constants defined in FerroampBindingConstants.java
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.
20241107
Deleted the class. Has been used earlier, but I have missed to delete it.
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.
20241111, Deleted
...ab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java
Outdated
Show resolved
Hide resolved
|
||
private void startMqttConnection() throws InterruptedException { | ||
try { | ||
TimeUnit.SECONDS.sleep(10); |
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.
What is the purpose of this sleep ?
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.
20241107
It seems like the broker in the Ferroamp EnergyHub need some time to start sending.
There will be an complaining about that MqttBrokerConnection localSubscribeConnection in method getMQTT in ferroampMqttComminication is null otherwise
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 would suggest that two lines of getMQTT
is moved to this startMqttConnection()
method, as these lines should only be fired once. and not for each subscription?!
localSubscribeConnection.start();
localSubscribeConnection.setCredentials(ferroampConfig.userName, ferroampConfig.password);
getMQTT
should also be renamed to subscribeTopic
(or something similar)
Besides the above, this sleep
still bothers me. First i looked at the MQTT bindings and could not find anything similar, but they are totally different in setup. Adn then i asked myseldf why is this no subbindingof mqtt just like the others? Like mqtt.ferroamp did you consider this and can you share some insights why not?
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 problems with that it seems like I have to wait for broker to start sending. (I have no system on mine own so I use one at a friend, might be a reason for the delay, but thats just a guess).
Anyhow, the sleep was an emergency solution to handle this delay, but I think I found another solution, Please have a look in FerroampHandler.java.
I have changed the name to getSubscribedTopic.
Sleep and scheduler.execute(() -> {.... is both now taken away due to that both were regarded to my tries to handle the delays.
When I started with this binding did I found some solution( don't remember which ) simiilar to this one. I have then down the road also seen the mqtt.x solution, but I thought that I shall continue to do it the way I have started, so actually no reasons, other then I think that has been a way for me as nopro to get any kind of a working and for me understandable solution.
...ding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampConfiguration.java
Outdated
Show resolved
Hide resolved
public class EsoParameters { | ||
public String jsonPostEso; | ||
|
||
public EsoParameters(String jsonPostEso) { |
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.
- This method does not seem to be used anywhere.
- Use the defined FerroampBindingConstants where possible.
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.
20241107
Deleted this class, it's not used anymore
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.
Still there.
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.
20241111 Deleted
this.jsonPostEsm = jsonPostEsm; | ||
} | ||
|
||
public static List<String> getChannelParametersEsm() { |
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.
- This method does not seem to be used anywhere.
- Use the defined FerroampBindingConstants where possible.
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.
20241107
Deleted this class, it's not used anymore
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.
Still there.
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.
20241111 Deleted
Changes done in: EhubJsonElements.java EsmJsonElements.java EsoJsonElements.java ferroamp.properties FerroampBindingConstants.java FerroampChannelConfiguration.java FerroampConfiguration.java FerroampHandler.java FerroampMqttCommunication.java SsoJsonElements.java thing-types.xml Signed-off-by: Örjan Backsell <[email protected]>
Please see above, I think I have answered all of your suggestions. Btw, Thanks! |
Changes done in: FerroampHandler.java FerroampMqttCommunication.java README.md Signed-off-by: Örjan Backsell <[email protected]>
2024111 |
Done changes in: FerroampConfiguration.java FerroampHandler.java FerroampMqttCommunication.java README.md Signed-off-by: Örjan Backsell <[email protected]>
2024115 |
This is the binding for local connection to the Ferroamp Energy System