diff --git a/README.md b/README.md index a6ff51ff9532d71f1e1b675e481d7a05caedf724..9ad42dfab7d9d9e4c1180775232d19d0725f28fa 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,7 @@ Next change the version in the following places: # Release Notes +* 0.42.7 Prevent Prometheus name collision in ProtectionControl state attribute * 0.42.6 Fix crash caused by emitting change events for attributes polled by Tango * 0.42.5 Add additional features to protection control * 0.42.4 Add integration test fixture that routinely tests against cross test dependencies diff --git a/tangostationcontrol/VERSION b/tangostationcontrol/VERSION index e4e9a42eb61a0200e9e386700de77c7f438fcf29..6028e3fe54dc09cdf4b68290140d73650d32328f 100644 --- a/tangostationcontrol/VERSION +++ b/tangostationcontrol/VERSION @@ -1 +1 @@ -0.42.6 +0.42.7 diff --git a/tangostationcontrol/tangostationcontrol/devices/protection_control.py b/tangostationcontrol/tangostationcontrol/devices/protection_control.py index dba1916a6d6d8aab0e716cbc4fd845849f4fa786..621a5580283962162805ec664cf5e7d26ed4d6ea 100644 --- a/tangostationcontrol/tangostationcontrol/devices/protection_control.py +++ b/tangostationcontrol/tangostationcontrol/devices/protection_control.py @@ -126,12 +126,12 @@ class ProtectionControl(LOFARDevice): # Attributes # ---------- - @attribute(dtype=ProtectionStateEnum, fisallowed="is_attribute_access_allowed") - def state_R(self): + @attribute(dtype=ProtectionStateEnum) + def protection_state_R(self): if self._protection_manager: - return self._protection_manager.state + return int(self._protection_manager.state) else: - return ProtectionStateEnum.DEACTIVATED + return int(ProtectionStateEnum.DEACTIVATED) @attribute( doc="Whether the station is periodically evaluated against damage", @@ -194,7 +194,7 @@ class ProtectionControl(LOFARDevice): "this value can be extremely stale!", dtype=str, ) - def last_threshold_device_attribute(self): + def last_threshold_device_attribute_R(self): return self._metrics.threshold_device_attribute # -------- diff --git a/tangostationcontrol/test/devices/test_protection_control_device.py b/tangostationcontrol/test/devices/test_protection_control_device.py index 7f06d5110c1a4af6271d711d352ecdc5a2818929..eed4590ffa3c643684d03f580aa0763e1ede5691 100644 --- a/tangostationcontrol/test/devices/test_protection_control_device.py +++ b/tangostationcontrol/test/devices/test_protection_control_device.py @@ -9,6 +9,7 @@ from tango.test_context import DeviceTestContext from tangostationcontrol.common.constants import DEFAULT_POLLING_PERIOD_MS from tangostationcontrol.devices import protection_control +from tangostationcontrol.protection.state import ProtectionStateEnum from test.devices import device_base @@ -35,6 +36,21 @@ class TestProtectionControlDevice(device_base.DeviceTestCase): self.assertTrue(proxy.protection_monitor_thread_running_R) + def test_protection_control_state(self, _database): + + with DeviceTestContext( + protection_control.ProtectionControl, + process=False, + timeout=10, + ) as proxy: + + self.assertEqual(ProtectionStateEnum.DEACTIVATED, proxy.protection_state_R) + + proxy.initialise() + proxy.on() + + self.assertEqual(ProtectionStateEnum.OFF, proxy.protection_state_R) + def test_periodic_reattempt(self, _database): with DeviceTestContext( protection_control.ProtectionControl,