Poll a C-Bus Temperature Sensor

Poll a C-Bus Temperature Sensor

  1. ashleigh
    For those who want to know...

    This is some magic to read a C-Bus Temperature Sensor and get the temperature out of it.

    This is unsupported. If you do not understand this or it does not work for you, do not seek support from Clipsal.

    Introductory Comments

    The C-Bus Temperature sensor was designed a long time ago, and does not broadcast its measurements onto C-Bus. You have to poll the device.

    Polling of C-Bus devices is hugely frowned upon, so you must be very very careful.

    If you poll the temperature sensor, make sure you read it NO MORE frequently than once per minute.

    Step 1.

    Find, through whatever nefarious means, the unit address of your temperature sensor. This example assumes the temperature sensor is on the same network as your PCI.

    Step 2.

    Issue the following special magic command to the PCI on the local network:


    Where <unit> is the unit address you found, expressed as 2 hex digits. For example, to read the temperature from unit address 42 (decimal 66), the command would be:


    Step 3.

    If the temperature sensor is present on that address you will get an answer back. The format of the answer will depend on how the PCI has been set up. It should look like this:


    where <unit> is the unit address you sent in Step 2, <byte> is 2 hex characters you can ignore, and <val1> and <val2> encode the temperature. For example, if you receive a reply of :


    This means :
    - Unit Address = 42 Hexadecimal (66 decimal)
    - val1 = 19 Hexadecimal (25 decimal)
    - val2 = 77 Hexadecimal (119 decimal)

    Step 4.

    Decode the temperature:

    <val1> and <val2> are each 2 hex characters, which you need to convert to bytes.

    <val1> is a signed number in the range -128 to +127, and represents whole degrees C.

    <val2> is an unsigned number in the range 0 .. 255, and represents the fractional part of the temperature in 1/256'ths of a degree.

    In the example above, the temperature is found from:

    Temp = val1 + val2 / 256
    = 25 + 119/256
    = 25.46C