module.exports = {
	decodeData: function(params) {

		var value = parseInt(params.data.substr(2), 16);
		value >>= 1;
		
		var temp = Math.round(((value & 0x7FFF) - 6400) / 128 * 100) / 100;
		value >>= 15;
		
		var humidity = (value & 0x7F);
		value >>= 7;

		var battOk = value & 0x1;
		value >>= 3;

		var channel = (value & 0x3)+1;
		value >>= 2;

		var house = value & 0xF;
		
		return Object.assign(params, {
			temperature: temp,
			humidity: humidity,
			batteryOk: battOk,
			channel: channel,
			house: house
		});
	}
}

//module.exports.decodeData('+Wclass:sensor;protocol:mandolyn;model:temperaturehumidity;data:0x7F8E5043;');

function normalizeDeviceId(params) {
	return `mandolyn/${params.house}/${params.channel}`;
}
function normalizeDevice(params) {
	var pubs = [];
	var deviceId = normalizeDeviceId(params);

	pubs.push({
		topic: deviceId + '/temperature',
		payload: params.temperature
	});
	pubs.push({
		topic: deviceId + '/humidity',
		payload: params.humidity
	});
	/*pubs.push({
		topic: deviceId + '/batteryOk',
		payload: ~~params.batteryOk
	});*/

	return pubs;
}


module.exports = {
	decodeData: function(params) {
		var tempAndParity = parseInt(params.data.substr(6), 16);
		var parity =  (tempAndParity & 0b0000000000000001);
		var temp   = ((tempAndParity & 0b1111111111111110) >> 1) / 128 - 50; 

		var humidityAndBattOk = parseInt(params.data.substr(4, 2), 16);
		var humidity  = (humidityAndBattOk & 0b01111111);
		var batteryOk = (humidityAndBattOk & 0b10000000) >> 8;

		var channelAndHouse = parseInt(params.data.substr(2, 2), 16);	
		var channel = ((channelAndHouse & 0b00001100) >> 2) + 1;
		var house =    (channelAndHouse & 0b11110000) >> 4;
		
		return Object.assign(params, {
			temperature: Math.round(temp * 100) / 100,
			humidity: humidity,
			batteryOk: batteryOk,
			channel: channel,
			house: house
		});
	},
	normalizeDeviceId: normalizeDeviceId,
	normalizeDevice: normalizeDevice
}

//module.exports.decodeData('+Wclass:sensor;protocol:mandolyn;model:temperaturehumidity;data:0x7F8E5043;');

Align repo with running code.