Commit Graph

74 Commits

Author SHA1 Message Date
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
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
b557afe2fc refactor: Move definition writing into separate function 2025-10-20 04:48:27 +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
a95574b731 feat: Added type annotations to config.lua
All checks were successful
Build and deploy / build (push) Successful in 9m16s
Build and deploy / Deploy container (push) Successful in 3m12s
In some instances this required some restructuring of the code to be
able to properly add the annotations.
2025-10-15 04:24:08 +02:00
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
b784cfed4a feat: Notify when windows are left open when leaving
All checks were successful
Build and deploy / build (push) Successful in 15m2s
Build and deploy / Deploy container (push) Successful in 2m8s
2025-10-10 01:12:58 +02:00
8982e9c165 feat(config)!: Put automation modules in namespace
All checks were successful
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
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
da04fad520 refactor(config)!: Move device proxies into module
Instead of registering the device proxies in the global namespace they
are now registered in a module called `devices`.
2025-09-10 02:11:09 +02:00
aad089aa10 chore: Removed old leftover contact sensor presence config 2025-09-10 01:46:16 +02:00
18e40726fe refactor: Remove unneeded wrapper functions when specifying callbacks
These wrappers can be moved up to where the callback itself is defined
instead of having to wrap the call manually. This also works a lot nicer
now that it is possible to provide multiple callback functions.
2025-09-10 01:46:16 +02:00
1925bac73c fix: Front door presence does not get cleared properly 2025-09-10 01:46:16 +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
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
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
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
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
f3b1854beb fix: Crash if hallway automation is called before door/trash have been initialized
Resolves: #4
2025-09-04 04:27:49 +02:00
8109dcf2f5 feat: Added low battery notification and made mqtt message parsing more robust
Resolves: #1
2025-09-04 04:26:34 +02:00
45de83ef2f Removed old presence system 2025-08-31 23:57:59 +02:00
2a1f75f158 Move front door presence logic to lua 2025-08-31 23:57:59 +02:00
74568b4e1f Handle turning off devices when away through lua 2025-08-31 23:57:59 +02:00
fefccf03d7 Removed DebugBridge as it no longer served a purpose 2025-08-31 23:57:59 +02:00
b56a16d0d7 Moved presence debug mqtt message to lua 2025-08-31 23:57:59 +02:00
1530875045 Presence and light sensor call all function in array 2025-08-31 23:57:58 +02:00
9616017c8f Print lua version on startup 2025-08-31 23:57:56 +02:00
6db5831571 Removed old darkness system 2025-08-31 23:56:28 +02:00
aa730c9738 Moved darkness debug mqtt message to lua 2025-08-31 05:41:49 +02:00
549d821e3a Moved hue bridge on darkness to lua 2025-08-31 05:41:46 +02:00
4980f4888e Removed unused event code 2025-08-31 05:01:56 +02:00
6c9d2c16c1 Converted presence notification into lua callback 2025-08-31 03:55:08 +02:00
2d9e3d26f2 Send laundy notification from lua 2025-08-31 03:55:08 +02:00
7f41132965 Switch workbench light to new color temperature light
All checks were successful
Build and deploy / Build application (push) Successful in 5m55s
Build and deploy / Build container (push) Successful in 2m16s
Build and deploy / Deploy container (push) Successful in 34s
2025-08-22 23:27:05 +02:00
00cd0366fd Added hue groups for bedroom lights controlled by hue switch
All checks were successful
Build and deploy / Build application (push) Successful in 3m34s
Build and deploy / Build container (push) Successful in 57s
Build and deploy / Deploy container (push) Successful in 32s
2025-01-28 23:33:30 +01:00
68684d9410 Added hue groups for kitchen and living room lights controlled by hue switch
All checks were successful
Build and deploy / Build application (push) Successful in 3m50s
Build and deploy / Build container (push) Successful in 1m21s
Build and deploy / Deploy container (push) Successful in 35s
2025-01-28 22:49:37 +01:00
47d509cec1 Unneeded mqtt client in huegroup
Some checks failed
Build and deploy / Build application (push) Failing after 2m57s
Build and deploy / Build container (push) Has been skipped
Build and deploy / Deploy container (push) Has been skipped
2025-01-28 22:43:50 +01:00
856bc3cc96 Updated airfilter ip
All checks were successful
Build and deploy / Build application (push) Successful in 4m16s
Build and deploy / Build container (push) Successful in 1m25s
Build and deploy / Deploy container (push) Successful in 35s
2025-01-27 02:21:13 +01:00
fbabc978b1 Reworked IkeaOutlet into more generic outlet that also (optionally) supports power measurement
All checks were successful
Build and deploy / Build application (push) Successful in 4m15s
Build and deploy / Build container (push) Successful in 1m16s
Build and deploy / Deploy container (push) Successful in 19s
This new power measurement feature is used to turn the kettle off
automatically once it is done boiling
2025-01-26 04:48:59 +01:00
48c600b9cb Use ip instead of dns name for airfilter
All checks were successful
Build and deploy / Build application (push) Successful in 4m13s
Build and deploy / Build container (push) Successful in 1m0s
Build and deploy / Deploy container (push) Successful in 33s
The dns name does not resolve properly in the container
2025-01-22 03:55:28 +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
5af713cf8f Switched speaker and mixer from KasaOutlet to IkeaOutlet
All checks were successful
Build and deploy / Build application (push) Successful in 4m47s
Build and deploy / Build container (push) Successful in 1m21s
Build and deploy / Deploy container (push) Successful in 33s
2025-01-11 17:55:20 +01:00
ae61cf5dd2 Updated ips
All checks were successful
Build and deploy / Build application (push) Successful in 3m35s
Build and deploy / Build container (push) Successful in 1m22s
Build and deploy / Deploy container (push) Successful in 33s
2024-12-27 22:24:31 +01:00
8ad75a1148 Added workbench light (no color temp control for now)
All checks were successful
Build and deploy / Build application (push) Successful in 3m30s
Build and deploy / Build container (push) Successful in 1m6s
Build and deploy / Deploy container (push) Successful in 33s
2024-12-17 19:59:08 +01:00
ef180f6261 Added automatic storage room light
All checks were successful
Build and deploy / Build application (push) Successful in 3m30s
Build and deploy / Build container (push) Successful in 1m18s
Build and deploy / Deploy container (push) Successful in 31s
2024-12-16 23:15:45 +01:00
1462755f36 Added window sensors, updated room names, and improved hallway automation
All checks were successful
Build and deploy / Build application (push) Successful in 3m16s
Build and deploy / Build container (push) Successful in 52s
Build and deploy / Deploy container (push) Successful in 31s
2024-12-12 17:17:50 +01:00
24815edd34 Increased hallway light timeout back to two minutes
All checks were successful
Build and deploy / Build application (push) Successful in 3m59s
Build and deploy / Build container (push) Successful in 1m18s
Build and deploy / Deploy container (push) Successful in 34s
2024-12-10 22:23:07 +01:00