-
Notifications
You must be signed in to change notification settings - Fork 9
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
Comments
@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? |
Np. Thank for coming back on this. Two objectives: |
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 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 |
Thank you I’ll check into that.
Have a good day,
Olivier
|
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
The text was updated successfully, but these errors were encountered: