Hi,
I’m hoping to have some suggestions and advice on how to succed controlling some outlets with OpenHAB trough telnet, which requires multiple commands in order to do so. All outlet’s are connected to a centralbox, which i can then control trough telnet or SSH (I’m using telnet for keeping it as simple as possible - the system is going to be local only.)
Currently i have made expect scripts for all outlets to control them, since they require multiple commands.
I have made 2 script’s for each, 1 for ON, 1 for OFF. The system can’t send eventupdates, unless it’s asked for it to do (so it won’t send a message back, if i turn the outlet on manually etc. - only if it’s requested for it’s current status)
In order for me to switch the outlet on, i would telnet and do the following (lowercase is my input, UPPERCASE it’s the system’s reply to each command):
Telnet haus 54001…
'logon user password secret'
'OK'
'put %devicename% 1'
'OK'
'logout'
'OK'
Since all outlets are hooked up to the centralbox i’m controlling, only the devicename would change, together with the 1 or 0 (for on or off). If i wanted to get the status for the device, i could simply type ‘status %devicename%’ instead. The current status for the outlet’s however doesent really matter to me in this case.
My thought was to have OpenHAB to somehow trigger one of my expect scripts i have to change the outlet’s status.
Do you have any suggestions on how to proceed to have OpenHAB being able to trigger these two expect scripts, 1 for on and 1 for off, or any other solutions perhaps?
The ultimate goal is to have Alexa integrated with OpenHAB, and have Alexa trigger the outlets on/off via OpenHAB.