Commit Graph

199 Commits

Author SHA1 Message Date
Dreaded_X ad158f2c22 feat: Reduced visibility of config structs
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
Dreaded_X f36adf2f19 feat: Implement useful traits to simplify code 2025-10-22 04:09:01 +02:00
Dreaded_X 8a3143a3ea feat: Added type alias for setup and schedule types 2025-10-22 03:59:40 +02:00
Dreaded_X 9546585440 feat(config)!: Made schedule part of new modules
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
Dreaded_X a938f3d71b feat(config)!: Improve config module resolution
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
Dreaded_X 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
Dreaded_X 2056c6c70d feat(config)!: Changed default config location 2025-10-20 04:48:33 +02:00
Dreaded_X 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
Dreaded_X 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
Dreaded_X 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
Dreaded_X 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
Dreaded_X 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
Dreaded_X 948380ea9b feat: Receive devices through config return 2025-10-20 04:48:28 +02:00
Dreaded_X 84e8942fc9 feat: Generate definitions for config 2025-10-20 04:48:27 +02:00
Dreaded_X b557afe2fc refactor: Move definition writing into separate function 2025-10-20 04:48:27 +02:00
Dreaded_X 5801421378 refactor: Move main.rs to bin/automation.rs 2025-10-20 04:48:22 +02:00
Dreaded_X 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
Dreaded_X 6fc3783d7a feat: Added lua definition files
Also added a pre-commit hook to ensure that the definitions files are
up-to-date.
2025-10-15 04:23:12 +02:00
Dreaded_X df64804b00 feat: Add bin to automatically generate lua definitions 2025-10-15 04:01:15 +02:00
Dreaded_X be1602d0e2 feat(config)!: Move mqtt module to actual separate module
The automation:mqtt module now gets loaded in a similar way as the
automation:devices and automation:utils modules.
This leads to a breaking change where instantiating a new mqtt client
the device manager needs to be explicitly passed in.
2025-10-15 03:53:55 +02:00
Dreaded_X 518abd169d chore: Removed dotenvy
Since secrets can now be set from automation.toml the .env file was no
longer used, so dotenvy can be removed.
2025-10-15 03:44:17 +02:00
Dreaded_X 8982e9c165 feat(config)!: Put automation modules in namespace
Build and deploy / build (push) Successful in 13m33s
Build and deploy / Deploy container (push) Successful in 39s
All lua modules that originate from automation_rs are now prefixed with
`automation:`.
2025-09-11 04:12:15 +02:00
Dreaded_X 5271e5ad81 refactor(config)!: Moved Timeout into utils module and moved module
Build and deploy / build (push) Successful in 10m43s
Build and deploy / Deploy container (push) Successful in 39s
The module is now setup in automation_lib::lua::utils.
2025-09-10 02:11:11 +02:00
Dreaded_X 1d28b43264 refactor: Move module load code into separate function 2025-09-10 02:11:11 +02:00
Dreaded_X 84e4b30b6a feat!: Improve lua module registration
Instead of having to call all the module registration functions in one
place it is possible for each module to register itself in a global registry.
During startup all the all the modules will be registered
automatically.

This does currently have one weakness, to need to ensure that the crate
is linked.
2025-09-10 02:10:45 +02:00
Dreaded_X e2fb680cd6 feat: Log version string during startup 2025-09-08 04:02:40 +02:00
Dreaded_X 8bb17e1440 feat(config)!: Reworked how configuration is loaded
The environment variable `AUTOMATION_CONFIG` has been renamed to
`AUTOMATION__ENTRYPOINT` and can now also be set in `automation.toml` by
specifying:
```
automation = "<path>"
```

Directly accessing the environment variables in lua in no longer
possible. To pass in configuration or secrets you can now instead make
use of the `variables` and `secrets` modules.

To set values in these modules you can either specify them in
`automation.toml`:
```
[variables]
<name> = <value>

[secrets]
<name> = <value>
```
Note that these values will get converted to a string.

You can also specify the environment variables
`AUTOMATION__VARIABLES__<name>` and `AUTOMATION__SECRETS__<name>` to
set variables and secrets respectively. By adding the suffix `__FILE` to
the environment variable name the contents of a file can be loaded into
the variable or secret.

