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

Add support for ALIAS #33

Open
oh-thinky opened this issue Jul 17, 2024 · 4 comments
Open

Add support for ALIAS #33

oh-thinky opened this issue Jul 17, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@oh-thinky
Copy link

Super usefull SDK as we have 750+ PLC connected thru KEPServers.

It would be even greater to cover the whole configuration process by providing a way to CRUD KEPServer aliases.
I tried to set it up within the device DATA struct without any success.

Any roadmap for this one ?
Thx

@rlabbeptc
Copy link
Collaborator

@oh-thinky Thanks for the feedback. Sorry I missed the notification, but it is certainly something that could be added.

What are you using aliases for?

@rlabbeptc rlabbeptc added the enhancement New feature or request label Dec 2, 2024
@oh-thinky
Copy link
Author

Np. Thank for coming back on this.
We use aliases to standardise naming of the underlying PLC.

Two objectives:
1- Independence from the subcontractor's PLC Name set in KEPWare : it allows us to automate the SCADA configuration's address path without having to query KEPServer (as it wasn't possible when we started 7 yrs ago) or even, configure the SCADA before the PLC is implemented.
2- It also shorten the access paths for the SCADA (AVEVA in our case)

@rlabbeptc
Copy link
Collaborator

Makes sense. I'll look to add that subset sometime soon.

You can hack this in temporarily by using the internal methods for the server class instance. You just need to manually build the URL, which shouldn't be too hard, since it's /config/v1/project/aliases

Here's an example of reading the aliases. I didn't do any exception handling but you'll get the HTTP/URL exceptions if the calls fail:

from kepconfig.connection import server

server =  server(host = 'localhost', port = 57412, user = 'Administrator', pw = '', https=False)

# server.url will return http://host:port/config/v1
# Get Aliases
r = server._config_get(server.url + '/project/aliases')
print (r.payload)

# Add Alias
alias = {
    "common.ALLTYPES_NAME": "Test",
    "common.ALLTYPES_DESCRIPTION": "",
    "servermain.ALIAS_MAPPED_TO": "Channel1.Device1",
    "servermain.ALIAS_SCAN_RATE_MILLISECONDS": 0
}

r = server._config_add(server.url + '/project/aliases', alias)
print(r.reason)

# Change Alias
alias["servermain.ALIAS_MAPPED_TO"] = 'Channel2.Device1'
alias['FORCE_UPDATE'] = True

r = server._config_update(server.url + '/project/aliases' +'/'+ alias['common.ALLTYPES_NAME'], alias)
print(r.reason)

# Delete Alias
r= server._config_del(server.url + '/project/aliases' +'/'+ alias['common.ALLTYPES_NAME'])
print(r.reason)

We also developed an API viewer that could be helpful as well if you need to look at the data models and urls of the API here

@oh-thinky
Copy link
Author

oh-thinky commented Dec 4, 2024 via email

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

No branches or pull requests

2 participants