Skip to content

Commit

Permalink
Auto set ServerTimestamp if value is written
Browse files Browse the repository at this point in the history
  • Loading branch information
Koseng authored and oroulet committed Mar 28, 2021
1 parent 78e8aeb commit 0a1cce0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions asyncua/server/address_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ async def write(self, params, user=User(role=UserRole.Admin)):
ua.ua_binary.test_bit(ual.Value.Value, ua.AccessLevel.CurrentWrite):
res.append(ua.StatusCode(ua.StatusCodes.BadUserAccessDenied))
continue
if not writevalue.Value.ServerTimestamp:
writevalue.Value.ServerTimestamp = datetime.utcnow()
res.append(
await self._aspace.write_attribute_value(writevalue.NodeId, writevalue.AttributeId, writevalue.Value))
return res
Expand Down

0 comments on commit 0a1cce0

Please sign in to comment.