HA, Hass.io, python, pexpect

I’ve been running home assistant on macOS for a few years.
In that time I’ve set up one particular configuration I’d like to bring to a new Hass.io instance (running in proxmox).
My set up uses expect scripts on the macOS host, that telnet into a “black box” power monitoring device, extract various sensor values and exit, returning this to HA, to log and display. HA is calling the expect scripts for each data stream using command line sensor.

I’m still a little confused about Hass.io, but from my reading, I shouldn’t expect (pun not intended) to be able to just port the scripts over as the HassOS is simplified and basically shouldn’t be tinkered with. I thought then at least I could copy the expect scripts to use python3’s pexpect. But installing that on the HassOS seems to just as “off limits” (as some have inferred in the forums whenever someone asks about such things.)

Can someone either confirm for me my fears, and/or suggest alternatives? Could I actually just install expect on HassOS, and copy the scripts over? Or install pexpect?
I feel like someone is going to say “just make a new Proxmox container, install linux and run whatever you want in there”. I guess I haven’t done that because it seems OTT for a simple set of scripts but also I’m not sure where to start with having the command line sensor call a script that’s in another container/VM/docker whatever. Perhaps you can tell I’m a little new to containers and virtualisation too.

I’ll post one of my existing expect scripts here:

#!/usr/bin/expect -f

# Assume $remote_server, $user_id, $my_password, and $my_command were read in earlier
  # in the script.

  #$remote_server=10.0.1.24
  set prompt {~ # }

log_user 0

  # Open a telnet session to a remote server, and wait for a username prompt.
  spawn telnet 10.0.1.24

expect "login: "
  send "root\r"
  expect "~ # "
send "bp get CTInput_1.power\r"
expect "\r\n"
expect "\r\n"
#expect eof
send "exit\r"

regexp {[-+]?[0-9]*\.?[0-9]+} $expect_out(buffer) output_value

puts $output_value

You can do an install of Home Assistant (previously called hass.io) in a generic linux system, this way you get the benefits from add-ons etc. and no limitation through the Home Assistant Base OS (calles HassOS).

Ok, thanks that is an informative suggestion. I think when I last looked at (formerly) HassIO vs (formerly) Home Assistant, add-ons were only available on the former.

Still quietly hoping someone sees my use of expect scripts and has a suggestion for incorporating that into (now called) Home Assistant without external services from the OS. I guess I’m at the point where one would usually decide that this should actually be a HA component for the device I’m trying to interrogate. Alas, it is a prototype on a project that has just been shuttered, so not likely to see the light of day or uptake of any great volume.