diff --git a/config/battery.lua b/config/battery.lua index 19546bc..521331a 100644 --- a/config/battery.lua +++ b/config/battery.lua @@ -1,5 +1,6 @@ local ntfy = require("config.ntfy") +--- @class BatteryModule: Module local module = {} --- @type {[string]: number} @@ -17,7 +18,7 @@ function module.callback(device, battery) end end -function module.notify_low_battery() +local function notify_low_battery() -- Don't send notifications if there are now devices with low battery if next(low_battery) == nil then print("No devices with low battery") @@ -38,8 +39,9 @@ function module.notify_low_battery() }) end +--- @type Schedule module.schedule = { - ["0 0 21 */1 * *"] = module.notify_low_battery, + ["0 0 21 */1 * *"] = notify_low_battery, } return module diff --git a/config/debug.lua b/config/debug.lua index 639a64a..98f459a 100644 --- a/config/debug.lua +++ b/config/debug.lua @@ -4,6 +4,7 @@ local presence = require("config.presence") local utils = require("automation:utils") local variables = require("automation:variables") +--- @class DebugModule: Module local module = {} if variables.debug == "true" then diff --git a/config/hallway_automation.lua b/config/hallway_automation.lua index 7ebe7fb..ad0f3d9 100644 --- a/config/hallway_automation.lua +++ b/config/hallway_automation.lua @@ -1,6 +1,7 @@ local debug = require("config.debug") local utils = require("automation:utils") +--- @class HallwayAutomationModule: Module local module = {} local timeout = utils.Timeout.new() diff --git a/config/helper.lua b/config/helper.lua index c62c876..fd421e2 100644 --- a/config/helper.lua +++ b/config/helper.lua @@ -1,5 +1,6 @@ local utils = require("automation:utils") +--- @class HelperModule: Module local module = {} --- @param topic string diff --git a/config/hue_bridge.lua b/config/hue_bridge.lua index 54bee7a..f2b2d9b 100644 --- a/config/hue_bridge.lua +++ b/config/hue_bridge.lua @@ -3,6 +3,7 @@ local light = require("config.light") local presence = require("config.presence") local secrets = require("automation:secrets") +--- @class HueBridgeModule: Module local module = {} module.ip = "10.0.0.102" diff --git a/config/light.lua b/config/light.lua index 79ed303..8fb9abe 100644 --- a/config/light.lua +++ b/config/light.lua @@ -1,6 +1,7 @@ local devices = require("automation:devices") local helper = require("config.helper") +--- @class LightModule: Module local module = {} --- @class OnPresence @@ -34,6 +35,7 @@ function module.setup(mqtt_client) callback = callback, }) + --- @type Module return { module.device, } diff --git a/config/ntfy.lua b/config/ntfy.lua index 587b799..d6d617e 100644 --- a/config/ntfy.lua +++ b/config/ntfy.lua @@ -1,6 +1,7 @@ local devices = require("automation:devices") local secrets = require("automation:secrets") +--- @class NtfyModule: Module local module = {} local ntfy_topic = secrets.ntfy_topic @@ -24,6 +25,7 @@ function module.setup() topic = ntfy_topic, }) + --- @type Module return { ntfy, } diff --git a/config/presence.lua b/config/presence.lua index e2f18ce..1eaec55 100644 --- a/config/presence.lua +++ b/config/presence.lua @@ -2,6 +2,7 @@ local devices = require("automation:devices") local helper = require("config.helper") local ntfy = require("config.ntfy") +--- @class PresenceModule: Module local module = {} --- @class OnPresence @@ -61,6 +62,7 @@ function module.setup(mqtt_client) }) end) + --- @type Module return { presence, } diff --git a/config/rooms/bathroom.lua b/config/rooms/bathroom.lua index f2c20bb..da98874 100644 --- a/config/rooms/bathroom.lua +++ b/config/rooms/bathroom.lua @@ -3,9 +3,9 @@ local devices = require("automation:devices") local helper = require("config.helper") local ntfy = require("config.ntfy") +--- @type Module local module = {} ---- @type SetupFunction function module.setup(mqtt_client) local light = devices.LightOnOff.new({ name = "Light", @@ -30,6 +30,7 @@ function module.setup(mqtt_client) end, }) + --- @type Module return { light, washer, diff --git a/config/rooms/bedroom.lua b/config/rooms/bedroom.lua index 50502f5..42bf2a5 100644 --- a/config/rooms/bedroom.lua +++ b/config/rooms/bedroom.lua @@ -4,12 +4,12 @@ local helper = require("config.helper") local hue_bridge = require("config.hue_bridge") local windows = require("config.windows") +--- @type Module local module = {} --- @type AirFilter? local air_filter = nil ---- @type SetupFunction function module.setup(mqtt_client) local lights = devices.HueGroup.new({ identifier = "bedroom_lights", @@ -55,6 +55,7 @@ function module.setup(mqtt_client) }) windows.add(window) + --- @type Module return { devices = { lights, diff --git a/config/rooms/guest_bedroom.lua b/config/rooms/guest_bedroom.lua index 2022cc2..e2ae089 100644 --- a/config/rooms/guest_bedroom.lua +++ b/config/rooms/guest_bedroom.lua @@ -4,9 +4,9 @@ local helper = require("config.helper") local presence = require("config.presence") local windows = require("config.windows") +--- @type Module local module = {} ---- @type SetupFunction function module.setup(mqtt_client) local light = devices.LightOnOff.new({ name = "Light", @@ -25,6 +25,7 @@ function module.setup(mqtt_client) }) windows.add(window) + --- @type Module return { light, window, diff --git a/config/rooms/hallway_bottom.lua b/config/rooms/hallway_bottom.lua index 1e08858..e208ef8 100644 --- a/config/rooms/hallway_bottom.lua +++ b/config/rooms/hallway_bottom.lua @@ -8,9 +8,9 @@ local presence = require("config.presence") local utils = require("automation:utils") local windows = require("config.windows") +--- @type Module local module = {} ---- @type SetupFunction function module.setup(mqtt_client) local main_light = devices.HueGroup.new({ identifier = "hallway_main_light", @@ -97,6 +97,7 @@ function module.setup(mqtt_client) windows.add(frontdoor) hallway_automation.set_door(frontdoor) + --- @type Module return { main_light, storage_light, diff --git a/config/rooms/hallway_top.lua b/config/rooms/hallway_top.lua index b989df9..3fdfe27 100644 --- a/config/rooms/hallway_top.lua +++ b/config/rooms/hallway_top.lua @@ -3,9 +3,9 @@ local devices = require("automation:devices") local helper = require("config.helper") local hue_bridge = require("config.hue_bridge") +--- @type Module local module = {} ---- @type SetupFunction function module.setup(mqtt_client) local light = devices.HueGroup.new({ identifier = "hallway_top_light", @@ -37,6 +37,7 @@ function module.setup(mqtt_client) battery_callback = battery.callback, }) + --- @type Module return { light, top_switch, diff --git a/config/rooms/kitchen.lua b/config/rooms/kitchen.lua index ffb5fff..9835520 100644 --- a/config/rooms/kitchen.lua +++ b/config/rooms/kitchen.lua @@ -4,6 +4,7 @@ local helper = require("config.helper") local hue_bridge = require("config.hue_bridge") local presence = require("config.presence") +--- @class KitchenModule: Module local module = {} --- @type HueGroup? diff --git a/config/rooms/living_room.lua b/config/rooms/living_room.lua index 2c81794..15a2e31 100644 --- a/config/rooms/living_room.lua +++ b/config/rooms/living_room.lua @@ -5,9 +5,9 @@ local hue_bridge = require("config.hue_bridge") local presence = require("config.presence") local windows = require("config.windows") +--- @type Module local module = {} ---- @type SetupFunction function module.setup(mqtt_client) local lights = devices.HueGroup.new({ identifier = "living_lights", @@ -109,6 +109,7 @@ function module.setup(mqtt_client) }) windows.add(window) + --- @type Module return { lights, lights_relax, diff --git a/config/rooms/storage.lua b/config/rooms/storage.lua index f3ca968..aacb87d 100644 --- a/config/rooms/storage.lua +++ b/config/rooms/storage.lua @@ -3,9 +3,9 @@ local devices = require("automation:devices") local helper = require("config.helper") local presence = require("config.presence") +--- @type Module local module = {} ---- @type SetupFunction function module.setup(mqtt_client) local light = devices.LightBrightness.new({ name = "Light", @@ -31,6 +31,7 @@ function module.setup(mqtt_client) battery_callback = battery.callback, }) + --- @type Module return { light, door, diff --git a/config/rooms/workbench.lua b/config/rooms/workbench.lua index 0a1b01e..c0e00c0 100644 --- a/config/rooms/workbench.lua +++ b/config/rooms/workbench.lua @@ -5,9 +5,9 @@ local helper = require("config.helper") local presence = require("config.presence") local utils = require("automation:utils") +--- @type Module local module = {} ---- @type SetupFunction function module.setup(mqtt_client) local charger = devices.OutletOnOff.new({ name = "Charger", @@ -57,6 +57,7 @@ function module.setup(mqtt_client) battery_callback = battery.callback, }) + --- @type Module return { charger, outlets, diff --git a/config/windows.lua b/config/windows.lua index 28207d5..7214789 100644 --- a/config/windows.lua +++ b/config/windows.lua @@ -1,6 +1,7 @@ local ntfy = require("config.ntfy") local presence = require("config.presence") +--- @class WindowsModule: Module local module = {} --- @class OnPresence