Note that variables and secrets are identical in functionality and the
name difference exists purely to make it clear that secret values are
meant to be kept secret.
2025-09-05 04:48:00 +02:00
Dreaded_X ba37de3939 feat(config)!: Move new_mqtt_client out of global automation table into separate module
The function `new_mqtt_client` was the last remaining entry in the
global `automation` table. The function was renamed to `new` and placed
in the new `mqtt` module. As `automation` is now empty, it has been
removed.
2025-09-05 03:55:04 +02:00
Dreaded_X 22fee0ed77 feat(config)!: Move device_manager out of global automation table into separate module
Moved `automation.device_manager` into a separate module called
`device_manager`
2025-09-05 03:55:03 +02:00
Dreaded_X 5aebab28ed feat(config)!: Move util out of global automation table into separate module
Move `automation.util` into a separate module called `utils`.
2025-09-05 03:55:03 +02:00
Dreaded_X e626caad8a feat(config)!: Fulfillment config is now returned at the end of the config
Previously the fulfillment config was set by setting
`automation.fulfillment`, this will no longer work in the future when
the global automation gets split into modules.
2025-09-05 03:55:03 +02:00
Dreaded_X 77d7881a57 chore: Update/upgrade dependencies
There was a potential vulnerability in tracing-subscriber, so I took
this as an opportunity to update/upgrade all dependencies
2025-09-04 04:28:02 +02:00
Dreaded_X e21ea0f34e Implement custom lua print function that calls info
Build and deploy / build (push) Successful in 11m54s
Build and deploy / Deploy container (push) Successful in 45s
2025-09-01 02:47:47 +02:00
Dreaded_X c362952f7c Feature: Get current ms since unix epoch in lua 2025-08-31 05:41:49 +02:00
Dreaded_X eb36d41f17 Move ntfy and presence to automation_devices 2025-08-31 04:57:31 +02:00
Dreaded_X c5262dcf35 Update to rust 1.89 and edition 2024 2025-08-31 00:38:58 +02:00
Dreaded_X e8d5698835 Updated dependencies 2024-12-08 00:53:31 +01:00
Dreaded_X 8877b24e84 Reorganized project 2024-12-08 00:15:03 +01:00
Dreaded_X 42f391cde6 Removed duplicate OnMqtt entry 2024-12-07 22:33:52 +01:00
Dreaded_X e9f080ef19 Moved and improved hallways logic with lua
Build and deploy / Build application (push) Successful in 4m7s
Build and deploy / Build container (push) Successful in 1m18s
Build and deploy / Deploy container (push) Successful in 21s
2024-12-06 01:27:35 +01:00
Dreaded_X 9d4b52b511 Implemented new timeout mechanism for ikea_outlet
Build and deploy / Build application (push) Successful in 5m24s
Build and deploy / Build container (push) Successful in 1m8s
Build and deploy / Deploy container (push) Successful in 19s
2024-12-04 03:03:53 +01:00
Dreaded_X 03f1790627 Removed spammy debug message 2024-12-04 01:34:46 +01:00
Dreaded_X d39432fa22 ActionCallback can now handle tuples 2024-12-04 01:29:28 +01:00
Dreaded_X 6b8d0b7d56 Added hue wall switches
Build and deploy / Build application (push) Successful in 4m9s
Build and deploy / Build container (push) Successful in 53s
Build and deploy / Deploy container (push) Successful in 32s
2024-11-30 22:17:16 +01:00
Dreaded_X 4bb49a381b Use IkeaRemote to control devices and completely replace AudioSetup
Build and deploy / Build application (push) Successful in 3m24s
Build and deploy / Build container (push) Successful in 43s
Build and deploy / Deploy container (push) Successful in 18s
2024-11-30 06:06:30 +01:00
Dreaded_X a353ba3d08 Added IkeaRemote 2024-11-30 05:45:03 +01:00
Dreaded_X 157bbf923f Added generic action callback 2024-11-30 05:44:23 +01:00
Dreaded_X 9719c46136 Added deref to impl_device to account for changes in mlua 0.10
Build and deploy / Build application (push) Successful in 3m26s
Build and deploy / Build container (push) Successful in 52s
Build and deploy / Deploy container (push) Successful in 32s
2024-11-30 05:31:38 +01:00
Dreaded_X 8b04435537 No more global LUA
Build and deploy / Build application (push) Successful in 3m45s
Build and deploy / Build container (push) Successful in 54s
Build and deploy / Deploy container (push) Successful in 29s
2024-11-30 05:10:40 +01:00
Dreaded_X ae2c27551f Initial upgrade to mlua 0.10
Build and deploy / Build application (push) Successful in 7m59s
Build and deploy / Build container (push) Successful in 2m54s
Build and deploy / Deploy container (push) Successful in 19s
2024-11-30 04:47:52 +01:00