Esempio n. 1
0
from time import sleep
from threading import Thread
import lifxlan
import sys
import signal
import json
from MQTTClient import create_mqtt_client
from get_config import get_parameter
import logging
from homedom_logger import set_logger
set_logger("lifx", logging.DEBUG)


def signal_handler(signal, frame):
    logging.info("Interpreted signal {}, exiting now...".format(signal))
    sys.exit(0)


signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)


MQTT_HOST = get_parameter("mqtt_host")
MQTT_PORT = get_parameter("mqtt_port")
MQTT_TOPICS = get_parameter("lifx_topics")
IP = get_parameter("lifx_1_ip")
MAC = get_parameter("lifx_1_mac")
mqtt_client = None


def on_message(client, userdata, msg):
Esempio n. 2
0
from threading import Lock, Thread
from time import sleep
import sys
import signal
import json
import os
from MQTTClient import create_mqtt_client
from get_config import get_parameter
import logging
from homedom_logger import set_logger
set_logger("hometts", logging.DEBUG)


def signal_handler(signal, frame):
    logging.info("Interpreted signal {}, exiting now...".format(signal))
    sys.exit(0)


signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)

MQTT_HOST = get_parameter("mqtt_host")
MQTT_PORT = get_parameter("mqtt_port")
MQTT_TOPICS = get_parameter("hometts_topics")
mqtt_client = None
tts_lock = Lock()


def on_message(client, userdata, msg):
    payload = str(msg.payload, 'utf-8')
    event_manager(msg.topic, payload)
Esempio n. 3
0
from flask import Flask, render_template
from threading import Thread
from time import sleep
import sys
import signal
import logging
from MQTTClient import create_mqtt_client
from get_config import get_parameter
from homedom_logger import set_logger
set_logger("webapp", logging.DEBUG)

MQTT_HOST = get_parameter("mqtt_host")
MQTT_PORT = get_parameter("mqtt_port")
MQTT_TOPICS = get_parameter("actionmanager_topics")
mqtt_client = None


def on_message(client, userdata, msg):
    payload = str(msg.payload, 'utf-8')
    event_manager(msg.topic, payload)


def event_manager(topic, payload):
    try:
        pass
    except Exception as e:
        logging.error("Error in event_manager(): {}".format(e))


def signal_handler(signal, frame):
    logging.info("Interpreted signal {}, exiting now...".format(signal))
Esempio n. 4
0
from SerialReader import create_serial_reader
import json
from time import sleep
from threading import Thread
import sys
import signal
from MQTTClient import create_mqtt_client
from get_config import get_parameter
import logging
from homedom_logger import set_logger
set_logger("enocean", logging.DEBUG)


def signal_handler(signal, frame):
    logging.info("Interpreted signal {}, exiting now...".format(signal))
    sys.exit(0)


signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)

MQTT_HOST = get_parameter("mqtt_host")
MQTT_PORT = get_parameter("mqtt_port")
MQTT_TOPICS = get_parameter("enocean_topics")
mqtt_client = None
serial_thread = None


def on_message(client, userdata, msg):
    payload = str(msg.payload, 'utf-8')
    event_manager(msg.topic, payload)
Esempio n. 5
0
from time import sleep
from threading import Thread
import sys
import signal
import json
from MQTTClient import create_mqtt_client
from get_config import get_parameter
import urllib.request
import pytz
import datetime
from googletrans import Translator
import logging
from homedom_logger import set_logger
set_logger("weather", logging.DEBUG)


def signal_handler(signal, frame):
    logging.info("Interpreted signal {}, exiting now...".format(signal))
    sys.exit(0)


signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)

MQTT_HOST = get_parameter("mqtt_host")
MQTT_PORT = get_parameter("mqtt_port")
MQTT_TOPICS = get_parameter("weather_topics")
mqtt_client = None
tz = pytz.timezone('Europe/Paris')
translator = Translator()
Esempio n. 6
0
from flask import Flask, jsonify
from time import sleep
from threading import Thread
import json
import logging
from MQTTClient import create_mqtt_client
from homedom_logger import set_logger
set_logger("config", logging.DEBUG)

app = Flask(__name__)
MQTT_HOST = None
MQTT_PORT = None
MQTT_TOPICS = None
mqtt_client = None


def on_message(client, userdata, msg):
    payload = str(msg.payload, 'utf-8')
    event_manager(msg.topic, payload)


def event_manager(topic, payload):
    try:
        pass
    except Exception as e:
        logging.error("Error in event_manager(): {}".format(e))


@app.route('/')
def config():
    try:
Esempio n. 7
0
from flask import Flask, request, jsonify
import sys
from time import sleep
import logging
import json
import signal
from threading import Thread
from MQTTClient import create_mqtt_client
from get_config import get_parameter
import cep
import database
from homedom_logger import set_logger

set_logger("homevents", logging.DEBUG)

app = Flask(__name__)

mqtt_client = None
regexs_handler = None
rules_handler = None
config_handler = None
database_handler = None

MQTT_HOST = get_parameter("mqtt_host")
MQTT_PORT = get_parameter("mqtt_port")
MQTT_TOPICS = ["inputs", "outputs", "events"]


@app.route('/config', methods=['GET'])
def get_config():
    try:
Esempio n. 8
0
from time import sleep
from threading import Thread
import sys
import signal
import discord
import asyncio
import json
from MQTTClient import create_mqtt_client
from get_config import get_parameter
import logging
from homedom_logger import set_logger
set_logger("discordinho", logging.INFO)


def signal_handler(signal, frame):
    logging.info("Interpreted signal {}, exiting now...".format(signal))
    sys.exit(0)


signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)

MQTT_HOST = get_parameter("mqtt_host")
MQTT_PORT = get_parameter("mqtt_port")
MQTT_TOPICS = get_parameter("discordinho_topics")
mqtt_client = None

#discord specific

client = discord.Client()
server_name = 'Home_Dom'
Esempio n. 9
0
from time import sleep
from threading import Thread
import sys
import signal
import json
import random
from MQTTClient import create_mqtt_client
from get_config import get_parameter
import requests
import logging
from homedom_logger import set_logger
set_logger("actionmanager", logging.DEBUG)


def signal_handler(signal, frame):
    logging.info("Interpreted signal {}, exiting now...".format(signal))
    sys.exit(0)


signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)

MQTT_HOST = get_parameter("mqtt_host")
MQTT_PORT = get_parameter("mqtt_port")
MQTT_TOPICS = get_parameter("actionmanager_topics")
HOMEVENTS_IP = get_parameter("homevents_ip")
HOMEVENTS_PORT = get_parameter("homevents_port")
HOMEVENTS_URL = "http://{}:{}".format(HOMEVENTS_IP, HOMEVENTS_PORT)
mqtt_client = None

colors = {