feat: WIP
This commit is contained in:
@@ -2,17 +2,21 @@ local devices = require("automation:devices")
|
||||
local device_manager = require("automation:device_manager")
|
||||
local utils = require("automation:utils")
|
||||
local secrets = require("automation:secrets")
|
||||
local debug = require("automation:variables").debug or false
|
||||
local debug = require("automation:variables").debug and true or false
|
||||
|
||||
print(_VERSION)
|
||||
|
||||
local host = utils.get_hostname()
|
||||
print("Running @" .. host)
|
||||
|
||||
--- @param topic string
|
||||
--- @return string
|
||||
local function mqtt_z2m(topic)
|
||||
return "zigbee2mqtt/" .. topic
|
||||
end
|
||||
|
||||
--- @param topic string
|
||||
--- @return string
|
||||
local function mqtt_automation(topic)
|
||||
return "automation/" .. topic
|
||||
end
|
||||
|
||||
33
definitions/automation:devices.lua
Normal file
33
definitions/automation:devices.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
---@meta
|
||||
|
||||
local devices
|
||||
|
||||
---@class Action
|
||||
---@field action "broadcast"
|
||||
---@field extras table<string, string> | nil
|
||||
---@field label string | nil
|
||||
---@clear clear bool|nil
|
||||
|
||||
---@class Notification
|
||||
---@field title string
|
||||
---@field message string | nil
|
||||
-- NOTE: It might be possible to specify this down to the actual possible values
|
||||
---@field tags string[] | nil
|
||||
---@field priority "min" | "low" | "default" | "high" | "max" | nil
|
||||
---@field actions Action[] | nil
|
||||
|
||||
---@class Ntfy
|
||||
local Ntfy
|
||||
---@async
|
||||
---@param notification Notification
|
||||
function Ntfy:send_notification(notification) end
|
||||
|
||||
---@class NtfyConfig
|
||||
---@field topic string
|
||||
|
||||
devices.Ntfy = {}
|
||||
---@param config NtfyConfig
|
||||
---@return Ntfy
|
||||
function devices.Ntfy.new(config) end
|
||||
|
||||
return devices
|
||||
6
definitions/automation:secrets.lua
Normal file
6
definitions/automation:secrets.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
---@meta
|
||||
|
||||
---@type table<string, string|nil>
|
||||
local secrets
|
||||
|
||||
return secrets
|
||||
27
definitions/automation:utils.lua
Normal file
27
definitions/automation:utils.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
---@meta
|
||||
|
||||
local utils
|
||||
|
||||
---@class Timeout
|
||||
local Timeout
|
||||
---@async
|
||||
---@param timeout number
|
||||
---@param callback fun()
|
||||
function Timeout:start(timeout, callback) end
|
||||
---@async
|
||||
function Timeout:cancel() end
|
||||
---@async
|
||||
---@return boolean
|
||||
function Timeout:is_waiting() end
|
||||
|
||||
utils.Timeout = {}
|
||||
---@return Timeout
|
||||
function utils.Timeout.new() end
|
||||
|
||||
--- @return string hostname
|
||||
function utils.get_hostname() end
|
||||
|
||||
--- @return number epoch
|
||||
function utils.get_epoch() end
|
||||
|
||||
return utils
|
||||
6
definitions/automation:variables.lua
Normal file
6
definitions/automation:variables.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
---@meta
|
||||
|
||||
---@type table<string, string|nil>
|
||||
local variables
|
||||
|
||||
return variables
|
||||
Reference in New Issue
Block a user