chore: Fix config type annotations
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
local ntfy = require("config.ntfy")
|
local ntfy = require("config.ntfy")
|
||||||
|
|
||||||
|
--- @class BatteryModule: Module
|
||||||
local module = {}
|
local module = {}
|
||||||
|
|
||||||
--- @type {[string]: number}
|
--- @type {[string]: number}
|
||||||
@@ -17,7 +18,7 @@ function module.callback(device, battery)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function module.notify_low_battery()
|
local function notify_low_battery()
|
||||||
-- Don't send notifications if there are now devices with low battery
|
-- Don't send notifications if there are now devices with low battery
|
||||||
if next(low_battery) == nil then
|
if next(low_battery) == nil then
|
||||||
print("No devices with low battery")
|
print("No devices with low battery")
|
||||||
@@ -38,8 +39,9 @@ function module.notify_low_battery()
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- @type Schedule
|
||||||
module.schedule = {
|
module.schedule = {
|
||||||
["0 0 21 */1 * *"] = module.notify_low_battery,
|
["0 0 21 */1 * *"] = notify_low_battery,
|
||||||
}
|
}
|
||||||
|
|
||||||
return module
|
return module
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ local presence = require("config.presence")
|
|||||||
local utils = require("automation:utils")
|
local utils = require("automation:utils")
|
||||||
local variables = require("automation:variables")
|
local variables = require("automation:variables")
|
||||||
|
|
||||||
|
--- @class DebugModule: Module
|
||||||
local module = {}
|
local module = {}
|
||||||
|
|
||||||
if variables.debug == "true" then
|
if variables.debug == "true" then
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
local debug = require("config.debug")
|
local debug = require("config.debug")
|
||||||
local utils = require("automation:utils")
|
local utils = require("automation:utils")
|
||||||
|
|
||||||
|
--- @class HallwayAutomationModule: Module
|
||||||
local module = {}
|
local module = {}
|
||||||
|
|
||||||
local timeout = utils.Timeout.new()
|
local timeout = utils.Timeout.new()
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
local utils = require("automation:utils")
|
local utils = require("automation:utils")
|
||||||
|
|
||||||
|
--- @class HelperModule: Module
|
||||||
local module = {}
|
local module = {}
|
||||||
|
|
||||||
--- @param topic string
|
--- @param topic string
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ local light = require("config.light")
|
|||||||
local presence = require("config.presence")
|
local presence = require("config.presence")
|
||||||
local secrets = require("automation:secrets")
|
local secrets = require("automation:secrets")
|
||||||
|
|
||||||
|
--- @class HueBridgeModule: Module
|
||||||
local module = {}
|
local module = {}
|
||||||
|
|
||||||
module.ip = "10.0.0.102"
|
module.ip = "10.0.0.102"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
local devices = require("automation:devices")
|
local devices = require("automation:devices")
|
||||||
local helper = require("config.helper")
|
local helper = require("config.helper")
|
||||||
|
|
||||||
|
--- @class LightModule: Module
|
||||||
local module = {}
|
local module = {}
|
||||||
|
|
||||||
--- @class OnPresence
|
--- @class OnPresence
|
||||||
@@ -34,6 +35,7 @@ function module.setup(mqtt_client)
|
|||||||
callback = callback,
|
callback = callback,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
--- @type Module
|
||||||
return {
|
return {
|
||||||
module.device,
|
module.device,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
local devices = require("automation:devices")
|
local devices = require("automation:devices")
|
||||||
local secrets = require("automation:secrets")
|
local secrets = require("automation:secrets")
|
||||||
|
|
||||||
|
--- @class NtfyModule: Module
|
||||||
local module = {}
|
local module = {}
|
||||||
|
|
||||||
local ntfy_topic = secrets.ntfy_topic
|
local ntfy_topic = secrets.ntfy_topic
|
||||||
@@ -24,6 +25,7 @@ function module.setup()
|
|||||||
topic = ntfy_topic,
|
topic = ntfy_topic,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
--- @type Module
|
||||||
return {
|
return {
|
||||||
ntfy,
|
ntfy,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ local devices = require("automation:devices")
|
|||||||
local helper = require("config.helper")
|
local helper = require("config.helper")
|
||||||
local ntfy = require("config.ntfy")
|
local ntfy = require("config.ntfy")
|
||||||
|
|
||||||
|
--- @class PresenceModule: Module
|
||||||
local module = {}
|
local module = {}
|
||||||
|
|
||||||
--- @class OnPresence
|
--- @class OnPresence
|
||||||
@@ -61,6 +62,7 @@ function module.setup(mqtt_client)
|
|||||||
})
|
})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
--- @type Module
|
||||||
return {
|
return {
|
||||||
presence,
|
presence,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ local devices = require("automation:devices")
|
|||||||
local helper = require("config.helper")
|
local helper = require("config.helper")
|
||||||
local ntfy = require("config.ntfy")
|
local ntfy = require("config.ntfy")
|
||||||
|
|
||||||
|
--- @type Module
|
||||||
local module = {}
|
local module = {}
|
||||||
|
|
||||||
--- @type SetupFunction
|
|
||||||
function module.setup(mqtt_client)
|
function module.setup(mqtt_client)
|
||||||
local light = devices.LightOnOff.new({
|
local light = devices.LightOnOff.new({
|
||||||
name = "Light",
|
name = "Light",
|
||||||
@@ -30,6 +30,7 @@ function module.setup(mqtt_client)
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
--- @type Module
|
||||||
return {
|
return {
|
||||||
light,
|
light,
|
||||||
washer,
|
washer,
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ local helper = require("config.helper")
|
|||||||
local hue_bridge = require("config.hue_bridge")
|
local hue_bridge = require("config.hue_bridge")
|
||||||
local windows = require("config.windows")
|
local windows = require("config.windows")
|
||||||
|
|
||||||
|
--- @type Module
|
||||||
local module = {}
|
local module = {}
|
||||||
|
|
||||||
--- @type AirFilter?
|
--- @type AirFilter?
|
||||||
local air_filter = nil
|
local air_filter = nil
|
||||||
|
|
||||||
--- @type SetupFunction
|
|
||||||
function module.setup(mqtt_client)
|
function module.setup(mqtt_client)
|
||||||
local lights = devices.HueGroup.new({
|
local lights = devices.HueGroup.new({
|
||||||
identifier = "bedroom_lights",
|
identifier = "bedroom_lights",
|
||||||
@@ -55,6 +55,7 @@ function module.setup(mqtt_client)
|
|||||||
})
|
})
|
||||||
windows.add(window)
|
windows.add(window)
|
||||||
|
|
||||||
|
--- @type Module
|
||||||
return {
|
return {
|
||||||
devices = {
|
devices = {
|
||||||
lights,
|
lights,
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ local helper = require("config.helper")
|
|||||||
local presence = require("config.presence")
|
local presence = require("config.presence")
|
||||||
local windows = require("config.windows")
|
local windows = require("config.windows")
|
||||||
|
|
||||||
|
--- @type Module
|
||||||
local module = {}
|
local module = {}
|
||||||
|
|
||||||
--- @type SetupFunction
|
|
||||||
function module.setup(mqtt_client)
|
function module.setup(mqtt_client)
|
||||||
local light = devices.LightOnOff.new({
|
local light = devices.LightOnOff.new({
|
||||||
name = "Light",
|
name = "Light",
|
||||||
@@ -25,6 +25,7 @@ function module.setup(mqtt_client)
|
|||||||
})
|
})
|
||||||
windows.add(window)
|
windows.add(window)
|
||||||
|
|
||||||
|
--- @type Module
|
||||||
return {
|
return {
|
||||||
light,
|
light,
|
||||||
window,
|
window,
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ local presence = require("config.presence")
|
|||||||
local utils = require("automation:utils")
|
local utils = require("automation:utils")
|
||||||
local windows = require("config.windows")
|
local windows = require("config.windows")
|
||||||
|
|
||||||
|
--- @type Module
|
||||||
local module = {}
|
local module = {}
|
||||||
|
|
||||||
--- @type SetupFunction
|
|
||||||
function module.setup(mqtt_client)
|
function module.setup(mqtt_client)
|
||||||
local main_light = devices.HueGroup.new({
|
local main_light = devices.HueGroup.new({
|
||||||
identifier = "hallway_main_light",
|
identifier = "hallway_main_light",
|
||||||
@@ -97,6 +97,7 @@ function module.setup(mqtt_client)
|
|||||||
windows.add(frontdoor)
|
windows.add(frontdoor)
|
||||||
hallway_automation.set_door(frontdoor)
|
hallway_automation.set_door(frontdoor)
|
||||||
|
|
||||||
|
--- @type Module
|
||||||
return {
|
return {
|
||||||
main_light,
|
main_light,
|
||||||
storage_light,
|
storage_light,
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ local devices = require("automation:devices")
|
|||||||
local helper = require("config.helper")
|
local helper = require("config.helper")
|
||||||
local hue_bridge = require("config.hue_bridge")
|
local hue_bridge = require("config.hue_bridge")
|
||||||
|
|
||||||
|
--- @type Module
|
||||||
local module = {}
|
local module = {}
|
||||||
|
|
||||||
--- @type SetupFunction
|
|
||||||
function module.setup(mqtt_client)
|
function module.setup(mqtt_client)
|
||||||
local light = devices.HueGroup.new({
|
local light = devices.HueGroup.new({
|
||||||
identifier = "hallway_top_light",
|
identifier = "hallway_top_light",
|
||||||
@@ -37,6 +37,7 @@ function module.setup(mqtt_client)
|
|||||||
battery_callback = battery.callback,
|
battery_callback = battery.callback,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
--- @type Module
|
||||||
return {
|
return {
|
||||||
light,
|
light,
|
||||||
top_switch,
|
top_switch,
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ local helper = require("config.helper")
|
|||||||
local hue_bridge = require("config.hue_bridge")
|
local hue_bridge = require("config.hue_bridge")
|
||||||
local presence = require("config.presence")
|
local presence = require("config.presence")
|
||||||
|
|
||||||
|
--- @class KitchenModule: Module
|
||||||
local module = {}
|
local module = {}
|
||||||
|
|
||||||
--- @type HueGroup?
|
--- @type HueGroup?
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ local hue_bridge = require("config.hue_bridge")
|
|||||||
local presence = require("config.presence")
|
local presence = require("config.presence")
|
||||||
local windows = require("config.windows")
|
local windows = require("config.windows")
|
||||||
|
|
||||||
|
--- @type Module
|
||||||
local module = {}
|
local module = {}
|
||||||
|
|
||||||
--- @type SetupFunction
|
|
||||||
function module.setup(mqtt_client)
|
function module.setup(mqtt_client)
|
||||||
local lights = devices.HueGroup.new({
|
local lights = devices.HueGroup.new({
|
||||||
identifier = "living_lights",
|
identifier = "living_lights",
|
||||||
@@ -109,6 +109,7 @@ function module.setup(mqtt_client)
|
|||||||
})
|
})
|
||||||
windows.add(window)
|
windows.add(window)
|
||||||
|
|
||||||
|
--- @type Module
|
||||||
return {
|
return {
|
||||||
lights,
|
lights,
|
||||||
lights_relax,
|
lights_relax,
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ local devices = require("automation:devices")
|
|||||||
local helper = require("config.helper")
|
local helper = require("config.helper")
|
||||||
local presence = require("config.presence")
|
local presence = require("config.presence")
|
||||||
|
|
||||||
|
--- @type Module
|
||||||
local module = {}
|
local module = {}
|
||||||
|
|
||||||
--- @type SetupFunction
|
|
||||||
function module.setup(mqtt_client)
|
function module.setup(mqtt_client)
|
||||||
local light = devices.LightBrightness.new({
|
local light = devices.LightBrightness.new({
|
||||||
name = "Light",
|
name = "Light",
|
||||||
@@ -31,6 +31,7 @@ function module.setup(mqtt_client)
|
|||||||
battery_callback = battery.callback,
|
battery_callback = battery.callback,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
--- @type Module
|
||||||
return {
|
return {
|
||||||
light,
|
light,
|
||||||
door,
|
door,
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ local helper = require("config.helper")
|
|||||||
local presence = require("config.presence")
|
local presence = require("config.presence")
|
||||||
local utils = require("automation:utils")
|
local utils = require("automation:utils")
|
||||||
|
|
||||||
|
--- @type Module
|
||||||
local module = {}
|
local module = {}
|
||||||
|
|
||||||
--- @type SetupFunction
|
|
||||||
function module.setup(mqtt_client)
|
function module.setup(mqtt_client)
|
||||||
local charger = devices.OutletOnOff.new({
|
local charger = devices.OutletOnOff.new({
|
||||||
name = "Charger",
|
name = "Charger",
|
||||||
@@ -57,6 +57,7 @@ function module.setup(mqtt_client)
|
|||||||
battery_callback = battery.callback,
|
battery_callback = battery.callback,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
--- @type Module
|
||||||
return {
|
return {
|
||||||
charger,
|
charger,
|
||||||
outlets,
|
outlets,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
local ntfy = require("config.ntfy")
|
local ntfy = require("config.ntfy")
|
||||||
local presence = require("config.presence")
|
local presence = require("config.presence")
|
||||||
|
|
||||||
|
--- @class WindowsModule: Module
|
||||||
local module = {}
|
local module = {}
|
||||||
|
|
||||||
--- @class OnPresence
|
--- @class OnPresence
|
||||||
|
|||||||
Reference in New Issue
Block a user