From 78af0a205f1286ff207fe58aa2c418cfa79e974e Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Tue, 2 Nov 2021 14:43:58 +0100
Subject: [PATCH] L2SS-449: Add proxy to self, to allow client-like interaction
 from the device server.

---
 .../tangostationcontrol/devices/lofar_device.py          | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tangostationcontrol/tangostationcontrol/devices/lofar_device.py b/tangostationcontrol/tangostationcontrol/devices/lofar_device.py
index 8886abd8a..39a1ca4e8 100644
--- a/tangostationcontrol/tangostationcontrol/devices/lofar_device.py
+++ b/tangostationcontrol/tangostationcontrol/devices/lofar_device.py
@@ -95,6 +95,15 @@ class lofar_device(Device, metaclass=AbstractDeviceMetas):
         # trigger a write_{name} call. See https://www.tango-controls.org/community/forum/c/development/c/accessing-own-deviceproxy-class/?page=1#post-2021
         self.proxy = DeviceProxy(self.get_name())
 
+        # register a proxy to ourselves, to interact with
+        # our attributes and commands as a client would.
+        #
+        # this is required to get/set attributes.
+        #
+        # we cannot write directly to our attribute, as that would not
+        # trigger a write_{name} call. See https://www.tango-controls.org/community/forum/c/development/c/accessing-own-deviceproxy-class/?page=1#post-2021
+        self.proxy = DeviceProxy(self.get_name())
+
     @log_exceptions()
     def delete_device(self):
         """Hook to delete resources allocated in init_device.
-- 
GitLab