Commit Graph

33 Commits

Author SHA1 Message Date
Joshua Rich 768cc40bf8 refactor: ♻️ additional code changes and adjust prefs tests for 7591c7a changes
- remove fetching preferences from context, use package methods instead
- rework cli option parsing
- adjust preferences tests and fix some bugs
2024-12-27 09:14:17 +10:00
Joshua Rich 7591c7ac11 refactor(preferences)!: ♻️ merge worker and agent preferences into single file
- use koanf for preferences management
- merge worker preferences into agent preferences file
- move device creation from preferences to device package

BREAKING CHANGE: Worker preferences are now in the agent preferences file, under a "worker_prefs" section. Any existing custom preferences will need to be manually migrated to this file.
2024-12-08 17:36:06 +10:00
Joshua Rich 124175f827 refactor(hass): 🚚 restructure hass package
- create separate api package for sending requests to hass api
- create new request types to send registration and event/sensor requests to hass
- validation back in api package
2024-10-26 10:23:29 +10:00
Joshua Rich 6db9810436 refactor(linux): ♻️ adjust code for event and sensor worker support 2024-10-17 20:20:54 +10:00
Joshua Rich 1d1fa2b0ba refactor(hass): 🚚 rename EntityState -> State for simplifcation 2024-09-29 10:46:49 +10:00
Joshua Rich 40e1751525 fix(linux): 🐛 event based workers should expose a send-only channel on Events method 2024-09-26 15:45:22 +10:00
Joshua Rich 80c57800d6 perf(hass): 🏗️ remove sensor interfaces, use exported struct instead
- remove the sensor.Details interface, which was inflexible and unneeded. Replace with an exposed struct Entity which workers can use
- move request/response code out of sensor package and into hass package, which makes more sense
2024-09-26 15:39:34 +10:00
Joshua Rich bb6eba83e5 refactor(agent): ♻️ rework controller/worker logic
- controllers now have an ID
- remove Start/StopAll controller methods and just use Start/Stop
- alter linux workers to move more code into shared methods
2024-09-16 17:09:38 +10:00
Joshua Rich 3047f6e0b7 refactor: 🚨 adjust linter config and correct violations 2024-09-03 15:47:22 +10:00
Joshua Rich 772fd56489 perf(linux): ♻️ store and fetch more values to/from context
- store D-Bus system/session bus connections in context
- store desktop portal value in context
- store session path in context
- inherit/use logger in context
2024-09-02 21:26:09 +10:00
Joshua Rich 73d07b6a0a feat(linux): dbus sensor overhaul
- create custom  reusable object for accessing a D-Bus property with its own get/set methods
- create custom reusable object for calling a method in D-Bus
- sue functional options for setting up a D-Bus watch
- actually ensure a watch is created for each method requested to be watched
- add validation for property, method and watch objects
- rework sensors using D-Bus to take advantage of new objects
2024-08-27 20:51:12 +10:00
Joshua Rich d5ad465f9e style: 🚨 clean up unused linter directives 2024-08-14 14:45:14 +10:00
Joshua Rich 2cf7dd4733 feat(linux): D-Bus overhaul
- rewrite dbusx package so that methods either act on a particular bus or require a bus passed as a parameter
- don't store D-Bus in context
- define a D-Bus API which stores bus connections which can be retrieved by other functions
- rework the linux controller to store the D-Bus api and pass to sensor/MQTT workers
- rework the linux controller so it can satisfy the agent's SensorWorker and MQTTWorker interfaces
2024-07-11 21:52:30 +10:00
Joshua Rich 5f12810f23 feat: 🔊 improve logging output
- add attributes to logs based on their source
- create child loggers as needed
2024-07-10 18:20:14 +10:00
Joshua Rich ebdd5e7d4d refactor: 🚧 replace zerolog with slog 2024-07-09 22:02:20 +10:00
Joshua Rich 23b106da57 refactor: ♻️ centralise device code
- move most code to represent a device into os-agnostic package
- for os-specific device code, utilise a `*_os.go` file
- generate mqtt device info without generating a new device
2024-07-07 15:41:43 +10:00
Joshua Rich dee5815788 refactor(linux): simplify linux worker types
- merge dbusType and eventType workers
2024-06-16 09:19:47 +10:00
Joshua Rich 988626a8d7 feat: add a framework for allowing sensor workers to be start/stopped 2024-06-14 13:59:06 +10:00
Joshua Rich acac8d74e1 fix(linux): don't provide a location sensor when not running on a laptop device 2024-06-13 11:37:54 +10:00
Joshua Rich aeca41062f fix: 🐛 pass a context to worker creation functions
- New* worker creation functions now take a context, that can be used as part of initialisation
- in Linux location sensor, check if a client can be created first
2024-06-13 10:37:14 +10:00
Joshua Rich 53a6284892 refactor(linux): 🚨 remove unused lint directives 2024-06-09 15:37:18 +10:00
Joshua Rich bf257214be refactor(device): 🚨 lint device code 2024-06-09 11:27:40 +10:00
Joshua Rich f344aeb946 refactor(linux): ♻️ improve code readability 2024-06-08 12:03:34 +10:00
Joshua Rich ea465cd5ab refactor(agent,hass,linux): ♻️ rework sensor updating code
- change linux location sensor to satisfy agent Worker interface
- change hass sensor update code to support location as a sensor
- simplify agent sensor updates to merge location and other sensor updates
2024-06-08 10:17:20 +10:00
Joshua Rich eafb8833f1 refactor(linux): 🔥 remove busRequest concept 2024-05-20 15:43:30 +10:00
Joshua Rich abe48d149d refactor(linux): ♻️ rework location sensor code to use new dbusx.WatchBus function 2024-05-19 20:57:17 +10:00
Joshua Rich a441579e34 perf(linux): use new D-Bus watch method for location updates 2024-05-18 15:26:54 +10:00
Joshua Rich bafae3ea9a refactor(linux): ♻️ re-use consts for better code readability 2024-05-14 14:57:40 +10:00
Joshua Rich 45335c4cf5 feat(dbusx)!: use generics to simplify dbusx usage
BREAKING CHANGE: The dbusx package now uses Go
generics for some functions, to combine both
fetching or setting a value or property as the
required type.
2024-02-16 10:28:41 +10:00
Joshua Rich d2e94b2d1c chore(all): 📄 update copyright date 2024-01-28 11:42:36 +10:00
Joshua Rich d670e04eeb refactor(linux): ♻️ rename dbushelpers -> linux/dbusx 2024-01-21 15:18:37 +10:00
Joshua Rich 3be4bd45bd refactor(linux,tracker,hass/api): ♻️ simplify location update code
export location struct from hass api; use in linux; use in tracker
2024-01-14 13:14:55 +10:00
Joshua Rich b2a315e1b3 refactor(linux): divide sensors into own packages on Linux 2024-01-06 09:33:18 +10:00