text: /**
   * Test/Demo Homebridge-MQTTThing Codec (encoder/decoder)
   * Codecs allow custom logic to be applied to accessories in mqttthing, rather like apply() functions, 
   * but in the convenience of a stand-alone JavaScript file.
   */
  
   'use strict';
  
  /**
   * Initialise codec for accessory
   * @param {object} params Initialisation parameters object
   * @param {function} params.log Logging function
   * @param {object} params.config Configuration
   * @return {object} Encode and/or decode functions
   */
  function init( params ) {
      // extract parameters for convenience
      let { log, config } = params;
  
      setTimeout( () => {
          log( `Hello from test-codec.js. This is ${config.name}.` );
      }, 10000 );
  
      /**
       * Encode message before sending.
       * The output function may be called to deliver an encoded value for the property later.
       * @param {string} message Message from mqttthing to be published to MQTT
       * @param {object} info Object giving contextual information
       * @param {string} info.topic MQTT topic to be published
       * @param {string} info.property Property associated with publishing operation
       * @param {function} output Function which may be called to deliver the encoded value asynchronously
       * @returns {string} Processed message (optionally)
       */
      function encode( message, info, output ) {
          log( `encode() called for topic ${info.topic}, property ${info.property} with message ${message}` );
  
          // in this example we just delay publishing
          setTimeout( () => { 
              output( message );
          }, 1000 );
      }
  
      /**
       * Decode received message, and optionally return decoded value.
       * The output function may be called to deliver a decoded value for the property later.
       * @param {string} message Message received from MQTT
       * @param {object} info Object giving contextual information
       * @param {string} info.topic MQTT topic received
       * @param {string} info.property Property associated with subscription
       * @param {function} output Function which may be called to deliver the decoded value asynchronously
       * @returns {string} Processed message (optionally)
       */
      function decode( message, info, output ) { // eslint-disable-line no-unused-vars
          log( `decode() called for topic ${info.topic}, property ${info.property} with message ${message}` );
  
          // in this example we just delay passing the received mesage on to homebridge
          setTimeout( () => {
              output( message );
          }, 500 );
      }
      
      // return encode and decode functions
      return { encode, decode };
  }
  
  // export initialisation function
  module.exports = {
      init
  };
  