JIT Battery

The UPS battery came just in time, the UPS that needed its battery replacing was a major one holding up a bunch of network gear.

The battery came in today and it was installed after it became clear, the unit was gonna keep going down.

I started a maintenance database, to track these things. This battery was 4 years old, the OEM ones should be replaced at 4, 3 if it is a cyberpower (which this was) and 3 more also if it is 3rd party, maybe 2.

Another things I was looking at was zfs, I had a test server going to test it out.

I am rethinking my new nearstore system. Thinking it should be ZFS instead of EXT or XFS.

Took doggie to vet today, when he got home he was acting weird, not hungry.

Good news, weight going down.

Weight: 347.6

Posted in Coding, New Toys, Technical, Training, Weigh In | Leave a comment

UPS Dying

My lastman project worked, got a bunch of SMS messages when the UPS for my stack of switches died.

I looked at when I purchased this UPS, July 2021, so yeah 4 years, need to be replaced.

I got quality batteries, this is a very important stack.

Another thing I got done was listing devices and entities via python. Yesterday I got it working with curl/bash. Here is my code for python

#!/usr/bin/python3
"""
hassquery.py
Simple Python Script that uses websockets API to query devices in home assistant
By Larry Apolonio
Date : 2025-05-13
"""
import argparse
import asyncio
import json
import websockets

# === CONFIGURATION ===
HA_WS_URL = "ws://homeassistant.local:8123/api/websocket"
ACCESS_TOKEN = "TOKENGOESHERE" # Replace with your token

# === PARSE ARGUMENTS ===
parser = argparse.ArgumentParser(description="List Home Assistant devices by integration.")
parser.add_argument(
"-i", "--integration",
type=str,
default="all",
help="Integration to filter by (e.g. zha, tplink, mqtt, hue). Use 'all' to list everything."
)
args = parser.parse_args()
filter_integration = args.integration.lower()

async def list_devices_by_integration():
"""
list_devices_by_integration
Actual function to list devices
"""
async with websockets.connect(HA_WS_URL, max_size=10 * 1024 * 1024) as ws:
# Step 1: Authenticate
await ws.recv()
await ws.send(json.dumps({"type": "auth", "access_token": ACCESS_TOKEN}))
auth_response = json.loads(await ws.recv())
if auth_response.get("type") != "auth_ok":
print("Authentication failed.")
return
print(f"Authenticated. Listing devices for integration: '{filter_integration}'\n")

# Step 2: Get device registry
await ws.send(json.dumps({"id": 1, "type": "config/device_registry/list"}))
while True:
msg = json.loads(await ws.recv())
if msg.get("id") == 1 and msg.get("type") == "result":
devices = msg.get("result", [])
break

# Step 3: Get entity registry
await ws.send(json.dumps({"id": 2, "type": "config/entity_registry/list"}))
while True:
msg = json.loads(await ws.recv())
if msg.get("id") == 2 and msg.get("type") == "result":
entities = msg.get("result", [])
break

# Step 4: Build entity map
entity_map = {}
for ent in entities:
device_id = ent.get("device_id")
if device_id not in entity_map:
entity_map[device_id] = []
entity_map[device_id].append(ent)

# Step 5: Filter and print
matched_count = 0
for device in devices:
device_id = device.get("id")
related_entities = entity_map.get(device_id, [])
platforms = {e.get("platform", "").lower() for e in related_entities}

if filter_integration != "all" and filter_integration not in platforms:
continue

matched_count += 1
name = device.get("name_by_user") or device.get("name") or "Unnamed"
manufacturer = device.get("manufacturer", "Unknown")
model = device.get("model", "Unknown")
identifiers = device.get("identifiers", [])
area = device.get("area_id", "N/A")

print(f"Name : {name}")
print(f"Manufacturer : {manufacturer}")
print(f"Model : {model}")
print(f"Area : {area}")
print(f"Identifiers : {identifiers}")
print(f"Platforms : {', '.join(sorted(platforms)) or 'N/A'}")
print("Entities :")
for ent in related_entities:
print(f" - {ent['entity_id']} ({ent['platform']})")
print("-" * 60)

