Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
System administrator
committed
Sep 2, 2016
1 parent
3c9dbe2
commit e64e9ae
Showing
6 changed files
with
114 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# coding: utf8 | ||
|
||
import socket | ||
from tinkerforge.ip_connection import IPConnection | ||
from tinkerforge.bricklet_uv_light import BrickletUVLight | ||
from plugin import Plugin | ||
|
||
class Licht(Plugin): | ||
|
||
def __init__(self, config=None): | ||
try: | ||
self.licht_host = config.get('Licht', 'host') | ||
self.licht_port = config.get('Licht', 'port') | ||
self.licht_id = config.get('Licht', 'id') | ||
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): | ||
print "Licht was not properly configured in your config.ini" | ||
super(Licht, self).__init__() | ||
|
||
def help_text(self, bot): | ||
return bot.translate("licht_help") | ||
|
||
def get_light(self): | ||
ipcon = IPConnection() | ||
uvl = BrickletUVLight(self.licht_id, ipcon) | ||
ipcon.connect(self.licht_host, int(self.licht_port)) | ||
uv_light = uvl.get_uv_light() | ||
ipcon.disconnect() | ||
return(str(uv_light) + " µW/cm²") | ||
|
||
def on_msg(self, bot, user_nick, host, channel, message): | ||
if message.lower().startswith('!licht'): | ||
m = self.get_light() | ||
bot.send_message(channel, 'Momentane Lichtverhaeltnisse: ' + m) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# coding: utf8 | ||
|
||
import socket | ||
from tinkerforge.ip_connection import IPConnection | ||
from tinkerforge.bricklet_sound_intensity import BrickletSoundIntensity | ||
from plugin import Plugin | ||
|
||
class Sound(Plugin): | ||
|
||
def __init__(self, config=None): | ||
try: | ||
self.sound_host = config.get('Geraeusche', 'host') | ||
self.sound_port = config.get('Geraeusche', 'port') | ||
self.sound_id = config.get('Geraeusche', 'id') | ||
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): | ||
print "Geraeusche was not properly configured in your config.ini" | ||
super(Sound, self).__init__() | ||
|
||
def help_text(self, bot): | ||
return bot.translate("sound_help") | ||
|
||
def get_sound(self): | ||
ipcon = IPConnection() | ||
uvl = BrickletSoundIntensity(self.sound_id, ipcon) | ||
ipcon.connect(self.sound_host, int(self.sound_port)) | ||
intensity = uvl.get_intensity() | ||
ipcon.disconnect() | ||
return(str(intensity)) | ||
|
||
def on_msg(self, bot, user_nick, host, channel, message): | ||
if message.lower().startswith('!geraeusche') or message.lower().startswith('!sound'): | ||
m = self.get_sound() | ||
if not m == '': | ||
bot.send_message(channel, 'Momentane Geraeuschintensitaet: ' + m + '/3300') | ||
else: | ||
bot.send_message(channel, 'Geraeuschintensitaet konnte *nicht* abgefragt werden') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ wikitools | |
beautifulsoup4 | ||
git+https://github.com/k4cg/AsyncIRC.git | ||
markovify | ||
tinkerforge |