def read_publish_sensor_data():
    """ Function used to read sensor data and publish the readings to a topic
    served by an MQTT server.
    """

    # MQTT client publisher
    mqtt_publisher = MQTTPublisher()

    sensor_serial = ini_config.get("Sensor", "SENSOR_TEMPERATURE_SERIAL")
    sleep_timeout = ini_config.getint("Sensor", "SENSOR_SLEEP_TIME")

    # start daemon forever loop
    while True:

        try:
            # read and publish sensor reading to topic in MQTT server
            logging.debug("publishing sensor serial [{0}] data".format(sensor_serial))

            mqtt_publisher.publish_temperature(sensor_serial)

        except (Exception) as err:
            sys.stderr.write(str(err))
            logging.exception("Error reading/publishing sensor data. [{0}]".format(err))

        except:  # catch *all* other exceptions
            err = sys.exc_info()[0]
            logging.exception("Error occurred in mqtt daemon: [{0}]".format(err))

            write_to_file("<p>Error in mqttpublisher daemon: [{0}]</p>".format(err), sys.stderr)

        time.sleep(sleep_timeout)

    return