Massive config overhaul #6

Merged
Dreaded_X merged 23 commits from feature/improve_config into master 2025-10-22 02:17:46 +00:00

23 Commits

Author SHA1 Message Date
ad158f2c22 feat: Reduced visibility of config structs
All checks were successful
Build and deploy / build (push) Successful in 9m0s
Build and deploy / Deploy container (push) Successful in 49s
2025-10-22 04:13:54 +02:00
f36adf2f19 feat: Implement useful traits to simplify code 2025-10-22 04:09:01 +02:00
5947098bfb chore: Fix config type annotations
All checks were successful
Build and deploy / build (push) Successful in 12m30s
Build and deploy / Deploy container (push) Has been skipped
2025-10-22 03:59:59 +02:00
8a3143a3ea feat: Added type alias for setup and schedule types 2025-10-22 03:59:40 +02:00
9546585440 feat(config)!: Made schedule part of new modules
All checks were successful
Build and deploy / build (push) Successful in 11m57s
Build and deploy / Deploy container (push) Has been skipped
2025-10-22 03:24:34 +02:00
a938f3d71b feat(config)!: Improve config module resolution
All checks were successful
Build and deploy / build (push) Successful in 11m31s
Build and deploy / Deploy container (push) Has been skipped
The new system is slightly less flexible, but the code and lua
definitions is now a lot simpler and easier to understand.
In fact the old lua definition was not actually correct.

It is likely that existing configs require not/minimal tweaks to work
again.
2025-10-22 03:09:15 +02:00
a6c19eb9b4 fix: Fix issues with inner type definitions 2025-10-22 02:59:21 +02:00
7db628709a refactor: Split config
All checks were successful
Build and deploy / build (push) Successful in 10m56s
Build and deploy / Deploy container (push) Has been skipped
2025-10-20 05:02:19 +02:00
bc75f7005c 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.
2025-10-20 05:02:04 +02:00
2056c6c70d feat(config)!: Changed default config location 2025-10-20 04:48:33 +02:00
2fe9fbadfb feat(config)!: Remove device manager lua code
With the recent changes the device manager no longer needs to be
available in lua.
2025-10-20 04:48:33 +02:00
2db4af7427 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.
2025-10-20 04:48:32 +02:00
7b7279017f refactor: Restructured config to not rely on mqtt client being available
In preparation of changes to the mqtt client the config is rewritten to
use a device creation function for devices that need the mqtt client.

This also fixes a but where hallway_top_light was not actually added to
the device manager.
2025-10-20 04:48:29 +02:00
f05856cd0c feat(config)!: In config devices can now also be a (table of) function(s)
This function receives the mqtt client as an argument. In the future
this will be the only way to create devices that require the mqtt client.
2025-10-20 04:48:28 +02:00
02b6cf12a1 feat: Improved device conversion error message 2025-10-20 04:48:28 +02:00
02b87126e1 feat: Use ActionCallback for schedule
This has two advantages:
- Each schedule entry can take either a single function or table of
  functions.
- We get a better type definition.
2025-10-20 04:48:28 +02:00
1ffccd955c refactor(config)!: Move scheduler out of device_manager
Due to changes made in mlua the new scheduler is much simpler. It also
had no real business being part of the device manager, so it has now been
moved to be part of the returned config.
2025-10-20 04:48:28 +02:00
948380ea9b feat: Receive devices through config return 2025-10-20 04:48:28 +02:00
0c80cef5a1 feat: Ensure consistent ordering device definitions 2025-10-20 04:48:28 +02:00
84e8942fc9 feat: Generate definitions for config 2025-10-20 04:48:27 +02:00
b557afe2fc refactor: Move definition writing into separate function 2025-10-20 04:48:27 +02:00
5801421378 refactor: Move main.rs to bin/automation.rs 2025-10-20 04:48:22 +02:00
ba818c6b60 refactor(config)!: Setup for expanding lua config return
Moves the application config out of automation_lib and sets up the
config return type for further expansion.
2025-10-17 03:08:21 +02:00