rabbit_go
2 years agoAdd back in pm25 gauge, and additionally do pm10 as well
jweigele [Tue, 22 Aug 2023 16:49:09 +0000 (09:49 -0700)]
Add back in pm25 gauge, and additionally do pm10 as well

2 years agoSlight update to change fudge duration on lights to 2h
jweigele [Mon, 21 Aug 2023 01:04:55 +0000 (18:04 -0700)]
Slight update to change fudge duration on lights to 2h

2 years agoUpdate wunder to pull AQI data for a location
jweigele [Mon, 21 Aug 2023 01:03:10 +0000 (18:03 -0700)]
Update wunder to pull AQI data for a location

Secondary update in reprocess to do the gauge set from the rabbitmq
topic, and just process PM2.5 and resend in the main function (since we
don't have PM2.5 in Wunderground data and I don't want to convert back)

2 years agoSun-up deactivation of lights to save energy
jweigele [Wed, 16 Aug 2023 21:17:15 +0000 (14:17 -0700)]
Sun-up deactivation of lights to save energy

 * Default is not enabled, "NightOnly: True" in yaml to turn on

2 years agoAdd wifi esp32 reporting, and an uptime gauge for tracking that
jweigele [Thu, 27 Jul 2023 16:33:16 +0000 (09:33 -0700)]
Add wifi esp32 reporting, and an uptime gauge for tracking that

2 years agoadd another type of device that I made custom
jweigele [Wed, 12 Jul 2023 07:47:37 +0000 (00:47 -0700)]
add another type of device that I made custom

 * it's different from my _current_ diy devices in that the firmware is
   programmed from the ground up, so the exposes/cluster/peripherals may
   all change - keep that in mind! but, seems to work for now

2 years agoA few smaller changes
jweigele [Fri, 30 Jun 2023 07:41:08 +0000 (00:41 -0700)]
A few smaller changes

 * Bugfix in fancontrol, keep it from sending a source which weirds out
   zigbee2mqtt
 * Bugfix in reprocess, don't modify the expire map at the same time as
   you're updating it from received messages (mutex)
 * Feature addition in lights - dummy mode, to just process updates but
   not take action on them (i.e. controlling lights)
 * Feature addition in reprocess, allowing it to read pm25 sensor data
   (DIY devices) and door sensor updates (off the shelf)

2 years agoAdd fancontrol main, simple program to turn zigbee fans on or off
jweigele [Fri, 2 Jun 2023 19:43:17 +0000 (12:43 -0700)]
Add fancontrol main, simple program to turn zigbee fans on or off

2 years agoForce update of lights when overriding color
jweigele [Thu, 2 Feb 2023 21:20:42 +0000 (13:20 -0800)]
Force update of lights when overriding color

2 years agoA few smaller changes
jweigele [Fri, 6 Jan 2023 01:59:53 +0000 (17:59 -0800)]
A few smaller changes

 * Bugfix in error message that was causing panics
 * Buffer send messages to speed up the surrounding loops
 * Check closing of delivery channel in the programs where it's reading,
   in case connection is killed
 * All white override, to change colors if you want :)

2 years agoAttempt to deal with serial losing sync in DIY handling
jweigele [Fri, 16 Dec 2022 07:15:31 +0000 (23:15 -0800)]
Attempt to deal with serial losing sync in DIY handling

 * Every so often the zigbee messages from a pico will drop a letter
 * My GUESS is this is due to the zigbee hardware not resyncing on each
    new byte (inherent to the protocol, but prolly not in this homegrown
    firmware)

Anyway, have the sending pico calc a crc32 and put it on the end of the json.
If anything up to the action map doesn't decode properly, well,
something's obviously wrong and we can just ignore that transmission.
If it all decodes properly but something's still off, we
can index into the crc32 value and compare (and then reject).  Since we
debug messages don't use action at all, they're already ignored, and on
send we'll just try again later if anything was garbled.

2 years agoA few tweaks
jweigele [Thu, 15 Dec 2022 05:02:01 +0000 (21:02 -0800)]
A few tweaks

 * Deal with send errors by actually exiting, which should cause pod
    restart to reconnect (or backoff, or whatever)
 * A bit more logging when you can't cast a map on DIY action decodes
 * Wait to refresh off states on lights, preventing IMMEDIATE turn-off
    when you first start the program, or have the pod moved elsewhere.
    Normal off->on and all other actions are unaffected.

2 years agoCouple bugfixes
jweigele [Wed, 14 Dec 2022 02:41:32 +0000 (18:41 -0800)]
Couple bugfixes

 * stairway_pico was added twice in reprocess, fixed
 * Being unable to process action as a map (which sometimes happens in
   zigbee) resulted in a panic in reprocess from time to time, just
printed and continued for now, though more changes might be needed
elsewhere
 * Very large gaping hole in the pico relayData code - it basically just
   set the RGB values then turned around and set them all to 0 (lol!).
So uhh, I added back in the } else { part of that block and now it seems
fine.

2 years agoWhoops, leaving the source in kept zigbee messing up.
jweigele [Tue, 13 Dec 2022 23:22:15 +0000 (15:22 -0800)]
Whoops, leaving the source in kept zigbee messing up.

Should probably split out by Relay vs Zig enabled later, but this is
fine for now.

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