Micolithe
Agender
36 years old
Philadelphia, PA
Online Now
Last Login: 08/30/2007

Agender Enby, Trans, Gay, AND the bearer of the gamer's curse. Not a man, not a woman, but instead I am puppy.
I got a fat ass and big ears.

--

Yes I did the cooking mama Let's Play way back when. I post alot about Tech (mostly how it sucks) and Cooking and Music and Television Shows and the occasional Let's Play video
💖@FadeToZac

--

We all do what we can ♫

So we can do just one more thing ♫

We can all be free ♫

Maybe not in words ♫

Maybe not with a look ♫

But with your mind ♫


last.fm listening



micolithe
@micolithe

ok WELL apparently my webhost & verizon collectively don't allow sending mail the way i'm trying to do it with mailx (verizon's ip range is on a blocklist that my host enforces because of verizon's policies as far as i can tell)


micolithe
@micolithe

Write a shell script (or maybe python script?) for a cron job that makes a REST request to my HomeAssistant instance which then will cause a Telegram Bot I just built to message me immediately.

I'm much more likely to notice a Telegram message than an E-Mail because my phone will vibrate, as opposed to an e-mail where it doesn't do that.


micolithe
@micolithe

This is far and above the stupidest way I've ever worked around a problem.


micolithe
@micolithe

I just realized that I can make it less complicated and remove a point of failure by just writing a python script to interact with the telegram bot api instead of using homeassistant to do it.

I also don't know how to pull out a JSON payload in home assistant and pass it downstream to another integration but I sure do know how to do it with python. json.loads(), loads a jason baby!!!!


micolithe
@micolithe

That really wasn't that hard. I didn't even need to use a telegram bot python module because I don't need to poll for messages from users, I'm sending messages one-way from the bot to me, which is a single REST request. Most of the work I managed to do in about 30 minutes, but in the case where I detached too many disks from the VM, python was being weird about it.

As it turns out zpool status -v in the python subprocess module pipes it's output to stderr when there's no detected storage pools, even though it doesn't do that if it detects a pool that's degraded, but zpool status -x doesn't? Instead if i use -x it just goes to stdout?

Anyway I had to use subprocess.Popen.communicate() to get both and convert them to strings from bytes individually and THEN use ''.join() to concatenate them together


You must log in to comment.