Is it possible to create a sensor via Telnet?, or a script to get data via Telnet Commands?

Looks promising, I’ll give it a shot, not so great with python or scripting, thanks.

Looks simple enough, but one issue, the script I ran is on a Windows Laptop and not automated, as it’s not always on or in one place, I guess I just need to figure out a python script to run on my Raspberry Pi, which could then be used as advised.

Either a python script or an expect script :slight_smile:

Meanwhile I seem to have broken it, the server is rejecting my connections now :frowning:

(Sorry)

Yeah, happened a few times for me as well while using scheduled task, issue was in windows group policy, just rebooted, should be fine now.

I’m doing something very similar to this, did you ever get this working?

Yes it works.

@nickrout I have stumbled across this post. Your data and connection seems very familiar to a Veeder Root Tank Monitor. I am to working on this. Would you mind sharing any scripts or tutorials?

Thank you,
Alex

They are shared above.

I know this is a lot to ask for but I looking for a step by step tutorial. I am a complete novice with home assistant and im trying to learn. I am getting lost on what the procedure is to actually create this sensor. @nickrout

Thank you for you help!
Alex

This approach doesn’t seem to work from within HA (HomeAssistantOS install) because Python scripts, while exposed as services via the Python Script integration Python Scripts - Home Assistant , run in a sandbox environment where one gets no telnetlib:

NameError: name ‘telnetlib’ is not defined

Code:

command = data.get("command")
logger.info("telnet {} at {}".format(command, time.time()))

try:
    telnet = telnetlib.Telnet('10.X.Y.Z', 23, 90)
    output = telnet.read_until(b'login: ', 20)
    telnet.write(('abcxyz' + '\r\n').encode('ascii'))
    output = telnet.read_until(b'connection established : ', 20)
    telnet.write((':G\r\n').encode('ascii'))
    current_scene = telnet.read_until(b' OK')
    logger.info('Telnet: current scene: ' + current_scene)
    Telnet.close()
except EOFError:
    logger.error('Telnet: unexpected output from server: ' + output)
except Exception as e:
    logger.error('Telnet error :' + e)