print(f"\nTotal devices found: {matched_count}")

if __name__ == '__main__':
asyncio.run(list_devices_by_integration())

Weight: 347.8

Posted in Coding, New Toys, Technical, Training, Weigh In | Leave a comment

Overweight, Low Energy

Bad combination. Feel so bloated, so slow, quality of life is bad.

But I think today is a turning point.

Got approved for zepbound. I gonna commit to it till I am at least under 300 and going to push till I have a 3 digit weight loss.

Also figured out how to list devices from home assistant to a json file.

curl -X "POST" "http://ip.ad.dd.dr:8123/api/template" \
-H 'Authorization: Bearer TOKENHERE' \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{"template": "
{% set devices = states
| map(attribute=\\"entity_id\\")
| map(\\"device_id\\")
| unique
| reject(\\"eq\\",None)
| list %}
{%- set ns = namespace(devices = []) %}
{%- for device in devices %}
{%- set entities = device_entities(device) | list %}
{%- if entities %}
{%- set ns.devices = ns.devices + [ {device: {\\"name\\": device_attr(device, \\"name\\"), \\"entities\\": entities}} ] %}
{%- endif %}
{%- endfor %}
{{ ns.devices | tojson }}\\"}"
}' -o devices.json

Weight: 349.6

Posted in Coding, Technical, Training, Weigh In | Leave a comment

Mother’s Day 2025

Yesterday my wife was treated by our kids, but today I am so glad we have the Ring Camera with 2 way going. I was able to contact my mom through that. Eventually found out her cell wasn’t paid and my sister just reactivated it.

Meanwhile, here in Washington, my wife wanted Bar B Que from C. Davis truck at Lowes and at the same time son and I went to to Federal way for some Church’s Texas Chicken.

Did some work, replaced the battery in shed sensors, and started to clean the sap off the top of the CRV.

Hoping in 6 months I will be under 300lbs.

Weight: 351.4

Posted in New Toys, Technical, Training, Weigh In | Leave a comment

Tired All The Time

Had nearly 9 hours of sleep today yet I am still tired.

I could not get what I needed done early.

Maybe just a schedule shift.

It is later and I am more awake.

Weight: 351.2

Posted in Training, Weigh In | Leave a comment

Bingo

Played bingo for the first time today.

I knew what it was and played for fun in the past, but this was the first time I had money involved.

I was tired when we drove up there, but still made it.

I need some sleep though. Three day weekend, I will get some sleep sometime.

Weight: 350.4

Posted in Milestone, Training, Weigh In | Leave a comment

Looking to Lose Weight

Met someone while watching Renton High School track today. Kinda of high energy guy, father of one of the kids I know.

He wants to run a half marathon, I think I am going to try it out too.

We will see how it goes.

Weight: 350.0

Posted in Training, Weigh In | Leave a comment

Next Level Nagios XI skills

Earned my next set if strips with nagios xi and more. I finally using the API to add stuff to nagios.

I was able to export all the certs in XCA and make them monitored in Nagios XI.

Kind of cool, pushed my skills in python programming and got my feet wet in Nagios XI web API.

Weight: 348.6

Posted in Coding, Technical, Training, Weigh In | Leave a comment

Expiring Certs

Working Through a way to detect expiring certs. Got a good python script going. This is for both work and home.

Works for nagios core but need to make it work for nagios XI

Weight: 346.2

Posted in Coding, Technical, Training, Weigh In | Leave a comment

Windows 10 to Windows 11 Failure

Tried updating my main PC from windows 10 to windows 11 over the weekend. Forgot to mention that over the weekend. But it was a failure, not sure why.

Haven’t sleep well, gonna sleep early tonight.

Today also looked at getting back on zepbound, gonna help me loss weight.

Weight: 348.6

Posted in Training, Weigh In | Leave a comment