..
 #############################################################
 # This file was automatically generated on 2015-05-08.      #
 #                                                           #
 # If you have a bugfix for this file and want to commit it, #
 # please fix the bug in the generator. You can find a link  #
 # to the generators git repository on tinkerforge.com       #
 #############################################################


:breadcrumbs: <a href="../../index.html">Home</a> / <a href="../../index.html#software-modbus">Software</a> / Modbus - Temperature IR Bricklet

.. |device_identifier_constant| unicode:: 0xA0
   :trim:

.. _temperature_ir_bricklet_modbus:

Modbus - Temperature IR Bricklet
================================

This is the description of the :ref:`Modbus protocol <llproto_modbus>` for the :ref:`Temperature IR Bricklet <temperature_ir_bricklet>`. General information and technical
specifications for the Temperature IR Bricklet are summarized in its :ref:`hardware description
<temperature_ir_bricklet_description>`.

.. _temperature_ir_bricklet_modbus_api:

API
---

A general description of the Modbus protocol structure can be found
:ref:`here <llproto_modbus>`.




Basic Functions
^^^^^^^^^^^^^^^



.. modbus:function:: BrickletTemperatureIR.get_ambient_temperature

 :functionid: 1
 :emptyrequest: empty payload

 :response temperature: int16

 Returns the ambient temperature of the sensor. The value
 has a range of -400 to 1250 and is given in °C/10,
 e.g. a value of 423 means that an ambient temperature of 42.3 °C is 
 measured.
 
 If you want to get the ambient temperature periodically, it is recommended 
 to use the callback :modbus:func:`CALLBACK_AMBIENT_TEMPERATURE <BrickletTemperatureIR.CALLBACK_AMBIENT_TEMPERATURE>` and set the period with 
 :modbus:func:`set_ambient_temperature_callback_period <BrickletTemperatureIR.set_ambient_temperature_callback_period>`.
 
.. modbus:function:: BrickletTemperatureIR.get_object_temperature

 :functionid: 2
 :emptyrequest: empty payload

 :response temperature: int16

 Returns the object temperature of the sensor, i.e. the temperature
 of the surface of the object the sensor is aimed at. The value
 has a range of -700 to 3800 and is given in °C/10,
 e.g. a value of 3001 means that a temperature of 300.1 °C is measured
 on the surface of the object.
 
 The temperature of different materials is dependent on their `emissivity 
 <http://en.wikipedia.org/wiki/Emissivity>`__. The emissivity of the material
 can be set with :modbus:func:`set_emissivity <BrickletTemperatureIR.set_emissivity>`.
 
 If you want to get the object temperature periodically, it is recommended 
 to use the callback :modbus:func:`CALLBACK_OBJECT_TEMPERATURE <BrickletTemperatureIR.CALLBACK_OBJECT_TEMPERATURE>` and set the period with 
 :modbus:func:`set_object_temperature_callback_period <BrickletTemperatureIR.set_object_temperature_callback_period>`.
 


Advanced Functions
^^^^^^^^^^^^^^^^^^

.. modbus:function:: BrickletTemperatureIR.set_emissivity

 :functionid: 3
 :request emissivity: uint16

 :noresponse: no response

 Sets the `emissivity <http://en.wikipedia.org/wiki/Emissivity>`__ that is
 used to calculate the surface temperature as returned by 
 :modbus:func:`get_object_temperature <BrickletTemperatureIR.get_object_temperature>`. 
 
 The emissivity is usually given as a value between 0.0 and 1.0. A list of
 emissivities of different materials can be found 
 `here <http://www.infrared-thermography.com/material.htm>`__.
 
 The parameter of :modbus:func:`set_emissivity <BrickletTemperatureIR.set_emissivity>` has to be given with a factor of
 65535 (16-bit). For example: An emissivity of 0.1 can be set with the
 value 6553, an emissivity of 0.5 with the value 32767 and so on.
 
 .. note::
  If you need a precise measurement for the object temperature, it is
  absolutely crucial that you also provide a precise emissivity.
 
 The default emissivity is 1.0 (value of 65535) and the minimum emissivity the
 sensor can handle is 0.1 (value of 6553).
 
.. modbus:function:: BrickletTemperatureIR.get_emissivity

 :functionid: 4
 :emptyrequest: empty payload

 :response emissivity: uint16

 Returns the emissivity as set by :modbus:func:`set_emissivity <BrickletTemperatureIR.set_emissivity>`.
 
