Commit Graph

67 Commits

Author SHA1 Message Date
97b944874a feat: Added/expanded Typed impls 2025-10-15 03:50:50 +02:00
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
1532958a86 feat: Added Typed impl for all automation devices
To accomplish this a basic implementation was also provided for some
types in automation_lib
2025-10-15 00:45:37 +02:00
5271e5ad81 refactor(config)!: Moved Timeout into utils module and moved module
All checks were successful
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
1d28b43264 refactor: Move module load code into separate function 2025-09-10 02:11:11 +02:00
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
23355190ca feat: Added attribute to easily register additional lua methods
Previously this could only be done by implementing a trait, like
`AddAdditionalMethods`, that that has an add_methods function where you
can put your custom methods. With this new attribute you can pass in a
register function directly!
2025-09-10 01:58:48 +02:00
e2fb680cd6 feat: Log version string during startup 2025-09-08 04:02:40 +02:00
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
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
eb36d41f17 Move ntfy and presence to automation_devices 2025-08-31 04:57:31 +02:00
d2b01123b8 Made the impl_device macro more explicit about the implemented traits
This also converts impl_device into a procedural macro and get rid of a
lot of "magic" that was happening.
2025-08-31 00:38:58 +02:00
c5262dcf35 Update to rust 1.89 and edition 2024 2025-08-31 00:38:58 +02:00
9f3b927cb6 Update dependencies and remove unused dependencies 2025-08-31 00:38:56 +02:00
746e19eb8c Use own struct to deserialize hue switch state and added hold actions 2025-01-28 22:48:02 +01:00
3905df690b Reworked air filter integration
All checks were successful
Build and deploy / Build application (push) Successful in 5m8s
Build and deploy / Build container (push) Successful in 2m19s
Build and deploy / Deploy container (push) Successful in 35s
2025-01-22 03:12:13 +01:00
e8d5698835 Updated dependencies 2024-12-08 00:53:31 +01:00
8877b24e84 Reorganized project 2024-12-08 00:15:03 +01:00
6b8d0b7d56 Added hue wall switches
All checks were successful
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
8b04435537 No more global LUA
All checks were successful
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
ae2c27551f Initial upgrade to mlua 0.10
All checks were successful
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
d11e79cdfa Devices now keep type in lua
All checks were successful
Build and deploy / Build application (push) Successful in 4m5s
Build and deploy / Build container (push) Successful in 1m9s
Build and deploy / Deploy container (push) Successful in 37s
2024-08-08 01:36:11 +02:00
14e14ca479 No need for Arc<RwLock<_>> inside the device wrapper anymore
All checks were successful
Build and deploy / Build application (push) Successful in 4m27s
Check / Run checks (push) Successful in 2m14s
Build and deploy / Build container (push) Successful in 55s
Build and deploy / Deploy container (push) Has been skipped
2024-07-26 01:17:12 +02:00
758500a071 Cleanup 2024-07-09 00:00:00 +02:00
d84ff8ec8e Initial google home trait macro 2024-07-08 23:59:59 +02:00
c7fc25d239 Fix: Scheduled function can not run async functions
Since Lua is not Send, this turned out to be a bit more complicated.
In order to make it work the async function needs to be pinned to a
single thread.
It works now, but the implementation looks a bit messy. Not sure it can
be improved through.
2024-05-07 00:05:38 +02:00
bf3d757710 Added lua function to get the current hostname
This makes it possible to set options depending on what machine we are
running
2024-05-07 00:05:38 +02:00
02d6630ac6 Started work on reimplementing schedules 2024-05-07 00:05:37 +02:00
55237a2ba2 Improved the internals of the LuaDeviceConfig macro and improve the
usability of the macro
2024-05-07 00:05:36 +02:00
f4a1b507e5 Everything needed to construct a new device is passed in through lua 2024-05-07 00:05:36 +02:00
bfc73c7bd3 Device config is now done through lua 2024-05-07 00:05:36 +02:00
3689a52afd Replaced impl_cast with a new and improved trait
All checks were successful
Build and deploy automation_rs / Build automation_rs (push) Successful in 4m0s
Build and deploy automation_rs / Build Docker image (push) Successful in 52s
Build and deploy automation_rs / Deploy Docker container (push) Successful in 28s
With this trait the impl_cast macros are no longer needed, simplifying
everything.
This commit also improved how the actual casting itself is handled.
2024-05-05 00:33:21 +02:00
db17b68e90 Feature: Schedule devices turning on/off
All checks were successful
continuous-integration/drone/push Build is passing
2023-11-17 00:01:13 +01:00
dd4be4a2ee Switched from toml to yaml for configuration
Some checks failed
continuous-integration/drone/push Build is failing
2023-11-05 22:41:48 +01:00
0298e7891e Use wakey fork on git.huizinga.dev instead of github.com 2023-09-01 21:16:13 +02:00
044c38ba86 More refactoring 2023-08-18 03:07:16 +02:00
cff9cb4bf6 Further improvements to how devices are created 2023-08-17 01:47:05 +02:00
b1506f8e63 Improved the way devices are instantiated from their respective configs
All checks were successful
continuous-integration/drone/push Build is passing
2023-08-16 02:17:21 +02:00
522fe27f11 Converted google home traits to be async
Some checks failed
continuous-integration/drone/push Build is failing
2023-08-11 03:46:44 +02:00
330523166f Store devices wrapped in Arc RwLock 2023-08-11 02:24:58 +02:00
7733e8cc8f cargo update 2023-08-09 23:51:09 +02:00
f4c1ac5c9b Moved most config structs to be in the same file as what they are for 2023-04-13 05:12:39 +02:00
854098e292 Added tokio-console support 2023-04-12 03:34:58 +02:00
ca8821b406 Rewrote impl_cast as a proc_macro to make it easier to work with 2023-04-12 01:20:21 +02:00
aa8963bd4a Directly send wol packet instead of using the webhook
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-19 22:19:26 +01:00
a0cefa8302 Improved error handling
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
2023-01-18 22:37:57 +01:00
81d4322ce9 Removed outdated feature on eui48 2023-01-17 17:18:24 +01:00
13f5c87c03 Improved error handling 2023-01-12 02:20:09 +01:00
220c68cd65 Converted more of the codebase to async 2023-01-10 00:37:13 +01:00
5b9d24e82f Switched to channels for communication between different parts of the code 2023-01-09 23:50:50 +01:00