# AttributeProxy

class tango.AttributeProxy(*args, green_mode=None)

  AttributeProxy is the high level Tango object which provides the client with an easy-to-use interface to TANGO attributes.

  To create an AttributeProxy, a complete attribute name must be set in the object constructor.

  Example:

    att = AttributeProxy(“tango/tangotest/1/long_scalar”)

  Note: PyTango implementation of AttributeProxy is in part a python reimplementation of the AttributeProxy found on the C++ API.

  delete_property(*args, **kwds)

    Delete a the given of properties for this attribute. :param value: Can be one of the following:

    > 1. `str` [in] - Single property data to be deleted.

    > 2. `DbDatum` [in] - Single property data to be deleted.

    > 3. `DbData` [in] - Several property data to be deleted.

    > 4. `list`[`str` | `bytes` | `DbDatum`] [in] - Several property data to be deleted.

    > 5. `dict`[`str`, `object`] [in] - Keys are property names to be deleted (values are ignored).

    > 6. `dict`[`str`, `tango.DbDatum`] [in] - Several DbDatum.name are property names to be deleted (keys are ignored).

    Throws:

      `TypeError`: Raised in case of value has the wrong type.

      `tango.NonDbDevice`: Raised in case of a non-database device error.

      `tango.ConnectionFailed`: Raised on connection failure with the database.

      `tango.CommunicationFailed`: Raised on communication failure with the database.

      `tango.DevFailed`: Raised on a device failure from the database device.`

  event_queue_size(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().event_queue_size(…)

    For convenience, here is the documentation of DeviceProxy.event_queue_size(…): event_queue_size (self: tango._tango.DeviceProxy, event_id: typing.SupportsInt) -> `int`

    event_queue_size (self, event_id) -> `int`

    Returns the number of stored events in the event reception buffer. After every call to DeviceProxy.get_events(), the event queue size is 0. During event subscription the client must have chosen the ‘pull model’ for this event. event_id is the event identifier returned by the DeviceProxy.subscribe_event() method.

    Parameters:
      event_id:

        (`int`) event identifier

    Return:

      an integer with the queue size

    Throws:

      `EventSystemFailed`

    New in PyTango 7.0.0

  get_config(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().get_attribute_config(self.name(), …)

    For convenience, here is the documentation of DeviceProxy.get_attribute_config(…):

    get_attribute_config(self, name, green_mode=None, wait=True, timeout=None) -> AttributeInfoEx get_attribute_config(self, names, green_mode=None, wait=True, timeout=None) -> AttributeInfoList

    Return the attribute configuration for a single or a list of attribute(s). To get all the attributes pass a sequence containing the constant `tango.constants.AllAttr`

    Deprecated: use get_attribute_config_ex instead

    Parameters:

      - name (str) – Attribute name.

      - names (sequence<str>) – Attribute names.

      - green_mode (`tango.GreenMode`, optional) – Defaults to the current tango GreenMode. Refer to `get_green_mode()` and `set_green_mode()` for more details.

      - wait (bool, optional) – Specifies whether to wait for the result. If green_mode is Synchronous, this parameter is ignored as the operation always waits for the result. This parameter is also ignored when green_mode is Synchronous.

      - timeout (float, optional) – The number of seconds to wait for the result. If set to None, there is no limit on the wait time. This parameter is ignored when green_mode is Synchronous or when wait is False.

    Returns:

      An AttributeInfoEx or AttributeInfoList object containing the attribute(s) information.

    Return type:

      Union[`tango.AttributeInfoEx`, `tango.AttributeInfoList`]

    Throws:

      `tango.ConnectionFailed`: Raised in case of a connection failure.

    Throws:

      `tango.CommunicationFailed`: Raised in case of a communication failure.

    Throws:

      `tango.DevFailed`: Raised in case of a device failure.

    Throws:

      TypeError: Raised in case of an incorrect type of input arguments.

    Throws:

      `TimeoutError`: (green_mode == Futures) If the future didn’t finish executing before the given timeout.

    Throws:

      `Timeout`: (green_mode == Gevent) If the async result didn’t finish executing before the given timeout.

  get_device_proxy(self) → DeviceProxy

    A method which returns the device associated to the attribute

    Parameters:

      None

    Return:

      (`DeviceProxy`)

  get_events(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().get_events(…)

    For convenience, here is the documentation of DeviceProxy.get_events(…):

    get_events (self, event_id, callback=None, extract_as=Numpy) -> `None`

    The method extracts all waiting events from the event reception buffer.

    If callback is not None, it is executed for every event. During event subscription the client must have chosen the pull model for this event. The callback will receive a parameter of type EventData, AttrConfEventData or DataReadyEventData depending on the type of the event (event_type parameter of subscribe_event).

    If callback is None, the method extracts all waiting events from the event reception buffer. The returned event_list is a vector of EventData, AttrConfEventData or DataReadyEventData pointers, just the same data the callback would have received.

    Parameters:

      - event_id (int) – The event identifier returned by the DeviceProxy.subscribe_event() method.

      - callback (callable) – Any callable object or any object with a “push_event” method.

      - extract_as (`tango.ExtractAs`) – (Description Needed)

    Returns:

      None

    Throws:

      `tango.EventSystemFailed`: Raised in case of a failure in the event system.

    Throws:

      TypeError: Raised in case of an incorrect type of input arguments.

    Throws:

      ValueError: Raised in case of an invalid value.

    See also:

      `subscribe_event()`

  get_last_event_date(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().get_last_event_date(…)

    For convenience, here is the documentation of DeviceProxy.get_last_event_date(…): get_last_event_date (self: tango._tango.DeviceProxy, event_id: typing.SupportsInt) -> `tango._tango.TimeVal`

    get_last_event_date (self, event_id) -> `TimeVal`

    Returns the arrival time of the last event stored in the event reception buffer. After every call to DeviceProxy:get_events(), the event reception buffer is empty. In this case an exception will be returned. During event subscription the client must have chosen the ‘pull model’ for this event. event_id is the event identifier returned by the DeviceProxy.subscribe_event() method.

    Parameters:
      event_id:

        (`int`) event identifier

    Return:

      (`tango.TimeVal`) representing the arrival time

    Throws:

      `EventSystemFailed`

    New in PyTango 7.0.0

  get_poll_period(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().get_attribute_poll_period(self.name(), …)

    For convenience, here is the documentation of DeviceProxy.get_attribute_poll_period(…): get_attribute_poll_period(self: tango._tango.DeviceProxy, attr_name: str) -> int

    get_attribute_poll_period(self, attr_name) -> int

    Return the attribute polling period.

    Parameters:
      attr_name:

        (`str`) attribute name

    Return:

      polling period in milliseconds

  get_property(*args, **kwds)

    Get a (list) property(ies) for an attribute.

    Parameters:

      - propname –

        Can be one of the following:

        1. `str` [in] - Single property data to be fetched.

        2. `DbDatum` [in] - Single property data to be fetched.

        3. `DbData` [in] - Several property data to be fetched.

        4. `list`[`str` | `bytes`] [in] - Several property data to be fetched.

        5. `list`[`tango.DbDatum`] [in] - Several property data to be fetched.

        6. `dict`[`str`, `object`] [in] - Keys are property names to be fetched (values are ignored).

        7. `dict`[`str`, `tango.DbDatum`] [in] - Several DbDatum.name are property names to be fetched (keys are ignored).

      - value (`tango.DbData`, optional) – Optional. For propname overloads with `str` and `list`[`str`] will be filed with the property values, if provided.

    Returns:

      A `dict` object, which keys are the property names the value associated with each key being a sequence of strings being the property value.

    Throws:

      `TypeError`: Raised in case of propname has the wrong type.

      `tango.NonDbDevice`: Raised in case of a non-database device error.

      `tango.ConnectionFailed`: Raised on connection failure with the database.

      `tango.CommunicationFailed`: Raised on communication failure with the database.

      `tango.DevFailed`: Raised on a device failure from the database device.`

    Added in version 10.1.0:: overloads with `dict` as propname parameter

    Changed in version 10.1.0:: raises if propname has an invalid type instead of returning None

  get_transparency_reconnection(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().get_transparency_reconnection(…)

    For convenience, here is the documentation of DeviceProxy.get_transparency_reconnection(…): get_transparency_reconnection (self: tango._tango.Connection) -> `bool`

    get_transparency_reconnection (self) -> `bool`

    Returns the device transparency reconnection flag.

    Parameters:

      None

    Return:

      (`bool`) True if transparency reconnection is set or False otherwise

  history(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().attribute_history(self.name(), …)

    For convenience, here is the documentation of DeviceProxy.attribute_history(…): attribute_history(self: tango._tango.DeviceProxy, attr_name: str, depth: typing.SupportsInt, extract_as: tango._tango.ExtractAs = ExtractAs.Numpy) -> object

    attribute_history(self, attr_name, depth, extract_as=ExtractAs.Numpy) -> sequence<DeviceAttributeHistory>

    Retrieve attribute history from the attribute polling buffer. See chapter on Advanced Feature for all details regarding polling

    Parameters:
      attr_name:

        (`str`) Attribute name.

      depth:

        (`int`) The wanted history depth.

      extract_as:

        (`ExtractAs`)

    Return:

      This method returns a vector of DeviceAttributeHistory types.

    Throws:

      `NonSupportedFeature`, `ConnectionFailed`, `CommunicationFailed`, `DevFailed` from device

  is_event_queue_empty(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().is_event_queue_empty(…)

    For convenience, here is the documentation of DeviceProxy.is_event_queue_empty(…): is_event_queue_empty (self: tango._tango.DeviceProxy, event_id: typing.SupportsInt) -> `bool`

    is_event_queue_empty (self, event_id) -> `bool`

    Returns true when the event reception buffer is empty. During event subscription the client must have chosen the ‘pull model’ for this event. event_id is the event identifier returned by the DeviceProxy.subscribe_event() method.

    Parameters:
      event_id:

        (`int`) event identifier

    Return:

      (`bool`) True if queue is empty or False otherwise

    Throws:

      `EventSystemFailed`

    New in PyTango 7.0.0

  is_polled(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().is_attribute_polled(self.name(), …)

    For convenience, here is the documentation of DeviceProxy.is_attribute_polled(…): is_attribute_polled(self: tango._tango.DeviceProxy, attr_name: str) -> bool

    is_attribute_polled(self, attr_name) -> bool

    True if the attribute is polled.

    Parameters:

      attr_name (str) – attribute name

    Returns:

      boolean value

    Return type:

      bool

  name(self) → str

    Returns the attribute name

    Parameters:

      None

    Return:

      (`str`) with the attribute name

  ping(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().ping(…)

    For convenience, here is the documentation of DeviceProxy.ping(…):

    ping (self, green_mode=None, wait=True, timeout=None) -> `DevState`

    A method which sends a ping to the device

    Parameters:

      - green_mode (`tango.GreenMode`, optional) – Defaults to the current tango GreenMode. Refer to `get_green_mode()` and `set_green_mode()` for more details.

      - wait (bool, optional) – Specifies whether to wait for the result. If green_mode is Synchronous, this parameter is ignored as the operation always waits for the result. This parameter is also ignored when green_mode is Synchronous.

      - timeout (float, optional) – The number of seconds to wait for the result. If set to None, there is no limit on the wait time. This parameter is ignored when green_mode is Synchronous or when wait is False.

    Returns:

      time elapsed in microseconds

    Return type:

      int

    Throws:

      `TimeoutError`: (green_mode == Futures) If the future didn’t finish executing before the given timeout.

    Throws:

      `Timeout`: (green_mode == Gevent) If the async result didn’t finish executing before the given timeout.

  poll(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().poll_attribute(self.name(), …)

    For convenience, here is the documentation of DeviceProxy.poll_attribute(…): poll_attribute(self: tango._tango.DeviceProxy, attr_name: str, period: typing.SupportsInt) -> None

    poll_attribute(self, attr_name, period) -> None

    Add an attribute to the list of polled attributes.

    Parameters:
      attr_name:

        (`str`) attribute name

      period:

        (`int`) polling period in milliseconds

    Return:

      None

  put_property(*args, **kwds)

    Insert or update a list of properties for this attribute.

    Parameters:

      value –

      Can be one of the following:

      1. `str` - Single property data to be inserted.

      2. `DbDatum` - Single property data to be inserted.

      3. `DbData` - Several property data to be inserted.

      4. `list`[`str` | `bytes` | `DbDatum`] - Several property data to be inserted.

      5. `dict`[`str`, `DbDatum`] -

           DbDatum is property to be inserted (keys are ignored).

      6. `dict`[`str`, `list`[`str`]] - Keys are property names,

           and value has data to be inserted.

      7. `dict`[`str`, `object`] - Keys are property names, and str(obj) is property value.

    Throws:

      `TypeError`: Raised in case of value has the wrong type.

      `tango.NonDbDevice`: Raised in case of a non-database device error.

      `tango.ConnectionFailed`: Raised on connection failure with the database.

      `tango.CommunicationFailed`: Raised on communication failure with the database.

      `tango.DevFailed`: Raised on a device failure from the database device.`

  read(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().read_attribute(self.name(), …)

    For convenience, here is the documentation of DeviceProxy.read_attribute(…):

    read_attribute(self, value, extract_as=ExtractAs.Numpy, green_mode=None, wait=True, timeout=None) -> DeviceAttribute

    Read a single attribute.

    Parameters:

      - value (str) – The name of the attribute to read.

      - extract_as (`tango.ExtractAs`) – Defaults to numpy.

      - green_mode (`tango.GreenMode`, optional) – Defaults to the current tango GreenMode. Refer to `get_green_mode()` and `set_green_mode()` for more details.

      - wait (bool, optional) – Specifies whether to wait for the result. If green_mode is Synchronous, this parameter is ignored as the operation always waits for the result. This parameter is also ignored when green_mode is Synchronous.

      - timeout (float, optional) – The number of seconds to wait for the result. If set to None, there is no limit on the wait time. This parameter is ignored when green_mode is Synchronous or when wait is False.

    Returns:

      DeviceAttribute object with read attribute value.

    Return type:

      `tango.DeviceAttribute`

    Throws:

      `tango.ConnectionFailed`: Raised in case of a connection failure.

    Throws:

      `tango.CommunicationFailed`: Raised in case of a communication failure.

    Throws:

      `tango.DevFailed`: Raised in case of a device failure.

    Throws:

      `TimeoutError`: (green_mode == Futures) If the future didn’t finish executing before the given timeout.

    Throws:

      `Timeout`: (green_mode == Gevent) If the async result didn’t finish executing before the given timeout.

    Changed in version 7.1.4: For DevEncoded attributes, before it was returning a DeviceAttribute.value as a tuple (format<str>, data<str>) no matter what was the extract_as value was. Since 7.1.4, it returns a (format<str>, data<buffer>) unless extract_as is String, in which case it returns (format<str>, data<str>).

    Changed in version 8.0.0: For DevEncoded attributes, now returns a DeviceAttribute.value as a tuple (format<str>, data<bytes>) unless extract_as is String, in which case it returns (format<str>, data<str>). Careful, if using python >= 3 data<str> is decoded using default python utf-8 encoding. This means that PyTango assumes tango DS was written encapsulating string into utf-8 which is the default python encoding.

    Added in version 8.1.0: green_mode parameter. wait parameter. timeout parameter.

    Changed in version 9.4.0: For spectrum and image attributes with an empty sequence, no longer returns DeviceAttribute.value and DeviceAttribute.w_value as `None`. Instead, DevString and DevEnum types get an empty `tuple`, while other types get an empty `numpy.ndarray`. Using extract_as can change the sequence type, but it still won’t be `None`.

  read_asynch(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().read_attribute_asynch(self.name(), …)

    For convenience, here is the documentation of DeviceProxy.read_attribute_asynch(…):

    read_attribute_asynch(self, attr_name, green_mode=None, wait=True, timeout=None) -> int read_attribute_asynch(self, attr_name, cb, extract_as=Numpy, green_mode=None, wait=True, timeout=None) -> None

    Read asynchronously the specified attributes.

    New in PyTango 7.0.0

    Important

    by default, TANGO is initialized with the polling model. If you want to use the push model (the one with the callback parameter), you need to change the global TANGO model to PUSH_CALLBACK. You can do this with the `tango.ApiUtil.set_asynch_cb_sub_model()`

    Parameters:

      - attr_name (str) – an attribute to read

      - cb (Optional[Callable]) – push model: as soon as attributes read, core calls cb with read results. This callback object should be an instance of a user class with an attr_read() method. It can also be any callable object.

      - extract_as (ExtractAs) – Defaults to numpy.

      - green_mode (`tango.GreenMode`, optional) – Defaults to the current tango GreenMode. Refer to `get_green_mode()` and `set_green_mode()` for more details.

      - wait (bool, optional) – Specifies whether to wait for the result. If green_mode is Synchronous, this parameter is ignored as the operation always waits for the result. This parameter is also ignored when green_mode is Synchronous.

      - timeout (float, optional) – The number of seconds to wait for the result. If set to None, there is no limit on the wait time. This parameter is ignored when green_mode is Synchronous or when wait is False.

    Returns:

      an asynchronous call identifier which is needed to get attribute value if poll model, None if push model

    Return type:

      Union[int, None]

    Throws:

      `tango.ConnectionFailed`

    Throws:

      `TimeoutError`: (green_mode == Futures) If the future didn’t finish executing before the given timeout.

    Throws:

      `Timeout`: (green_mode == Gevent) If the async result didn’t finish executing before the given timeout.

    Important

    Multiple asynchronous calls are not guaranteed to be executed by the device server in the same order they are invoked by the client. E.g., a call to the method `write_attribute_asynch("a", 1)` followed immediately with a call to `read_attribute_asynch("a")` could result in the device reading the attribute `a` before writing to it.

  read_reply(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().read_attribute_reply(…)

    For convenience, here is the documentation of DeviceProxy.read_attribute_reply(…):

    read_attribute_reply(self, id, extract_as=ExtractAs.Numpy, green_mode=None, wait=True, timeout=None) -> DeviceAttribute read_attribute_reply(self, id, poll_timeout, extract_as=ExtractAs.Numpy, green_mode=None, wait=True, timeout=None) -> DeviceAttribute

    Get the answer of an asynchronous read_attribute call, if it has arrived (polling model).

    If the reply is ready, but the attribute raised an exception while reading, an exception will be raised by this function (DevFailed, with reason API_AttrValueNotSet).

    Changed in version 7.0.0: New in PyTango

    Changed in version 10.0.0: To eliminate confusion between different timeout parameters, the core (cppTango) timeout (previously the optional second positional argument) has been renamed to “poll_timeout”. Conversely, the pyTango executor timeout remains as the keyword argument “timeout”. These parameters have distinct meanings and units:

    - The cppTango “poll_timeout” is measured in milliseconds and blocks the call until a reply is received. If the reply is not received within the specified poll_timeout duration, an exception is thrown. Setting poll_timeout to 0 causes the call to wait indefinitely until a reply is received.

    - The pyTango “timeout” is measured in seconds and is applicable only in asynchronous GreenModes (Asyncio, Futures, Gevent), and only when “wait” is set to True. The specific behavior when a reply is not received within the specified timeout period varies depending on the GreenMode.

    Parameters:

      - id (int) – the asynchronous call identifier

      - poll_timeout (Optional[int]) – cppTango core timeout in ms. If the reply has not yet arrived, the call will wait for the time specified (in ms). If after timeout, the reply is still not there, an exception is thrown. If timeout set to 0, the call waits until the reply arrives. If the argument is not provided, then there is no timeout check, and an exception is raised immediately if the reply is not ready.

      - extract_as (ExtractAs) – Defaults to numpy.

      - green_mode (`tango.GreenMode`, optional) – Defaults to the current tango GreenMode. Refer to `get_green_mode()` and `set_green_mode()` for more details.

      - wait (bool, optional) – Specifies whether to wait for the result. If green_mode is Synchronous, this parameter is ignored as the operation always waits for the result. This parameter is also ignored when green_mode is Synchronous.

      - timeout (float, optional) – The number of seconds to wait for the result. If set to None, there is no limit on the wait time. This parameter is ignored when green_mode is Synchronous or when wait is False.

    Returns:

      If the reply is arrived and if it is a valid reply, it is returned to the caller in a list of DeviceAttribute. If the reply is an exception, it is re-thrown by this call. If the reply is not yet arrived, the call will wait (blocking the process) for the time specified in timeout. If after timeout milliseconds, the reply is still not there, an exception is thrown. If timeout is set to 0, the call waits until the reply arrived.

    Return type:

      `tango.DeviceAttribute`

    Throws:

      Union[AsynCall, AsynReplyNotArrived, ConnectionFailed, CommunicationFailed, DevFailed]

  set_config(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().set_attribute_config(…)

    For convenience, here is the documentation of DeviceProxy.set_attribute_config(…):

    set_attribute_config(self, attr_info, green_mode=None, wait=True, timeout=None) -> None set_attribute_config(self, attr_info_ex, green_mode=None, wait=True, timeout=None) -> None

    Change the attribute configuration/extended attribute configuration for the specified attribute(s)

    Parameters:

      - attr_info (Union[`tango.AttributeInfo`, Sequence[`tango.AttributeInfo`]], optional) – Attribute information. This parameter is used when providing basic attribute(s) information.

      - attr_info_ex (Union[`tango.AttributeInfoEx`, Sequence[`tango.AttributeInfoEx`]], optional) – Extended attribute information. This parameter is used when providing extended attribute information. It should not be used simultaneously with ‘attr_info’.

      - green_mode (`tango.GreenMode`, optional) – Defaults to the current tango GreenMode. Refer to `get_green_mode()` and `set_green_mode()` for more details.

      - wait (bool, optional) – Specifies whether to wait for the result. If green_mode is Synchronous, this parameter is ignored as the operation always waits for the result. This parameter is also ignored when green_mode is Synchronous.

      - timeout (float, optional) – The number of seconds to wait for the result. If set to None, there is no limit on the wait time. This parameter is ignored when green_mode is Synchronous or when wait is False.

    Returns:

      None

    Throws:

      `tango.ConnectionFailed`: Raised in case of a connection failure.

    Throws:

      `tango.CommunicationFailed`: Raised in case of a communication failure.

    Throws:

      `tango.DevFailed`: Raised in case of a device failure.

    Throws:

      TypeError: Raised in case of an incorrect type of input arguments.

    Throws:

      `TimeoutError`: (green_mode == Futures) If the future didn’t finish executing before the given timeout.

    Throws:

      `Timeout`: (green_mode == Gevent) If the async result didn’t finish executing before the given timeout.

  set_transparency_reconnection(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().set_transparency_reconnection(…)

    For convenience, here is the documentation of DeviceProxy.set_transparency_reconnection(…): set_transparency_reconnection (self: tango._tango.Connection, yesno: bool) -> `None`

    set_transparency_reconnection (self, yesno) -> `None`

    Set the device transparency reconnection flag

    Parameters:

      “ - val : (bool) True to set transparency reconnection “ or False otherwise

    Return:

      None

  state(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().state(…)

    For convenience, here is the documentation of DeviceProxy.state(…):

    state (self, green_mode=None, wait=True, timeout=None) -> `DevState`

    A method which returns the state of the device.

    Parameters:

      - green_mode (`tango.GreenMode`, optional) – Defaults to the current tango GreenMode. Refer to `get_green_mode()` and `set_green_mode()` for more details.

      - wait (bool, optional) – Specifies whether to wait for the result. If green_mode is Synchronous, this parameter is ignored as the operation always waits for the result. This parameter is also ignored when green_mode is Synchronous.

      - timeout (float, optional) – The number of seconds to wait for the result. If set to None, there is no limit on the wait time. This parameter is ignored when green_mode is Synchronous or when wait is False.

    Returns:

      A DevState constant.

    Return type:

      DevState

    Throws:

      `TimeoutError`: (green_mode == Futures) If the future didn’t finish executing before the given timeout.

    Throws:

      `Timeout`: (green_mode == Gevent) If the async result didn’t finish executing before the given timeout.

  status(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().status(…)

    For convenience, here is the documentation of DeviceProxy.status(…):

    status (self, green_mode=None, wait=True, timeout=None) -> `str`

    A method which returns the status of the device as a string.

    Parameters:

      - green_mode (`tango.GreenMode`, optional) – Defaults to the current tango GreenMode. Refer to `get_green_mode()` and `set_green_mode()` for more details.

      - wait (bool, optional) – Specifies whether to wait for the result. If green_mode is Synchronous, this parameter is ignored as the operation always waits for the result. This parameter is also ignored when green_mode is Synchronous.

      - timeout (float, optional) – The number of seconds to wait for the result. If set to None, there is no limit on the wait time. This parameter is ignored when green_mode is Synchronous or when wait is False.

    Returns:

      string describing the device status

    Return type:

      str

    Throws:

      `TimeoutError`: (green_mode == Futures) If the future didn’t finish executing before the given timeout.

    Throws:

      `Timeout`: (green_mode == Gevent) If the async result didn’t finish executing before the given timeout.

  stop_poll(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().stop_poll_attribute(self.name(), …)

    For convenience, here is the documentation of DeviceProxy.stop_poll_attribute(…): stop_poll_attribute(self: tango._tango.DeviceProxy, attr_name: str) -> None

    stop_poll_attribute(self, attr_name) -> None

    Remove an attribute from the list of polled attributes.

    Parameters:
      attr_name:

        (`str`) attribute name

    Return:

      None

  subscribe_event(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().subscribe_event(self.name(), …)

    For convenience, here is the documentation of DeviceProxy.subscribe_event(…):

    subscribe_event (self, attr_name, event_type, cb, sub_mode=EventSubMode.SyncRead, extract_as=ExtractAs.Numpy, *, green_mode=None, wait=True, timeout=None) -> `int`

    subscribe_event (self, attr_name, event_type, queuesize, sub_mode=EventSubMode.SyncRead, extract_as=ExtractAs.Numpy, *, green_mode=None, wait=True, timeout=None) -> `int`

    subscribe_event (self, event_type, cb, sub_mode=EventSubMode.SyncRead, *, green_mode=None, wait=True, timeout=None) -> `int`

    Note

    This function is heavily overloaded, and includes three additional signatures that have been deprecated (see warning below).

    The client call to subscribe for event reception. There are two main categories:

    - Subscribe to events for a specific attribute, like change events, providing either:

      - a callback function for immediate notification (push callback model), or

      - a queue length, allowing events to be processed later (pull callback model).

    - Subscribe to device-level events (not linked to a specific attribute), like interface-changed events. These require a callback function (push callback model).

    More details of the push and pull callback models are provided in the .

    Parameters:

      - attr_name (str) – The device attribute name which will be sent as an event, e.g., “current”.

      - event_type (`tango.EventType`) –

        The event reason, which must be one of the enumerated values in EventType. This includes:

        - EventType.CHANGE_EVENT

        - EventType.ALARM_EVENT

        - EventType.PERIODIC_EVENT

        - EventType.ARCHIVE_EVENT

        - EventType.USER_EVENT

        - EventType.DATA_READY_EVENT

        - EventType.ATTR_CONF_EVENT

        - EventType.INTERFACE_CHANGE_EVENT

      - cb (callable) – Any callable object or an object with a callable `push_event` method (i.e., use the push callback model). The callable has the signature `def cb(event)` (or `async def cb(event)` for asyncio green mode DeviceProxy objects). The `event` parameter’s data type depends on the type of event subscribed to. In most cases it is `tango.EventData`. Special cases are EventType.DATA_READY, EventType.ATTR_CONF_EVENT, and EventType.INTERFACE_CHANGE_EVENT - see Event arrived structures.

      - queuesize (int) –

        The size of the event reception buffer (i.e., use the pull callback model). The event reception buffer is implemented as a round-robin buffer. This way the client can set up different ways to receive events:

        - Event reception buffer size = 1 : The client is interested only in the value of the last event received. All other events that have been received since the last reading are discarded.

        - Event reception buffer size > 1 : The client has chosen to keep an event history of a given size. When more events arrive since the last reading, older events will be discarded.

        - Event reception buffer size = tango.constants.ALL_EVENTS : The client buffers all received events. The buffer size is unlimited and only restricted by the available memory for the client.

      - sub_mode (`tango.EventSubMode`) – The event subscription mode.

      - extract_as (ExtractAs) – In which format to return the attribute values. Default: ExtractAs.NumPy

      - green_mode (`tango.GreenMode`, optional) – Defaults to the current tango GreenMode. Refer to `get_green_mode()` and `set_green_mode()` for more details.

      - wait (bool, optional) – Specifies whether to wait for the result. If green_mode is Synchronous, this parameter is ignored as the operation always waits for the result. This parameter is also ignored when green_mode is Synchronous.

      - timeout (float, optional) – The number of seconds to wait for the result. If set to None, there is no limit on the wait time. This parameter is ignored when green_mode is Synchronous or when wait is False.

    Returns:

      An event id which has to be specified when unsubscribing from this event.

    Return type:

      int

    Throws:

      `tango.EventSystemFailed`: Raised in case of a failure in the event system.

    Throws:

      `tango.DevFailed`: Raised in case of general communication failures.

    Throws:

      `TypeError`: Raised in case of an incorrect type of input arguments.

    Throws:

      `TimeoutError`: (green_mode == Futures) If the future didn’t finish executing before the given timeout.

    Throws:

      `Timeout`: (green_mode == Gevent) If the async result didn’t finish executing before the given timeout.

    Deprecated since version PyTango: 10.1.0

    The following signatures, which use the `filters` and/or `stateless` parameters, are deprecated. The version for removal has not been decided, but the earliest is version 11.0.0.

    - subscribe_event(self, attr_name, event_type, cb, filters=[], stateless=False, extract_as=ExtractAs.Numpy, green_mode=None, wait=True, timeout=None) -> int

    - subscribe_event(self, attr_name, event_type, queuesize, filters=[], stateless=False, extract_as=ExtractAs.Numpy, green_mode=None, wait=True, timeout=None) -> int

    - subscribe_event(self, event_type, cb, stateless=False, *, green_mode=None, wait=True, timeout=None) -> int

    `filters` (sequence<str>)

      The filters apply to the original Notifd-based event system, not the current ZeroMQ-based event system (added in Tango 8). Notifd support is scheduled for removal in Tango 11.

      A variable length list of name-value pairs which define additional filters for events. Provide an empty list, if this feature is not needed (typically, for all Tango servers from version 8).

      Filters cannot be used with the sub_mode parameter.

    `stateless` (bool)

      Instead of setting `stateless=True` use `sub_mode=EventSubMode.Stateless`.

      When this flag is set to false, an exception will be thrown if the event subscription encounters a problem. With the stateless flag set to true, the event subscription will not raise an exception, even if the corresponding device is not running, or the attribute doesn’t exist. A keep-alive thread will attempt to subscribe for the specified event every 10 seconds, executing a callback with the corresponding exception at every retry.

      The `stateless` flag cannot be used with the sub_mode parameter.

    Added in version 10.1.0: Three new signatures using the sub_mode parameter.

    Changed in version 10.1.0: All parameters can now be passed as keyword arguments.

  unsubscribe_event(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().unsubscribe_event(…)

    For convenience, here is the documentation of DeviceProxy.unsubscribe_event(…):

    unsubscribe_event (self, event_id, green_mode=None, wait=True, timeout=None) -> `None`

    Unsubscribes a client from receiving the event specified by event_id.

    Parameters:

      - event_id (int) – The event identifier returned by DeviceProxy::subscribe_event(). Unlike in TangoC++, this implementation checks that the event_id has been subscribed to in this DeviceProxy.

      - green_mode (`tango.GreenMode`, optional) – Defaults to the current tango GreenMode. Refer to `get_green_mode()` and `set_green_mode()` for more details.

      - wait (bool, optional) – Specifies whether to wait for the result. If green_mode is Synchronous, this parameter is ignored as the operation always waits for the result. This parameter is also ignored when green_mode is Synchronous.

      - timeout (float, optional) – The number of seconds to wait for the result. If set to None, there is no limit on the wait time. This parameter is ignored when green_mode is Synchronous or when wait is False.

    Returns:

      None

    Throws:

      `tango.EventSystemFailed`: Raised in case of a failure in the event system.

    Throws:

      KeyError: Raised if the specified event_id is not found or not subscribed in this DeviceProxy.

    Throws:

      `TimeoutError`: (green_mode == Futures) If the future didn’t finish executing before the given timeout.

    Throws:

      `Timeout`: (green_mode == Gevent) If the async result didn’t finish executing before the given timeout.

  write(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().write_attribute(self.name(), …)

    For convenience, here is the documentation of DeviceProxy.write_attribute(…):

    write_attribute(self, attr, value, green_mode=None, wait=True, timeout=None) -> None

    Write a single attribute.

    Parameters:

      - attr (str | `tango.AttributeInfoEx`) – The name or AttributeInfoEx structure of the attribute to write.

      - value (Any) – The value to write to the attribute.

      - green_mode (`tango.GreenMode`, optional) – Defaults to the current tango GreenMode. Refer to `get_green_mode()` and `set_green_mode()` for more details.

      - wait (bool, optional) – Specifies whether to wait for the result. If green_mode is Synchronous, this parameter is ignored as the operation always waits for the result. This parameter is also ignored when green_mode is Synchronous.

      - timeout (float, optional) – The number of seconds to wait for the result. If set to None, there is no limit on the wait time. This parameter is ignored when green_mode is Synchronous or when wait is False.

    Throws:

      `tango.ConnectionFailed`, `tango.CommunicationFailed`, `tango.DeviceUnlocked`:

    Throws:

      `tango.DevFailed`: from device

    Throws:

      `TimeoutError`: (green_mode == Futures) If the future didn’t finish executing before the given timeout.

    Throws:

      `Timeout`: (green_mode == Gevent) If the async result didn’t finish executing before the given timeout.

    Added in version 8.1.0: green_mode parameter. wait parameter. timeout parameter.

    Changed in version 10.1.0: attr_name parameter was renamed to attr

  write_asynch(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().write_attribute_asynch(self.name(), …)

    For convenience, here is the documentation of DeviceProxy.write_attribute_asynch(…):

    Write asynchronously the specified attribute.

    Important

    by default, TANGO is initialized with the polling model. If you want to use the push model (the one with the callback parameter), you need to change the global TANGO model to PUSH_CALLBACK. You can do this with the `tango.ApiUtil.set_asynch_cb_sub_model()`

    Parameters:

      - attr (str | `AttributeInfoEx`) – an attribute name to write or AttributeInfoEx object (see Note below)

      - value (Any) – value to write

      - cb (Optional[Callable]) – push model: as soon as attribute written, core calls cb with write results. This callback object should be an instance of a user class with an attr_written() method. It can also be any callable object.

      - green_mode (`tango.GreenMode`, optional) – Defaults to the current tango GreenMode. Refer to `get_green_mode()` and `set_green_mode()` for more details.

      - wait (bool, optional) – Specifies whether to wait for the result. If green_mode is Synchronous, this parameter is ignored as the operation always waits for the result. This parameter is also ignored when green_mode is Synchronous.

      - timeout (float, optional) – The number of seconds to wait for the result. If set to None, there is no limit on the wait time. This parameter is ignored when green_mode is Synchronous or when wait is False.

    Returns:

      an asynchronous call identifier which is needed to get the server reply if poll model, None if push model

    Return type:

      Union[int, None]

    Throws:

      ConnectionFailed

    Throws:

      `TimeoutError`: (green_mode == Futures) If the future didn’t finish executing before the given timeout.

    Throws:

      `Timeout`: (green_mode == Gevent) If the async result didn’t finish executing before the given timeout.

    Important

    Multiple asynchronous calls are not guaranteed to be executed by the device server in the same order they are invoked by the client. E.g., a call to the method `write_attribute_asynch("a", 1)` followed immediately with a call to `read_attribute_asynch("a")` could result in the device reading the attribute `a` before writing to it.

    Note

    There are two possibilities for the attr parameter: if you give attribute name, then PyTango will do additional synchronous(!) IO to fetch AttributeInfoEx object from device server, since we must know to which c++ data type cast python value. If you would like to avoid this IO you can give AttributeInfoEx instead of attribute name.

    Changed in version 10.1.0:

    - attr_name parameter was renamed to attr

    - added support for AttributeInfoEx for attr parameter

  write_read(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().write_read_attribute(self.name(), …)

    For convenience, here is the documentation of DeviceProxy.write_read_attribute(…):

    > Write then read a single attribute in a single network call. By default (serialisation by device), the execution of this call in the server can’t be interrupted by other clients.

    > param attr:

    >   The name or AttributeInfoEx structure of the attribute to write.

    > type attr:

    >   str | `AttributeInfoEx`

    > param value:

    >   The value to write to the attribute.

    > type value:

    >   Any

    > param green_mode:

    >   Defaults to the current tango GreenMode. Refer to `get_green_mode()` and `set_green_mode()` for more details.

    > type green_mode:

    >   `tango.GreenMode`, optional

    > param wait:

    >   Specifies whether to wait for the result. If green_mode is Synchronous, this parameter is ignored as the operation always waits for the result. This parameter is also ignored when green_mode is Synchronous.

    > type wait:

    >   bool, optional

    > param timeout:

    >   The number of seconds to wait for the result. If set to None, there is no limit on the wait time. This parameter is ignored when green_mode is Synchronous or when wait is False.

    > type timeout:

    >   float, optional

    > returns:

    >   A DeviceAttribute object with readout value.

    > rtype:

    >   `tango.DeviceAttribute`

    > throws:

    >   `tango.ConnectionFailed`: Raised in case of a connection failure.

    > throws:

    >   `tango.CommunicationFailed`: Raised in case of a communication failure.

    > throws:

    >   `tango.DeviceUnlocked`: Raised in case of an unlocked device.

    > throws:

    >   `tango.WrongData`: Raised in case of a wrong data format.

    > throws:

    >   `tango.DevFailed`: Raised in case of a device failure.

    > throws:

    >   TypeError: Raised in case of an incorrect type of input arguments.

    > throws:

    >   `TimeoutError`: (green_mode == Futures) If the future didn’t finish executing before the given timeout.

    > throws:

    >   `Timeout`: (green_mode == Gevent) If the async result didn’t finish executing before the given timeout.

    > Note

    > There are two possibilities for the attr parameter: if you give attribute name, then PyTango will do additional IO to fetch AttributeInfoEx object from device server, since we must know to which c++ data type cast python value. If you would like to avoid this IO you can give AttributeInfoEx instead of attribute name.

    Added in version 7.0.0.

    Added in version 8.1.0: green_mode parameter. wait parameter. timeout parameter.

    Changed in version 10.1.0:

    - attr_name parameter was renamed to attr

    - added support for AttributeInfoEx for attr parameter

  write_reply(*args, **kwds)
    This method is a simple way to do:

      self.get_device_proxy().write_attribute_reply(…)

    For convenience, here is the documentation of DeviceProxy.write_attribute_reply(…):

    write_attribute_reply(self, id, green_mode=None, wait=True, timeout=None) -> None write_attribute_reply(self, id, poll_timeout, green_mode=None, wait=True, timeout=None) -> None

    Check if the answer of an asynchronous write_attributes is arrived (polling model). If the reply is arrived and if it is a valid reply, the call returned. If the reply is an exception, it is re-thrown by this call. An exception is also thrown in case of the reply is not yet arrived.

    Changed in version 7.0.0: New in PyTango

    Changed in version 10.0.0: To eliminate confusion between different timeout parameters, the core (cppTango) timeout (previously the optional second positional argument) has been renamed to “poll_timeout”. Conversely, the pyTango executor timeout remains as the keyword argument “timeout”. These parameters have distinct meanings and units:

    - The cppTango “poll_timeout” is measured in milliseconds and blocks the call until a reply is received. If the reply is not received within the specified poll_timeout duration, an exception is thrown. Setting poll_timeout to 0 causes the call to wait indefinitely until a reply is received.

    - The pyTango “timeout” is measured in seconds and is applicable only in asynchronous GreenModes (Asyncio, Futures, Gevent), and only when “wait” is set to True. The specific behavior when a reply is not received within the specified timeout period varies depending on the GreenMode.

    Parameters:

      - id (int) – the asynchronous call identifier

      - poll_timeout (Optional[int]) – cppTango core timeout in ms. If the reply has not yet arrived, the call will wait for the time specified (in ms). If after timeout, the reply is still not there, an exception is thrown. If timeout set to 0, the call waits until the reply arrives. If the argument is not provided, then there is no timeout check, and an exception is raised immediately if the reply is not ready.

      - extract_as (ExtractAs) – Defaults to numpy.

      - green_mode (`tango.GreenMode`, optional) – Defaults to the current tango GreenMode. Refer to `get_green_mode()` and `set_green_mode()` for more details.

      - wait (bool, optional) – Specifies whether to wait for the result. If green_mode is Synchronous, this parameter is ignored as the operation always waits for the result. This parameter is also ignored when green_mode is Synchronous.

      - timeout (float, optional) – The number of seconds to wait for the result. If set to None, there is no limit on the wait time. This parameter is ignored when green_mode is Synchronous or when wait is False.

    Returns:

      None

    Return type:

      None

    Throws:

      Union[AsynCall, AsynReplyNotArrived, ConnectionFailed, CommunicationFailed, DevFailed]