feat(config)!: Config now returns the mqtt config instead of the client
Instead the client is now created on the rust side based on the config. Devices that require the mqtt client will now instead need to be constructor using a function. This function receives the mqtt client.
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
-- DO NOT MODIFY, FILE IS AUTOMATICALLY GENERATED
|
||||
---@meta
|
||||
|
||||
local mqtt
|
||||
|
||||
---@class MqttConfig
|
||||
---@field host string
|
||||
---@field port integer
|
||||
---@field client_name string
|
||||
---@field username string
|
||||
---@field password string
|
||||
---@field tls boolean
|
||||
local MqttConfig
|
||||
|
||||
---@class AsyncClient
|
||||
local AsyncClient
|
||||
---@async
|
||||
---@param topic string
|
||||
---@param message table?
|
||||
function AsyncClient:send_message(topic, message) end
|
||||
mqtt.AsyncClient = {}
|
||||
---@param device_manager DeviceManager
|
||||
---@param config MqttConfig
|
||||
---@return AsyncClient
|
||||
function mqtt.new(device_manager, config) end
|
||||
|
||||
return mqtt
|
||||
@@ -10,8 +10,24 @@ local FulfillmentConfig
|
||||
---@class Config
|
||||
---@field fulfillment FulfillmentConfig
|
||||
---@field devices Devices?
|
||||
---@field mqtt AsyncClient
|
||||
---@field mqtt MqttConfig
|
||||
---@field schedule table<string, fun() | fun()[]>?
|
||||
local Config
|
||||
|
||||
---@alias Devices (DeviceInterface | fun(client: AsyncClient): Devices)[]
|
||||
|
||||
---@class MqttConfig
|
||||
---@field host string
|
||||
---@field port integer
|
||||
---@field client_name string
|
||||
---@field username string
|
||||
---@field password string
|
||||
---@field tls boolean?
|
||||
local MqttConfig
|
||||
|
||||
---@class AsyncClient
|
||||
local AsyncClient
|
||||
---@async
|
||||
---@param topic string
|
||||
---@param message table?
|
||||
function AsyncClient:send_message(topic, message) end
|
||||
|
||||
Reference in New Issue
Block a user