diff --git a/main.py b/main.py index e2e8468..b0f55c4 100755 --- a/main.py +++ b/main.py @@ -72,11 +72,11 @@ async def state(ctx): # !co2 @HobbyBot.command(description="co2 levels") -async def co2(ctx): +async def co2(ctx, where='hoofdruimte'): async with ctx.typing(): try: - msg = await mqtt_get_one("bitlair/climate/hoofdruimte/co2_ppm") - await ctx.send(f"Hoofdruimte: {msg.payload.decode('ascii')} ppm\n") + msg = await mqtt_get_one(f"bitlair/climate/{where}/co2_ppm") + await ctx.send(f"{where}: {msg.payload.decode('ascii')} ppm\n") except Exception as err: await ctx.send("Meh, stuk") raise err @@ -84,11 +84,11 @@ async def co2(ctx): # !temp @HobbyBot.command(description="Temperature") -async def temp(ctx): +async def temp(ctx, where="hoofdruimte"): async with ctx.typing(): try: - msg = await mqtt_get_one("bitlair/climate/hoofdruimte/temperature_c") - await ctx.send(f"Hoofdruimte: {msg.payload.decode('ascii')} °C\n") + msg = await mqtt_get_one(f"bitlair/climate/{where}/temperature_c") + await ctx.send(f"{where}: {msg.payload.decode('ascii')} °C\n") except Exception as err: await ctx.send("Meh, stuk") raise err @@ -96,11 +96,11 @@ async def temp(ctx): # !humid @HobbyBot.command(description="Humidity") -async def humid(ctx): +async def humid(ctx, where="hoofdruimte"): async with ctx.typing(): try: - msg = await mqtt_get_one("bitlair/climate/hoofdruimte/humidity_pct") - await ctx.send(f"Hoofdruimte: {msg.payload.decode('ascii')} pct\n") + msg = await mqtt_get_one(f"bitlair/climate/{where}/humidity_pct") + await ctx.send(f"{where}: {msg.payload.decode('ascii')} pct\n") except Exception as err: await ctx.send("Meh, stuk") raise err