I am on OpenHAB 4.x (latest container) and I got the Exec binding working (via ssh). Even though I read somewhere that the exec binding won’t run in a container… But that’s not why I’m here…
Like I said I got it working. I have it controlling mpc on multiple raspberry pi’s via ssh (mpc is a command line mp3 player). I’ve even got it set to report status to the OpenHAB app and log by running mpc status. However, the status that the exec binding grabs is just the first line. See the example below.
mpc status on the command line:
This is a test.mp3
[playing] #1/1 0:13/0:42 (30%)
volume:100% repeat: on random: off single: off consume: off
What the log picks up
2025-03-06 15:28:08.944 [INFO ] [core.model.script.cmdMKUltraBRStatus] - Raw result: This is a test.mp3
[playing] #1/1 0:14/0:42 (33%)
volume:100% repeat: on random: off single: off consume: off
What the Sitemap picks up (or reports via Text item=cmdMKUltraBRStatus_Out):
cmdMKUltraBRStatus_Out
This is a test.mp3�[playing] #1/1 0:14/0:42 (33%)�volume:100%
My problem is the sitemap output. How can I get the output in multiline like what’s in the log?
It should not say that anywhere. It’s not that it won’t run. It’s that teh container is minimal. Often it doesn’t have stuff like python and other tools that one might want to use in the command.
Unless something has changed, you don’t. Sitemaps do not support multi-line text. You’ll have to parse out that string and use that to update multiple Items if you want the text on separate lines.
Sitemaps are very basic and the layout is pretty much fixed. Each cell is a fixed size and you can have two or three columns. But that’s about all the control you get.
If you need something more flexible you need to look at MainUI or HABPanel.
But again, there have been lots of changes made to sitemaps over the past couple of years so there might be features or settings that haven’t made it into the docs. But based on how they used to work and the current docs, you can’t get there from here using sitemaps.
I know this is now off topic, but is the MainUI or HABPanel configurable via text files (I store my config files in a repo for backup purposes and use a pipeline to update the container.)
And is there tutorial to convert sitemaps to MainUI or HABPanel?
I will say though that even if it’s not separate files in the conf folder, all OH configs are plain text. They are just in a different format stored in a different location (userdata/jsondb).
Some aspects of MainUI can be confuigured through metadata on individual Items, but custom UI widgets, pages, and the like are only read from the JSONDB.
Just a quick update:… I kinda got a work around going… I use RegEx to parse the 3 line output into a single line by removing \n… I then pass the string to a var (and Regex the \n back in) and send it to a Telegram bot… Looks beautiful!
That way I get my single line for the sitemap, (even though it’s truncated) and I get all the string in my Telegram! (since I have it configured on my watch sitemap and receive Telegrams on my watch)