Ejemplo n.º 1
0
Archivo: radio.py Proyecto: akx/dot3k
import sys

sys.path.append("../../")

import dothat.touch as touch
import dothat.lcd as lcd
import dothat.backlight as backlight
from dot3k.menu import Menu
from plugins.utils import Backlight, Contrast
from plugins.volume import Volume
from plugins.clock import Clock
from plugins.radio import Radio
from plugins.graph import GraphCPU, GraphTemp
import time

touch.enable_repeat(True)

# We want to use clock both as an option
# and as the idle plugin
clock = Clock(backlight)

"""
Using a set of nested dictionaries you can describe
the menu you want to display on dot3k.

A nested dictionary describes a submenu.
An instance of a plugin class ( derived from MenuOption ) can be used for things like settings, radio, etc
A function name will call that function.
"""
menu = Menu({
        'Clock': clock,
# from other rooms. Depending on free time, I might maintain this file or not.
#

print("""
Press CTRL+C to exit.
""")

import Adafruit_DHT
import dothat.touch as j
import dothat.lcd as l
import dothat.backlight as b
import signal
import socket
import time

j.enable_repeat(True)

dtemp=float(21.00)  # temperature that i want to be in the room
rtemp=float(20.00)  # read temperature from sensor
heatc=0.0    # count to light or dim the vertical leds
heat="OFF" # default heating
display_status="ON"
room="Bedroom: "

def status_heating():
	s = socket.socket()
        s.connect(("192.168.1.2",8001))
        s.send('status')
	msg=s.recv(1024)
	return str(msg)