Can anyone please tell me if there is somewhere on the world wide web a tutorial about integration the OpenHAB with a TV through HDMI CEC?
I have googled and found a few but they are not so specific.
I have a Samsung TV (UE40H6400) and i want to make it start / stop using OpenHAB and because i understood that the model i have is not compatible with the OpenHAB Samsung .jar file (tested already) i would like to find another way to power on/off my TV.
I know that there are other ways to get this job done, like an IR transmitter / receiver using lirc here or the best way i think using the Logitech Harmony remote control but for the moment i understood the this can be possible using the HDMI cec.
Can anyoane please point me a step by step tutorial which will pass you through all the necessary steps?
Thanks in advance for any reply.
Thanks Eurico, I don’t have XBMC and I would prefer not use it, I just want a direct connection between my TV on a specific Chanel and the rpi through the cec option.
Thanks Marc, this is indeed a step by step tutorial but just for the rpi. Tomorrow I’ll follow all steps and fortunately I’ll not meet any error.
What about OH?
How do I set in item to trigger this echo command?
And how to turn the TV ON?
How to use exec binding ? What command I need?
I can’t follow the guide on rpi forum because something is wrong and I couldn’t find the answer in comments or other topics…
I’m stuck at this command: “sudo ./bootstrap” because “command not found”
Can anyone pls tell what should I do or where to find a good and updated tutorial?
Thanks man for your interest but unfortunately looks like all the planets aligned especially for me to fail
Every eg i try i fail to complete and now my RPI is full of wrong or no needed folders in different locations which i cant even delete them …
Using this command:
Last eg tried was the one on Github here and i get errors on the last 3 steps:
make -j4 sudo make install sudo ldconfig
What could possible go wrong during the installation? i can’t understand … i asked on the RPI forum but no answer! i know this should be easy even for a person like me who doesn’t have knowledge about Linux or so …
Can anyone who did this job recently, help with an advice?
I tried it some minutes ago with a new raspbian installation and it totaly worked for me.
I did all these steps below one by another. At the make -4j part there was a warning you can ignore.
Please note I’m using the latest raspbian (version 8). However I think it should work as well for you.
Can you please try again the steps and post the console output.
sudo apt-get update sudo apt-get install cmake liblockdev1-dev libudev-dev libxrandr-dev python-dev swig cd git clone https://github.com/Pulse-Eight/platform.git mkdir platform/build cd platform/build cmake .. make sudo make install cd git clone https://github.com/Pulse-Eight/libcec.git mkdir libcec/build cd libcec/build cmake -DRPI_INCLUDE_DIR=/opt/vc/include -DRPI_LIB_DIR=/opt/vc/lib .. make -j4 sudo make install sudo ldconfig
Perhaps a more elegant solution would be to attach a separate RPi to your TV and control that RPi from your openHAB server through MQTT over Ethernet or wifi (RPi 3). And let MQTT control CEC.
Hi @rtvb,
Why should that be easier?
You need to install libcec as well and in addition you would need a Mqtt client which then has to translate the mqtt message to libcec.
If the existing pi is near to the TV there is no reason to get a separate pi.
Easier in the sense of separating logic and more future proof. If for some reason you install openHAB on a different machine or platform the solution will continue to work. My headless openHAB server is in a closet and nowhere near a tv.
I agree that it is a little more complex to setup initially.
Hi @rtvb
I get your points and they are of course true. What kind of tool do you use for the mqtt to libcec handling?
However, I just wanted to point out that this is a more advanced and optional solution. We should not confuse @ewgor with that advanced stuff yet, as he seems to have troubles with libcec itself right now.
If that is then fixed this may be a solution for him as well. I don’t know his setup.
I do not use libcec myself, so I cannot tell you exactly how to build this, but this would be my approach:
use OpenHAB to send/post MQTT triggers to an MQTT server (assuming this is running on the OpenHAB Pi)
let the MQTT client on the Pi listen to the triggers and execute shell commands to perform the actions
the listener job would be an agent/service running permanently on your machine that executes a command for a specific MQTT message, for example if you post a message /tv/cec/off then execute libcec command to switch the tv off.
Thanks guys for answers but unfortunately for me i tried again for a few times and still not working so i decided to choose another way by using a Logitech Harmony remote but for this ill try to find some instruction on the forum or ask for help but in another topic!
Thanks again all for support.
D.
On a raspberry pi this little script might be useful:
tv.sh
#!/bin/bash
if [ "$1" = "OFF" ]; then
/opt/vc/bin/tvservice -o
elif [ "$1" = "ON" ]; then
/opt/vc/bin/tvservice -p
fi
It converts the OpenHAB switch state into a command for the tvservice utility.
Create a Switch and use it in a rule with executecommandline
ssh user@system ./tv.sh"+switch.state
The tv.sh needs to be placed in the home directory of user@system
also you need to enable ssh-login with a key (ssh-keygen & ssh-copy-id for the user which runs OpenHAB)