<commit_before>const VERSION = "1.73",
	ESP = require( "ESP8266" ),
	w = require( "Wifi" ),
	SSID = "X11",
	ssidPassword = "<PASSWORD>",
	wemos = {
		D0: null,
		D1: D5,
		D2: D4,
		D3: D0,
		D4: D2,
		D5: D14,
		D6: D12,
		D7: D13
	},
	configMap = [ {
		id: "dccbaa81-b2e4-46e4-a2f4-84d398dd86e3",
		pin: () => {
			I2C1.setup( {
				scl: D5,
				sda: D4
			} );
			var lux = require( "BH1750" )
				.connect( I2C1 );
			lux.start( 1 );
			return lux;
		},
		type: "virtual",
		validCmds: [ "read", "readCont", "readContStop" ],
		meta: {
			metric: "light intensity",
			unit: "lux"
		}
	}, {
		id: "828fbaa2-4f56-4cc5-99bf-57dcb5bd85f5",
		pin: wemos.D4,
		type: "button",
		validCmds: [ "on", "off", "getState" ],
		meta: {
			usage: "Mains Relay"
		}
	} ],
	WebSocket = require( "ws" );
var ws = {};

function configGen( config ) {
	let ret = [];
	config.forEach( ( el ) => {
		let t = {
			device: el.id,
			type: el.type,
			validCmds: el.validCmds,
			meta: el.meta
		};
		ret.push( t );
	} );
	return ret;
}

function button( d, cmd ) {
	switch ( cmd ) {
	case "on":
	{
		digitalWrite( d.pin, 0 );
		let retMsg = [ "state", {
			device: d.id,
			state: 0
		} ];
		ws.send( JSON.stringify( retMsg ) );
		break;
	}
	case "off":
	{
		digitalWrite( d.pin, 1 );
		let retMsg = [ "state", {
			device: d.id,
			state: 1
		} ];
		ws.send( JSON.stringify( retMsg ) );
		break;
	}
	case "getState":
	{
		ws.send( JSON.stringify( [ "state", {
			mode: d.pin.getMode(),
			value: digitalRead( d.pin )<commit_msg>fix getStatus<commit_after>const VERSION = "1.73",
	ESP = require( "ESP8266" ),
	w = require( "Wifi" ),
	SSID = "X11",
	ssidPassword = "<PASSWORD>",
	wemos = {
		D0: null,
		D1: D5,
		D2: D4,
		D3: D0,
		D4: D2,
		D5: D14,
		D6: D12,
		D7: D13
	},
	configMap = [ {
		id: "dccbaa81-b2e4-46e4-a2f4-84d398dd86e3",
		pin: () => {
			I2C1.setup( {
				scl: D5,
				sda: D4
			} );
			var lux = require( "BH1750" )
				.connect( I2C1 );
			lux.start( 1 );
			return lux;
		},
		type: "virtual",
		validCmds: [ "read", "readCont", "readContStop" ],
		meta: {
			metric: "light intensity",
			unit: "lux"
		}
	}, {
		id: "828fbaa2-4f56-4cc5-99bf-57dcb5bd85f5",
		pin: wemos.D4,
		type: "button",
		validCmds: [ "on", "off", "getState" ],
		meta: {
			usage: "Mains Relay"
		}
	} ],
	WebSocket = require( "ws" );
var ws = {};

function configGen( config ) {
	let ret = [];
	config.forEach( ( el ) => {
		let t = {
			device: el.id,
			type: el.type,
			validCmds: el.validCmds,
			meta: el.meta
		};
		ret.push( t );
	} );
	return ret;
}

function button( d, cmd ) {
	switch ( cmd ) {
	case "on":
	{
		digitalWrite( d.pin, 0 );
		let retMsg = [ "state", {
			device: d.id,
			state: 0
		} ];
		ws.send( JSON.stringify( retMsg ) );
		break;
	}
	case "off":
	{
		digitalWrite( d.pin, 1 );
		let retMsg = [ "state", {
			device: d.id,
			state: 1
		} ];
		ws.send( JSON.stringify( retMsg ) );
		break;
	}
	case "getState":
	{
		ws.send( JSON.stringify( [ "state", {
			mode: d.pin.getMode(),
			value: d.pin.read()
{'fraction_non_alphanumeric': 0.19687915006640105, 'fraction_numerical': 0.05112881806108898, 'mean_word_length': 2.5405405405405403, 'pattern_counts': {'":': 6, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '427431', 'n_tokens_mistral': 1618, 'n_tokens_neox': 1399, 'n_words': 298}