Samples Binding Config: How to get power on a TV connected to HDMI with exec binding and update the status automatically

Hello,

i try to follow the sample how-to-get-power-on-a-tv-connected-to-hdmi-with-exec-binding-and-update-the-status-automatically from the github website Samples Binding Config.

https://github.com/openhab/openhab/wiki/Samples-Binding-Config#how-to-get-power-on-a-tv-connected-to-hdmi-with-exec-binding-and-update-the-status-automatically

I created the shell-script script /usr/local/bin/samsungTvCheck.sh.

Now I have to change [OPENHAB_URL], [OPENHAB_USER], [OPENHAB_PASS], [OPENHAB_ITEM] according to myinstallation.

#!/bin/bash
OH_URL=[OPENHAB_URL]
OH_USER=[OPENHAB_USER]
OH_PASS=[OPENHAB_PASS]
OH_ITEM=[OPENHAB_ITEM]

My problem is:

[OPENHAB_URL] = I don’t know what to write in here. I installed openhab with apt-get on a Raspberry Pi.
[OPENHAB_USER] = I think the user is openhab by default. (apt-get installation).
[OPENHAB_PASS] = I don’t know what to write in here.I didn’t give a password to the user openhab.
[OPENHAB_ITEM] = My item is wohnen_tvonoff

At the moment it looks like this:

 #!/bin/bash
 OH_URL=[OPENHAB_URL]
 OH_USER=openhab
 OH_PASS=[OPENHAB_PASS]
 OH_ITEM=wohnen_tvonoff

Can anybody tell me the missing openhab_url and openhab_pass? Thanks!

That script is assuming OH 1 with security configured. It will not work as written of OH 2.

I think you can make it work pretty easily though.

OH_URL=http://<ip address of openhab>:8080
This is the same thing you would enter into your browser to bring up your launch page.

Remove USER and PASS as OH 2 does not yet support user authentication.

In the script, remove the --user $OH_USER:$OH_PASS part of the curl commands.

Oh…, sorry. I didn’t write that I use oh 1.8.3. Do you know which password I should use with oh1?

By the way. I’m thinking about using oh2, because I can’t get razberry and oh1 running together. (see my other topic)
But that’s another story.

What ever you set up in your users.cfg file. If you are running with security=EXTERNAL or security=OFF then you don’t need a username or password and can remove them as described above.

Thank you, for taking me one step closer to my goal.
But, sorry, another (maybe) stupid question.

In the example, they say:
and you can add a line to your cron (in linux systems)

crontab -e
*/1 * * * * /usr/local/bin/samsungTvCheck.sh

Where do I find this cron?

Ok, shame on me.
It’s just a command that I have to type in the putty-console. (Like they say in the example.)

This link has been helpful to me: https://wiki.ubuntuusers.de/Cron/

@rlkoshak: Thank you, spending your time with newbies like me.