#!/usr/bin/env python import argparse from lirc.lirc import Lirc from flask import Flask from flask import render_template from flask import request, redirect, url_for BASE_URL = '' app = Flask(__name__) # Initialise the Lirc config parser lircParse = Lirc('/etc/lirc/lircd.conf') @app.route("/") def index(device=None): # Get the devices from the config file devices = [] for dev in lircParse.devices: d = { 'id': dev, 'name': dev, } devices.append(d) return render_template('remote.html', devices=devices) @app.route("/device/<device_id>")
#!/usr/bin/env python import argparse from lirc.lirc import Lirc from flask import Flask from flask import render_template from flask import request, redirect, url_for, jsonify BASE_URL = '' app = Flask(__name__) # Initialise the Lirc config parser lircParse = Lirc('/etc/lirc/lircd.conf') app.config['devices'] = lircParse.devices() @app.route("/") @app.route("/<device>") def index(device=None): # Get the devices from the config file devices = [] for dev in app.config['devices'].keys(): d = { 'id': dev, 'name': dev, } devices.append(d) return render_template('remote.html', devices=devices)
import datetime import time import json import glob from converter import * def scan(): return glob.glob('/dev/ttyUSB*') + glob.glob('/dev/ttyACM*') sensor = '/dev/ttyUSB0' clients = 0 newTask = {"update": False} lircParse = Lirc('/etc/lirc/lircd.conf') devices = [] for dev in lircParse.devices(): d = { 'id': dev, 'name': dev, } devices.append(d) # lircParse.send_once("livingroom", "KEY_1") def listening(): global newTask while True: ports = scan() if sensor in ports: ser = serial.Serial(sensor, 38400)
#!/usr/bin/env python from lirc.lirc import Lirc from flask import Flask from flask import render_template from flask import request, redirect, url_for BASE_URL = '' app = Flask(__name__) # Initialise the Lirc config parser lircParse = Lirc('/etc/lirc/remotes_all.conf') @app.route("/") @app.route("/<device>") def index(device=None): # Get the devices from the config file devices = [] for dev in lircParse.devices(): d = { 'id': dev, 'name': dev, } devices.append(d) return render_template('remote.html', devices=devices) @app.route("/device/<device_id>")
#!/usr/bin/env python import argparse from lirc.lirc import Lirc from flask import Flask from flask import render_template from flask import request, redirect, url_for, jsonify BASE_URL = '' app = Flask(__name__) # Initialise the Lirc config parser lircParse = Lirc('/etc/lirc/lircd.conf') app.config['devices'] = lircParse.devices() @app.route("/") @app.route("/<device>") def index(device=None): # Get the devices from the config file devices = [] for dev in app.config['devices'].keys(): d = { 'id': dev, 'name': dev, } devices.append(d)