Across Germany and other European countries waiting times at airports security check are increasing due to labor shortage.
I thought it’s time to add the airports waiting time into OpenHAB. Maybe others get inspired to do the same for their local airport, if they publish this information.
Hi Wolfgang,
thx a lot for your help and for the linux commands. I have to think about, how to get the results into OH. Maybe a little bash-Script, which brings them to OH via MQTT. Or via “Exec-Bindings”. But the Curl-Command(including “sed”) is quite fine.
depends on how / what you would like to do.
In case you would like to have the full history of data e.g. monitoring the value every n-minutes then you could use a linux cronjob that feed values via MQTT otherwise I would check ExecuteCommandLine and only if first two options do not fit then I would go for the Exex binding.
In case you need some kind of support please let me know.
Hi Wolfgang thx a lot for your help.
I first tried the exec-binding and as you predicted it was very problematic as I have to fight with the “correct syntax” and found no solution.
Th next try was a bash-script to use as a schedule(cron job). But the problem in this case is to bring the value to mosquitto(publish).
In case of a value like “5 Minuten” or only “5” (when tried to use a second ‘sed-command’) I get an error messsage from mosquitto:
hab4@raspi58:~ $ /usr/local/mqtt_rpi/mqtt_flight_waittimes.sh
5
geschlossen
'.ror: Unknown option '
Use 'mosquitto_pub --help' to see usage.
I set the second “sed-command” as I first thought that Mosquitto has a problem with the separted Characters “5 Minuten”. But it seems not to be the Problem…
When publishing “geschlossen”, everthing works fine.
Hi Holger,
thx for your solution.
My textual result of the thing looks like(as said, I’m a file-driven User “old-school” ):
Thing http:url:stutt "Stuttgart" [
baseURL="https://www.flughafen-stuttgart.de/ankunft-abflug/wartezeiten/", refresh=600] {
Channels:
Type string : WaitingTimeTerminal1 "Waiting Time Terminal 1"
Type string : WaitingTimeTerminal2 "Waiting Time Terminal 2"
Type string : WaitingTimeTerminal3 "Waiting Time Terminal 3"
}
I linked the Items via UI as you described, but I have to learn how to use them in a textual configuration , as this is my favorite setup, so be gracious with me for my ignorance of the “new ways to handle”
That’s it.
I have had a problem with the Regex-Declaration(Escaping the Back-Slash ) in my .items-File or alternatively in the .things-file, although it’s better to use the “items-profile-Solution” as one has to declare only one Channel in the Thing.
Type string : WaitingTimesRegex "Waiting Time Terminal 1" [ stateTransformation="REGEX:.*<tr>\\s*<td>Terminal 1<\\/td>\\s*<td>(.*?)</td>.*" ]
BTW: Do you have any idea, why I get an error in publishing a variable with two character strings like “5 Minutes” in my bash-Script above ?
The space makes it ( 5 Minutes ) two words. The first one is taken to be the message to be published. The second one ( Minutes ) is interpreted to be a parameter/argument for the mosquitto_pub command. As it is not a known parameter you get an error message.
The surrounding double quotes make the two words to be seen as one argument for the message to be published.