summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/inverter_bot.py2
-rwxr-xr-xbin/polaris_kettle_bot.py4
-rwxr-xr-xbin/pump_bot.py2
-rwxr-xr-xbin/sensors_bot.py4
-rwxr-xr-xbin/sound_bot.py4
-rwxr-xr-xbin/web_api.py26
6 files changed, 2 insertions, 40 deletions
diff --git a/bin/inverter_bot.py b/bin/inverter_bot.py
index fdfe436..7da21aa 100755
--- a/bin/inverter_bot.py
+++ b/bin/inverter_bot.py
@@ -28,7 +28,6 @@ from homekit.inverter.types import (
OutputSourcePriority
)
from homekit.database.inverter_time_formats import FormatDate
-from homekit.api.types import BotType
from homekit.api import WebApiClient
from telegram import ReplyKeyboardMarkup, InlineKeyboardMarkup, InlineKeyboardButton
@@ -921,7 +920,6 @@ class InverterStore(bot.BotDatabase):
inverter.init(host=config['inverter']['ip'], port=config['inverter']['port'])
bot.set_database(InverterStore())
-bot.enable_logging(BotType.INVERTER)
bot.add_conversation(SettingsConversation(enable_back=True))
bot.add_conversation(ConsumptionConversation(enable_back=True))
diff --git a/bin/polaris_kettle_bot.py b/bin/polaris_kettle_bot.py
index 3a24fe0..05c2aae 100755
--- a/bin/polaris_kettle_bot.py
+++ b/bin/polaris_kettle_bot.py
@@ -10,7 +10,6 @@ import threading
import paho.mqtt.client as mqtt
from homekit.telegram import bot
-from homekit.api.types import BotType
from homekit.mqtt import Mqtt
from homekit.config import config
from homekit.util import chunks
@@ -738,9 +737,6 @@ if __name__ == '__main__':
kc = KettleController()
- if 'api' in config:
- bot.enable_logging(BotType.POLARIS_KETTLE)
-
bot.run()
# bot library handles signals, so when sigterm or something like that happens, we should stop all other threads here
diff --git a/bin/pump_bot.py b/bin/pump_bot.py
index 08d0dc6..2583c5f 100755
--- a/bin/pump_bot.py
+++ b/bin/pump_bot.py
@@ -11,7 +11,6 @@ from homekit.config import config, is_development_mode
from homekit.telegram import bot
from homekit.telegram._botutil import user_any_name
from homekit.relay.sunxi_h3_client import RelayClient
-from homekit.api.types import BotType
from homekit.mqtt import MqttNode, MqttWrapper, MqttPayload
from homekit.mqtt.module.relay import MqttPowerStatusPayload, MqttRelayModule
from homekit.mqtt.module.temphum import MqttTemphumDataPayload
@@ -248,7 +247,6 @@ if __name__ == '__main__':
mqtt.connect_and_loop(loop_forever=False)
- bot.enable_logging(BotType.PUMP)
bot.run()
try:
diff --git a/bin/sensors_bot.py b/bin/sensors_bot.py
index c2b0070..43932e1 100755
--- a/bin/sensors_bot.py
+++ b/bin/sensors_bot.py
@@ -20,7 +20,6 @@ from homekit.telegram import bot
from homekit.util import chunks, MySimpleSocketClient
from homekit.api import WebApiClient
from homekit.api.types import (
- BotType,
TemperatureSensorLocation
)
@@ -176,7 +175,4 @@ def markup(ctx: Optional[bot.Context]) -> Optional[ReplyKeyboardMarkup]:
if __name__ == '__main__':
- if 'api' in config:
- bot.enable_logging(BotType.SENSORS)
-
bot.run()
diff --git a/bin/sound_bot.py b/bin/sound_bot.py
index 518151d..fa22ba7 100755
--- a/bin/sound_bot.py
+++ b/bin/sound_bot.py
@@ -11,7 +11,7 @@ from typing import Optional, List, Dict, Tuple
from homekit.config import config
from homekit.api import WebApiClient
-from homekit.api.types import SoundSensorLocation, BotType
+from homekit.api.types import SoundSensorLocation
from homekit.api.errors import ApiResponseError
from homekit.media import SoundNodeClient, SoundRecordClient, SoundRecordFile, CameraNodeClient
from homekit.soundsensor import SoundSensorServerGuardClient
@@ -884,7 +884,5 @@ if __name__ == '__main__':
finished_handler=record_onfinished,
download_on_finish=True)
- if 'api' in config:
- bot.enable_logging(BotType.SOUND)
bot.run()
record_client.stop()
diff --git a/bin/web_api.py b/bin/web_api.py
index 0e0fd0b..e543d22 100755
--- a/bin/web_api.py
+++ b/bin/web_api.py
@@ -11,7 +11,7 @@ from homekit import http
from homekit.config import config, is_development_mode
from homekit.database import BotsDatabase, SensorsDatabase, InverterDatabase
from homekit.database.inverter_time_formats import *
-from homekit.api.types import BotType, TemperatureSensorLocation, SoundSensorLocation
+from homekit.api.types import TemperatureSensorLocation, SoundSensorLocation
from homekit.media import SoundRecordStorage
@@ -126,30 +126,6 @@ class WebAPIServer(http.HTTPServer):
BotsDatabase().add_sound_hits(hits, datetime.now())
return self.ok()
- async def POST_bot_request_log(self, req: http.Request):
- data = await req.post()
-
- try:
- user_id = int(data['user_id'])
- except KeyError:
- user_id = 0
-
- try:
- message = data['message']
- except KeyError:
- message = ''
-
- bot = BotType(int(data['bot']))
-
- # validate message
- if message.strip() == '':
- raise ValueError('message can\'t be empty')
-
- # add record to the database
- BotsDatabase().add_request(bot, user_id, message)
-
- return self.ok()
-
async def POST_openwrt_log(self, req: http.Request):
data = await req.post()