.. modbus:function:: BrickletTemperatureIR.get_identity

 :functionid: 255
 :emptyrequest: empty payload

 :response uid: char[8]
 :response connected_uid: char[8]
 :response position: char
 :response hardware_version: uint8[3]
 :response firmware_version: uint8[3]
 :response device_identifier: uint16

 Returns the UID, the UID where the Bricklet is connected to, 
 the position, the hardware and firmware version as well as the
 device identifier.
 
 The position can be 'a', 'b', 'c' or 'd'.
 
 The device identifier numbers can be found :ref:`here <device_identifier>`.
 |device_identifier_constant|
 


Callback Configuration Functions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^



.. modbus:function:: BrickletTemperatureIR.set_ambient_temperature_callback_period

 :functionid: 5
 :request period: uint32

 :noresponse: no response

 Sets the period in ms with which the :modbus:func:`CALLBACK_AMBIENT_TEMPERATURE <BrickletTemperatureIR.CALLBACK_AMBIENT_TEMPERATURE>` callback is triggered
 periodically. A value of 0 turns the callback off.
 
 :modbus:func:`CALLBACK_AMBIENT_TEMPERATURE <BrickletTemperatureIR.CALLBACK_AMBIENT_TEMPERATURE>` is only triggered if the temperature has changed since the
 last triggering.
 
 The default value is 0.
 
.. modbus:function:: BrickletTemperatureIR.get_ambient_temperature_callback_period

 :functionid: 6
 :emptyrequest: empty payload

 :response period: uint32

 Returns the period as set by :modbus:func:`set_ambient_temperature_callback_period <BrickletTemperatureIR.set_ambient_temperature_callback_period>`.
 
.. modbus:function:: BrickletTemperatureIR.set_object_temperature_callback_period

 :functionid: 7
 :request period: uint32

 :noresponse: no response

 Sets the period in ms with which the :modbus:func:`CALLBACK_OBJECT_TEMPERATURE <BrickletTemperatureIR.CALLBACK_OBJECT_TEMPERATURE>` callback is triggered
 periodically. A value of 0 turns the callback off.
 
 :modbus:func:`CALLBACK_OBJECT_TEMPERATURE <BrickletTemperatureIR.CALLBACK_OBJECT_TEMPERATURE>` is only triggered if the temperature has changed since the
 last triggering.
 
 The default value is 0.
 
.. modbus:function:: BrickletTemperatureIR.get_object_temperature_callback_period

 :functionid: 8
 :emptyrequest: empty payload

 :response period: uint32

 Returns the period as set by :modbus:func:`set_object_temperature_callback_period <BrickletTemperatureIR.set_object_temperature_callback_period>`.
 
.. modbus:function:: BrickletTemperatureIR.set_ambient_temperature_callback_threshold

 :functionid: 9
 :request option: char
 :request min: int16
 :request max: int16

 :noresponse: no response

 Sets the thresholds for the :modbus:func:`CALLBACK_AMBIENT_TEMPERATURE_REACHED <BrickletTemperatureIR.CALLBACK_AMBIENT_TEMPERATURE_REACHED>` callback. 
 
 The following options are possible:
 
 .. csv-table::
  :header: "Option", "Description"
  :widths: 10, 100
 
  "'x'",    "Callback is turned off"
  "'o'",    "Callback is triggered when the ambient temperature is *outside* the min and max values"
  "'i'",    "Callback is triggered when the ambient temperature is *inside* the min and max values"
  "'<'",    "Callback is triggered when the ambient temperature is smaller than the min value (max is ignored)"
  "'>'",    "Callback is triggered when the ambient temperature is greater than the min value (max is ignored)"
 
 The default value is ('x', 0, 0).
 
.. modbus:function:: BrickletTemperatureIR.get_ambient_temperature_callback_threshold

 :functionid: 10
 :emptyrequest: empty payload

 :response option: char
 :response min: int16
 :response max: int16

 Returns the threshold as set by :modbus:func:`set_ambient_temperature_callback_threshold <BrickletTemperatureIR.set_ambient_temperature_callback_threshold>`.
 
.. modbus:function:: BrickletTemperatureIR.set_object_temperature_callback_threshold

 :functionid: 11
 :request option: char
 :request min: int16
 :request max: int16

 :noresponse: no response

 Sets the thresholds for the :modbus:func:`CALLBACK_OBJECT_TEMPERATURE_REACHED <BrickletTemperatureIR.CALLBACK_OBJECT_TEMPERATURE_REACHED>` callback. 
 
 The following options are possible:
 
 .. csv-table::
  :header: "Option", "Description"
  :widths: 10, 100
 
  "'x'",    "Callback is turned off"
  "'o'",    "Callback is triggered when the object temperature is *outside* the min and max values"
  "'i'",    "Callback is triggered when the object temperature is *inside* the min and max values"
  "'<'",    "Callback is triggered when the object temperature is smaller than the min value (max is ignored)"
  "'>'",    "Callback is triggered when the object temperature is greater than the min value (max is ignored)"
 
 The default value is ('x', 0, 0).
 
