From 949832cb17d9a18c2a3d671e0c454cd8b5fb0166 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Tue, 2 Apr 2024 13:33:47 +0200
Subject: [PATCH] Let power_hierarchy be outmost decorator to work around it
 failing to be wrapped by device_metrics

---
 .../devices/base_device_classes/lofar_device.py                 | 2 +-
 .../tangostationcontrol/devices/station_manager.py              | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tangostationcontrol/tangostationcontrol/devices/base_device_classes/lofar_device.py b/tangostationcontrol/tangostationcontrol/devices/base_device_classes/lofar_device.py
index 406046c85..739ac0dca 100644
--- a/tangostationcontrol/tangostationcontrol/devices/base_device_classes/lofar_device.py
+++ b/tangostationcontrol/tangostationcontrol/devices/base_device_classes/lofar_device.py
@@ -161,6 +161,7 @@ class AttributePoller:
         return await self._poll()
 
 
+@power_hierarchy
 @device_logging_to_python()
 @device_metrics(
     exclude=[
@@ -172,7 +173,6 @@ class AttributePoller:
         "available_in_power_state_R",
     ]
 )
-@power_hierarchy
 class LOFARDevice(Device):
     """
 
diff --git a/tangostationcontrol/tangostationcontrol/devices/station_manager.py b/tangostationcontrol/tangostationcontrol/devices/station_manager.py
index 314ba0fb8..a5a8d1fba 100644
--- a/tangostationcontrol/tangostationcontrol/devices/station_manager.py
+++ b/tangostationcontrol/tangostationcontrol/devices/station_manager.py
@@ -30,13 +30,13 @@ logger = logging.getLogger()
 __all__ = ["StationManager"]
 
 
+@power_hierarchy_control
 @device_logging_to_python()
 @device_metrics(
     exclude=[
         "last_requested_transition_exceptions_R",
     ]
 )
-@power_hierarchy_control
 class StationManager(AsyncDevice):
     """StationManager Device Server for LOFAR2.0"""
 
-- 
GitLab