feat(config)!: Device creation function is now named entry

It now has to be called 'setup', this makes it possible to just
include the table as a whole in devices and it will automatically call
the correct function.
This commit is contained in:
2025-10-20 04:08:55 +02:00
parent a0c5189ada
commit 956f818a3b
6 changed files with 40 additions and 27 deletions

View File

@@ -9,12 +9,14 @@ local FulfillmentConfig
---@class Config
---@field fulfillment FulfillmentConfig
---@field devices Devices?
---@field modules Setup?
---@field mqtt MqttConfig
---@field schedule table<string, fun() | fun()[]>?
local Config
---@alias Devices (DeviceInterface | fun(client: AsyncClient): Devices)[]
---@alias SetupFunction fun(mqtt_client: AsyncClient): SetupInner?
---@alias SetupInner (DeviceInterface | { setup: SetupFunction } | SetupInner)[]
---@alias Setup SetupFunction | SetupInner
---@class MqttConfig
---@field host string