.. modbus:function:: BrickletTemperatureIR.get_object_temperature_callback_threshold

 :functionid: 12
 :emptyrequest: empty payload

 :response option: char
 :response min: int16
 :response max: int16

 Returns the threshold as set by :modbus:func:`set_object_temperature_callback_threshold <BrickletTemperatureIR.set_object_temperature_callback_threshold>`.
 
.. modbus:function:: BrickletTemperatureIR.set_debounce_period

 :functionid: 13
 :request debounce: uint32

 :noresponse: no response

 Sets the period in ms with which the threshold callbacks
 
 * :modbus:func:`CALLBACK_AMBIENT_TEMPERATURE_REACHED <BrickletTemperatureIR.CALLBACK_AMBIENT_TEMPERATURE_REACHED>`,
 * :modbus:func:`CALLBACK_OBJECT_TEMPERATURE_REACHED <BrickletTemperatureIR.CALLBACK_OBJECT_TEMPERATURE_REACHED>`
 
 are triggered, if the thresholds
 
 * :modbus:func:`set_ambient_temperature_callback_threshold <BrickletTemperatureIR.set_ambient_temperature_callback_threshold>`,
 * :modbus:func:`set_object_temperature_callback_threshold <BrickletTemperatureIR.set_object_temperature_callback_threshold>`
 
 keep being reached.
 
 The default value is 100.
 
.. modbus:function:: BrickletTemperatureIR.get_debounce_period

 :functionid: 14
 :emptyrequest: empty payload

 :response debounce: uint32

 Returns the debounce period as set by :modbus:func:`set_debounce_period <BrickletTemperatureIR.set_debounce_period>`.
 


.. _temperature_ir_bricklet_modbus_callbacks:

Callbacks
^^^^^^^^^

.. modbus:function:: BrickletTemperatureIR.CALLBACK_AMBIENT_TEMPERATURE

 :functionid: 15

 :response temperature: int16


 This callback is triggered periodically with the period that is set by
 :modbus:func:`set_ambient_temperature_callback_period <BrickletTemperatureIR.set_ambient_temperature_callback_period>`. The response value is the ambient
 temperature of the sensor.
 
 :modbus:func:`CALLBACK_AMBIENT_TEMPERATURE <BrickletTemperatureIR.CALLBACK_AMBIENT_TEMPERATURE>` is only triggered if the ambient temperature
 has changed since the last triggering.
 
.. modbus:function:: BrickletTemperatureIR.CALLBACK_OBJECT_TEMPERATURE

 :functionid: 16

 :response temperature: int16


 This callback is triggered periodically with the period that is set by
 :modbus:func:`set_object_temperature_callback_period <BrickletTemperatureIR.set_object_temperature_callback_period>`. The response value is the object
 temperature of the sensor.
 
 :modbus:func:`CALLBACK_OBJECT_TEMPERATURE <BrickletTemperatureIR.CALLBACK_OBJECT_TEMPERATURE>` is only triggered if the object temperature
 has changed since the last triggering.
 
.. modbus:function:: BrickletTemperatureIR.CALLBACK_AMBIENT_TEMPERATURE_REACHED

 :functionid: 17

 :response temperature: int16


 This callback is triggered when the threshold as set by
 :modbus:func:`set_ambient_temperature_callback_threshold <BrickletTemperatureIR.set_ambient_temperature_callback_threshold>` is reached.
 The response value is the ambient temperature of the sensor.
 
 If the threshold keeps being reached, the callback is triggered periodically
 with the period as set by :modbus:func:`set_debounce_period <BrickletTemperatureIR.set_debounce_period>`.
 
.. modbus:function:: BrickletTemperatureIR.CALLBACK_OBJECT_TEMPERATURE_REACHED

 :functionid: 18

 :response temperature: int16


 This callback is triggered when the threshold as set by
 :modbus:func:`set_object_temperature_callback_threshold <BrickletTemperatureIR.set_object_temperature_callback_threshold>` is reached.
 The response value is the object temperature of the sensor.
 
 If the threshold keeps being reached, the callback is triggered periodically
 with the period as set by :modbus:func:`set_debounce_period <BrickletTemperatureIR.set_debounce_period>`.
 


