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 2056c6c70d
commit be77711caf
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 Modules?
---@field mqtt MqttConfig
---@field schedule table<string, fun() | fun()[]>?
local Config
---@alias Devices (DeviceInterface | fun(client: AsyncClient): Devices)[]
---@alias SetupFunction fun(mqtt_client: AsyncClient): SetupTable?
---@alias SetupTable (DeviceInterface | { setup: SetupFunction? } | SetupTable)[]
---@alias Modules SetupFunction | SetupTable
---@class MqttConfig
---@field host string