From ad567ba2d1c338a62ee073442e843c38f7f3b786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Sat, 12 Jun 2021 20:30:09 +0200 Subject: [PATCH] remove wildcard stuff --- src/app.py | 5 ++--- src/resources.py | 24 ------------------------ 2 files changed, 2 insertions(+), 27 deletions(-) diff --git a/src/app.py b/src/app.py index 2b64c86..d8b2432 100644 --- a/src/app.py +++ b/src/app.py @@ -48,9 +48,10 @@ app.config['MQTT_REFRESH_TIME'] = 1.0 # refresh time in seconds api = Api(app) mqtt.init_app(app) + @mqtt.on_log() def handle_logging(client, userdata, level, buf): - logger.log(level, buf) + app.logger.log(level, buf) @mqtt.on_connect() @@ -67,8 +68,6 @@ def handle_status_message_proxy(*args, **kwargs): handle_status_message(*args, **kwargs) -api.add_resource(AllDevicesOfflineResource, "/devices/offline") -api.add_resource(AllDevicesOnlineResource, "/devices/online") api.add_resource(DeviceOfflineResrouce, "/devices/{deviceid}/offline") api.add_resource(DeviceOnlineResrouce, "/devices/{deviceid}/online") api.add_resource(SensorOfflineResource, "/devices/{deviceid}/{sensorid}/offline") diff --git a/src/resources.py b/src/resources.py index da16ce3..4d1c1eb 100644 --- a/src/resources.py +++ b/src/resources.py @@ -13,30 +13,6 @@ __module_name__ = "resources" __version__text__ = "1" -class AllDevicesOfflineResource(Resource): - """ - Shut down all devices - """ - def post(self): - """ - Shut down every device - :return: - """ - mqtt.publish(f"{config.MQTT_COMMAND_TOPIC}/+", {"command": "offline"}) - - -class AllDevicesOnlineResource(Resource): - """ - Bring every device online - """ - def post(self): - """ - Bring every device online - :return: - """ - mqtt.publish(f"{config.MQTT_COMMAND_TOPIC}/+", {"command": "online"}) - - class DeviceOfflineResrouce(Resource): """ Bring a device offline