Commit Graph

28 Commits

Author SHA1 Message Date
Joshua Rich 0e1282a015 refactor(hass,linux): ♻️ rearrange fields for sensor type 2024-12-22 14:49:49 +10:00
Joshua Rich b614ec3f7b feat(hass,linux): use options pattern to create sensors
- introduce an options pattern to create sensors. Workers can use `sensor.NewSensor` to create a sensor with whatever options are required.
- use new options pattern sensor creation in Linux sensor workers
2024-12-22 11:58:21 +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 1013711a77 perf(linux): try to avoid dynamic sensor ID generation 2024-09-05 16:52:36 +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 45f5189b52 refactor(linux): ♻️ remove linux.SensorType iota
- remove linux.SensorType iota in favour of a DisplayName field used to generate the Name and ID of a sensor
- move any functionality for using linux.SensorType into each sensor
- simplify some sensors to just use a plain linux.Sensor
2024-09-01 22:22:35 +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 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 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 a2b6368e29 refactor(linux): ♻️ simplify desktop settings watch function 2024-06-09 15:00:40 +10:00
Joshua Rich 79763b9ece refactor(linux): ♻️ improve readability and reduce lint issues 2024-06-08 17:17:23 +10:00
Joshua Rich da6109107b refactor: 🚨 format for linter warnings 2024-06-06 12:09:22 +10:00
Joshua Rich 547fdb96ad refactor: ♻️ utilise interfaces for sensor update logic
- define an interface for updating sensors
- on Linux, define interfaces for different sensor update methods
- rewrite Linux sensor code to move update logic from individual sensors to share code through interfaces
- update device sensors to utilise sensor update interface
2024-06-06 11:52:57 +10:00
Joshua Rich eafb8833f1 refactor(linux): 🔥 remove busRequest concept 2024-05-20 15:43:30 +10:00
Joshua Rich 46f6aaae85 perf(linux): rework desktop preferences sensors to use dbusx.WatchBus function 2024-05-20 10:29:53 +10:00
Joshua Rich 752afb8026 style(linux): ♻️ desktop accent color/scheme should be diagnostic sensors 2024-05-13 21:54:40 +10:00
Joshua Rich 1005e357c3 fix(linux): ✏️ fix warning message if desktop sensors are unavailable 2024-04-19 08:37:10 +10:00
Joshua Rich 50c2eab495 feat(linux): add sensors for accent color and color scheme type
- add an "accent color" sensor, which retrieves the accent color of the desktop theme
- add a "color scheme type" sensor, which indicates whether a dark or light desktop theme is in use
2024-04-18 20:08:52 +10:00