💾 Archived View for gemlog.blue › users › tech64 › 1720048397.gmi captured on 2024-08-31 at 20:33:02. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2024-07-09)

-=-=-=-=-=-=-

I was looking for ways to display the information captured in a nice HTML page, but all of them where out of hand, a whole docker for a crappy interface? That can't be right! Me making janky code in Python saves the day!

So I started rtl_433 in "recording mode" in JSON. I looked for any easy ways to interact with JSON with Python but they all suck, and quickly switched to .csv not long after.

CSV files are way easier to manage in Python than JSON

While my code is 99% code snippets from StackOverflow it works and it's EXTREMELY janky.

Okay, first off, load up the CSV, and convert it to HTML, Bingo! That was the first iteration of my code, atleast. But there's a problem: rtl_433 adds columns for everything, like rain, wind, etc. which I don't have, I only have humidity and temperature. Nothing more.

After this, I found code that would strip out other columns while leaving only the ones I want: Time & Date, Temperature and Humidity. While I'm at it I also rename them from "temperature_C" (Not very professional, is it?) to "Temperature".

Let's make it even prettier: Adding "C" and "%" to Temperature and Humidity respectively, that was actually very easy!

Then, on the page I display only the last 4 entries, as opposed to 567+ (yes I let it run enough to get there) entries all at once.

Then I wanted to add a header to the page: the janky solution? Add the header (<h1>Weather Station<\h1>) to the HTML file like if it's a text file. Like adding it to line 3 or whatever of the HTML file. Also adding a auto-refresh (60s) to the page since the script automatically reruns every minute. I know this has to be some kind of crime, right?

Final touches to the HTML: Using that janky technique I added a page title (tab title), background and a timestamp saying when was the Python script last run.

But then I quickly got bored and added a graph, I wanted to use some other libraries for this but I settled on Plotly just for it's ease of use.

Job Done!

I will be uploading the script soon. Stay tuned!