rabbit_go
2 years agoFully implemented lights package and further cleaned up logging
jweigele [Tue, 13 Dec 2022 21:43:53 +0000 (13:43 -0800)]
Fully implemented lights package and further cleaned up logging

 * Lights now has working subimplementations for pico and zig
 * Fixed a bug with switch expiration infinite looping
 * Interfaces are used to get the specific relay data... probably very
   messy but it's the smallest amount of function changes I could do
 * Logging is now bound per relay, to allow more specific output when
   we're debugging (i.e. friendlyname for those that support it, etc)
 * Prometheus is basic with no metrics expiration, and a simple one
   second update loop... but that's how it was before in python SO

2 years agoBugfixes for zigbee2mqtt in reprocess (mostly)
jweigele [Tue, 13 Dec 2022 18:42:14 +0000 (10:42 -0800)]
Bugfixes for zigbee2mqtt in reprocess (mostly)

Basically, whenever z2m gets a json encoded dict, it tries to deref the
keys and use as converters.  That normally works fine, but when you have
extra "source" values then it looks up converters that don't exist -
error!
 * Allow for EmptySource, a param to disable sending it even if it
   exists

Second, we were querying power devices with "power" gets, which
mobile_power doesn't support
 * Properly adhere to "queryNeeded", allowing us to either get the
   requests for updates, or just let it send along in its own time

2 years agoInitial testing of lights implementation.
jweigele [Tue, 13 Dec 2022 03:24:04 +0000 (19:24 -0800)]
Initial testing of lights implementation.

 * Only does RGBRelay and RGBZig right now, still needs pico and
   switch overrides
 * Seems to emulate behavior alright, but not much testing done
 * Parsing very rudimentary with a yaml config, but better in the long
   run

2 years agoClean up the expiration of stale metrics and prepare for production
jweigele [Mon, 12 Dec 2022 02:51:44 +0000 (18:51 -0800)]
Clean up the expiration of stale metrics and prepare for production

 * Add power metric expiration
 * Make the map expiry keys a joined string, which will help prevent
    weird array lengths being required all over the place, makes expiry
    more generic in implementation
 * Switch routing keys to their production variants
 * _Should_ work in kubernetes as the others do, just need to deploy

2 years agoLarge logging and flags revamp
jweigele [Mon, 12 Dec 2022 01:25:50 +0000 (17:25 -0800)]
Large logging and flags revamp

 * Everything is using klog (interfaced with logr) to do log output now
 * This provides different visibility levels for debug and a better
   format
 * Init flags and logger creation in main (emulate other files mostly)
 * As part of the revamp, provide some structured yaml marshalling for
   future config

2 years agoFormatting slight tweaks (logging) and build script updates
jweigele [Sat, 10 Dec 2022 06:55:46 +0000 (22:55 -0800)]
Formatting slight tweaks (logging) and build script updates

2 years agoTidy up helper somewhat, and start on implementing reprocess
jweigele [Fri, 9 Dec 2022 22:50:25 +0000 (14:50 -0800)]
Tidy up helper somewhat, and start on implementing reprocess

For helper:
 * Helper does most of the json I/O so we don't need to import in other files
 * Add some structs to manage the complexity of multiple routing keys
 * Various convenience options (IncludeDate on send, Source in the RabbitConfig) for easier scope

For reprocess:
 * Reads in temp pretty simply, and sets prometheus gauges as we've done before
 * Kinda handles DIY temperature (resends and prometheus gauge), and does not care about motion (so won't send it back out)
 * Weird chain of structs to implement different devices
 * Have not started on power or other complicated logic yet

2 years agoAdded separate builds, and implemented new timecolorshift functionality
jweigele [Tue, 6 Dec 2022 20:17:26 +0000 (12:17 -0800)]
Added separate builds, and implemented new timecolorshift functionality

 * Dockerfile.whatever is called to build for a particular binary, buildall.sh does all the ones we know about
   - Still need to call dockregassemble at the end, don't forget!
 * Most of the functionality in timecolorshift is ported over from the python version
   * This does mean that the colors are hardcoded in the binary, maybe look at grabbing them from kubernetes directly in the future
 * Have only really gone through one peak at midday, so unsure how the color mixing and rollover func works

2 years agoAbstract some of this out further, routing key passed as setup (seems to be tested...
jweigele [Tue, 6 Dec 2022 16:20:04 +0000 (08:20 -0800)]
Abstract some of this out further, routing key passed as setup (seems to be tested working)

2 years agoBreak out helper functions to a helper package for further work
jweigele [Tue, 6 Dec 2022 16:10:56 +0000 (08:10 -0800)]
Break out helper functions to a helper package for further work

2 years agoOne more change, denotes the module as a git repo so we don't fetch over https
jweigele [Tue, 6 Dec 2022 15:35:11 +0000 (07:35 -0800)]
One more change, denotes the module as a git repo so we don't fetch over https

2 years agoUpdate module path for potential imports later
jweigele [Tue, 6 Dec 2022 15:06:19 +0000 (07:06 -0800)]
Update module path for potential imports later

2 years agoFirst working run!
jweigele [Tue, 6 Dec 2022 04:03:59 +0000 (20:03 -0800)]
First working run!

 * Rename the module slightly for future compat (I think?)
 * Connects to the rabbitmq server and sends messages like we'd want
 * Some values hardcoded, and not really any retry or backoff logic
    - This is actually good! I swear!
    - Leave the kubelet doing the backoff and retry, and see how that takes
 * One restarted mq server seemed to work, but probably needs some testing

2 years agoInitial commit, really just spams lol on a random topic
jweigele [Tue, 6 Dec 2022 02:40:31 +0000 (18:40 -0800)]
Initial commit, really just spams lol on a random topic