private void doPublish() 
	{				
		// fetch the publishing configuration from the publishing properties
		String  topic  = (String) m_properties.get(PUBLISH_TOPIC_PROP_NAME);
		Integer qos    = (Integer) m_properties.get(PUBLISH_QOS_PROP_NAME);
		Boolean retain = (Boolean) m_properties.get(PUBLISH_RETAIN_PROP_NAME);
		String    mode = (String)  m_properties.get(MODE_PROP_NAME);
		
		// Increment the simulated temperature value
		float setPoint = 0;
		float tempIncr = (Float) m_properties.get(TEMP_INCREMENT_PROP_NAME);
		if (MODE_PROP_PROGRAM.equals(mode)) {
			setPoint = (Float) m_properties.get(PROGRAM_SETPOINT_NAME);
		}
		else if (MODE_PROP_MANUAL.equals(mode)) {
			setPoint = (Float) m_properties.get(MANUAL_SETPOINT_NAME);
		}
		else if (MODE_PROP_VACATION.equals(mode)) {
			setPoint = 6.0F;			
		}
		if (m_temperature + tempIncr < setPoint) {
			m_temperature += tempIncr;
		}
		else {
			m_temperature -= 4*tempIncr;
		}
				
		// Allocate a new payload
		KuraPayload payload = new KuraPayload();
		
		// Timestamp the message
		payload.setTimestamp(new Date());
		
		// Add the temperature as a metric to the payload
		payload.addMetric("temperatureInternal", m_temperature);
		payload.addMetric("temperatureExternal", 5.0F);
		payload.addMetric("temperatureExhaust",  30.0F);

		int code = m_random.nextInt();
		if ((m_random.nextInt() % 5) == 0) {
			payload.addMetric("errorCode", code);
		}
		else {
			payload.addMetric("errorCode", 0);
		}
		
		// Publish the message
		try {
			m_cloudClient.publish(topic, payload, qos, retain);
			s_logger.info("Published to {} message: {}", topic, payload);
		} 
		catch (Exception e) {
			s_logger.error("Cannot publish topic: "+topic, e);
		}
	}