Closed demjandav closed 2 years ago
That is because Tag objects are returned and not just the value of the tag. And the truthiness represents the success of the request, so if you successfully read the tag then it would evaluate to True and if there was an error or something then it would be False. To get the actual value of the tag, you need to get it from the .value
attribute.
Try running this code:
valami = plc.read('valami')
if valami:
print(f'valami={valami.value}')
else:
print(f'failed to read valami: {valami.error}')
Thanks so much it helped a lot.
Hi I would like to ask you if it is possible to use a PLC tag for If statement?
In this case it is always true:
Thank you for help. BR David