Skip to content
This repository has been archived by the owner on Jul 23, 2019. It is now read-only.
/ Flic-Controller Public archive

Framework for Flic buttons to control other IoT devices such as LIFX and WeMo via LAN.

License

Notifications You must be signed in to change notification settings

Sawtaytoes/Flic-Controller

Repository files navigation

NOTE: This repo has moved to https://github.com/Sawtaytoes/Smart-Home-Services

Flic Controller

WebSockets-based Flic Controller software. This is the server portion which executes commands. There is a related piece which listens for button presses and sends them to this controller.

For an example use case, look at ./app.js.

Installation

npm

npm i

yarn

yarn

Configuration

Create a localConfig.js in the project root. Here, you'll add your app configurations; namely, the flicButtonServers, LIFX API server, and WeMo API server.

Your localConfig.js will look something like this:

module.exports = {
	externalConnections: {
		lifxApi: {
			hostname: '',
			port: 80,
			protocol: 'ws',
			protocolVersion: 'v1',
		},
	},

	flicButtonServers: [{
		hostname: 'raspberry-pi-1',
		port: 5551,
	}, {
		hostname: 'raspberry-pi-2',
		port: 5551,
	}, {
		hostname: 'raspberry-pi-2',
		port: 5551,
	}],

	wemoApi: {
		hostname: 'wemo.example.com',
		port: 80,
		protocol: 'http',
	},
}

Testing Button Presses

To test executing button presses, load up a browser, and go to about:blank.

Then paste this into the devtools console:

webSocket = new WebSocket('ws://localhost:3000', 'v1')
webSocket.onmessage = console.log
webSocket.onerror = console.error
webSocket.onclose = console.info
webSocket.onopen = () => {
	console.log('READY')

	webSocket
	.send(
		JSON
		.stringify({
			buttonId: '80:e4:da:86:44:9e',
			pressCount: 1,
			pressType: 'hold',
			type: 'REQUEST::EXECUTE_BUTTON_PRESSES',
		})
	)
}

About

Framework for Flic buttons to control other IoT devices such as LIFX and WeMo via LAN.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published