Skip to content

How to get Enum value in OPC #1221

Answered by schroeder-
MatthewBoss96 asked this question in Q&A
Discussion options

You must be logged in to vote

You need to pass the nodeid of your enumtype to add_variable:

async def EnumTest(self, server, idx:int, name:str) -> Struct: 
     enum_node = await new_enum(server, idx, name, [ "UNDEFINED", "GOOD", "BAD", ]) 
     self.EnumTest(self.server, self.idx, "EnumerateTest")
     await self.server.load_data_type_definitions()  
     await self.add_variable(self.Test, self.idx, "EnumTest", "Test for enumerate", ua.EnumerateTest.UNDEFINED, enum_node)

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@AndreasHeine
Comment options

@schroeder-
Comment options

@MatthewBoss96
Comment options

@AndreasHeine
Comment options

@MatthewBoss96
Comment options

Answer selected by MatthewBoss96
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants