Trying to get LCD4Linux to work with Runtime Commands

Slowly getting my automation server setup, migrating from Windows XP with HouseBot to OH3.

It’s a steep learning curve for me, as never really done much with Linux, but so far it’s going well, openHAB is an amazing piece of software!

Anyway, I have got LCD4Linux to work with my USB2LCD screen, now I would like to get some of my item states to display. The LCD4Linux has an exec plugin that supports the following:

exec(‘head -1 /etc/passwd’, 1000)

So I was wondering if the Runtime Command would work? I can do the following, but I need it to run this on one line. Is this possible?

[21:07:13] root@house:~# openhab-cli console

Logging in as openhab
Password:

                           _   _     _     ____
   ___   ___   ___   ___  | | | |   / \   | __ )
  / _ \ / _ \ / _ \ / _ \ | |_| |  / _ \  |  _ \
 | (_) | (_) |  __/| | | ||  _  | / ___ \ | |_) )
  \___/|  __/ \___/|_| |_||_| |_|/_/   \_\|____/
       |_|       3.0.0 - Release Build

Use '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
To exit, use '<ctrl-d>' or 'logout'.

openhab> openhab:status HouseAlert
Security Alarm has been Disarmed
openhab>

Thanks

  • use the command
    ssh -p 8101 openhab@localhost op fenhab:status HouseAlert

  • in case that does not work you need to use a private/public ssh keypair to run the command
    ssh -p 8101 -i ~/.ssh/openhab openhab@localhost bundle:list

  • the private key needs to be stored in the home of user openhab in dir .ssh

  • the public key needs to be imported / stored in the file /var/lib/openhab/etc/keys.properties

1 Like

Thanks for the reply.

 ssh -p 8101 openhab@localhost openhab:status HouseEvent

This is working for me, but it prompts for a password, would you know if I can include the password in the above command or disable passwords altogether?

Use the public private key setup and you will not be asked for a password.

Thanks for this, got the public private key working with this link - Security of Karaf console - #9 by Benjy Took me a while :upside_down_face:

1 Like

All set-up now, text scrolling my house events from openHAB :grinning:

nano /etc/lcd4linux.conf

Widget OpenHAB1 {
  class 'Text'
  expression exec('ssh -p 8101 openhab@localhost openhab:status HouseEventHistory1', minute)
  width 20
  align 'M'
  speed 200
  update minute
}

Widget OpenHAB2 {
  class 'Text'
  expression exec('ssh -p 8101 openhab@localhost openhab:status HouseEventHistory2', minute)
  width 20
  align 'M'
  speed 200
  update minute
}

Widget OpenHAB3 {
  class 'Text'
  expression exec('ssh -p 8101 openhab@localhost openhab:status HouseEventHistory3', minute)
  width 20
  align 'M'
  speed 200
  update minute
}

Widget OpenHAB4 {
  class 'Text'
  expression exec('ssh -p 8101 openhab@localhost openhab:status HouseEventHistory4', minute)
  width 20
  align 'M'
  speed 200
  update minute
}

Layout Default {
    Row1 {
        Col1  'OpenHAB1'
    }
    Row2 {
        Col1  'OpenHAB2'
    }
    Row3 {
        Col1  'OpenHAB3'
    }
    Row4 {
        Col1  'OpenHAB4'
    }
}