I have an attribute called “port” that I can read and write to from a client successfully. As shown below, when this attribute is read (I have set up polling on it), it will print the name of this attribute, as well as the current attribute quality (which by default is ATTR_VALID.
I have also set up alarm levels for this attribute e.g.
min_value’ = ‘1’
max_value’ = ‘50000’
min_warning’ = ‘100’
max_warning’ = ‘20000’
min_alarm’ = ‘10’
max_alarm’ = ‘30000’
Externally from a client, I am changing the value of this port to test out the alarm system. When I change the values below/above these thresholds, I get an INFO log from the device server e.g.
“1431509771 [139644008130304] WARN test/device/1 MIN WARNING for attribute port”
“1431509819 [139644008130304] ERROR test/device/1 MAX ALARM for attribute port”
Based on the documentation here, I expect the attribute quality to change to ATTR_WARNING or ATTR_ALARM respectively. But this is not happening and the attribute still has an ATTR_VALID quality. On the other hand, the device state IS switching to Alarm (when previous state is ON). So something is definitely working as it should, except for attribute quality.
Thsi is the Tango kernel which is changing the attribute value from ATTR_VALID to ATTR_ALARM on the server side but after
the execution of your read_port() method and before the data are sent back on the network to the client. This is why in your
method you still see it as ATTR_VALID
But this may happen (maybe) the first time the quality changes from ATTR_VALID to ATTR_ALARM. Since I am re-polling read_port() continuously after the actual ATTR_ALARM is raised, I wonder why it is kept on being reported as ATTR_VALID in the device server, whilst it is correct AATR_ALARM when retrieved from the client. I keep polling read_port() every 3000 milliseconds, and yet the INFO stream keeps reporting ATTR_VALID.
I was wondering if you could give me generic advice on writing a Tango device. Assuming I have set alarm levels for certain attributes, the device state changes to ALARM when these levels are skipped. Assuming I take corrective measures on the same attribute, to bring the levels back down to an acceptable state, with a valid Quality for the attribute, the device state, by default, remains in ALARM mode.
What would be the ideal way of “listening” to what caused the alarm in the first place, taking measures to fix the alarm on the client side, and reverting the state of the device back to something like ON? Any sample code for such a listener is appreciated. I would like a sort of central listener for ALARMS that I can handle asynchronously when/if alarms occur.