Raspi 7" touch display as openHAB GUI // How-to

raspberry
python
gui
Tags: #<Tag:0x00007f015177d018> #<Tag:0x00007f015177ce60> #<Tag:0x00007f015177cc58>

(Michael Heckmann) #1

Hi community,

I recently bouhgt a rapsi 7" touch display and want to let you know how I transformed it into a openHAB client for the “living” room.

My hardware:

  • Install Raspbian wheezy
  • Set it up so the GUI comes up after booting
  • Sometimes the screen and touch control get’s mixed up, so you have to change the following
    in /boot/config.txt:
    sudo nano /boot/config.txt lcd_rotate=2
  • Start the epiphany browser so it automtically sets up its profile
    *Switch off the screensaver and let the browser start automatically with the openHAB URL:
    sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
    add:
    @xset s off @xset -dpms @xset s noblank @epiphany-browser -a --profile ~/.config http://UrlToOpenhab/openhab.app?sitemap=xxx

then do a:
sudo reboot

and your openhab should come up automatically
That’s it.

What I did additionally to improve the WAF (previously there was a clock where the pi now is placed)
Modified a python script I found on the web to show the current time:
If I touch the clock it disappears and comes up after 30 seconds:

download here:
https://drive.google.com/file/d/0BzRabLA27s-9VkRBckM1YXR4dkk/view?usp=sharing

Also dont’ forget to add it to autostart (see above):
@/usr/bin/python /home/pi/tk_clock101.py

Regards,
Michael


(jvanzuijlen) #2

Python with no indentation posted; always a challenge :wink:


(Michael Heckmann) #3

Thanks @jvanzuijlen: you’re right. I changed it and will post the file elsewhere


(jvanzuijlen) #4

Thanks @Mitch77 !


(Jason Brunk) #5

do you have any pics of this in action? I would be REALLY interested in seeing this. This sounds like a great option for me.


(Michael Heckmann) #6

Hi Jason, see here the final result :smile:
Anymore specific pictures?
BR, Michael


(Schrumm Schrumm) #7

Really Nice! Thanks for sharing.
I was thinking to use an old kindle for this. The E-Ink display is perfect for status information like temperature, etc.


(Steve D) #8

If you’re just displaying the Openhab pages in the browser, it’s worth switching it to full-screen (“kiosk”) mode to gain a bit more display space.
Unfortunately its a little more involved than another command line option (as far as I could find).
There are instructions here, among other places
I’ve actually commented out the lines beginning ‘xset’, since I wanted the screen to blank after a while


(Thomas) #9

Hi Michael,

how did you change the script that the temperature and the lights are shown in the top? Can you share it?


(Michael Heckmann) #10

Hi Thomas.

the temperature comes directly from my MQTT server, the “sum of lights on” from openhab via REST. Those are put into different “containers”.

Please find the modified script here:
homeinfo.py

I’m not really familiar with Python so putting this together was kind of copy&paste, try&error. Python gurus please bear with me. :pensive:

Regards,
Michael


(schlaubi) #11

Hi Michael,
thanks for sharing with us :slight_smile:
I like to have a display for the living room too.

So i think about different solutions:

  • arduino with a e-ink display
  • raspberry with a touch display
  • android tablet

My requirements are:
-low energy

  • shutdown the display on the night.

The problem with the pi ist, that it has no wakeonlan. So at the evening i can shutdown, but in the morning no reboot :frowning:
But it is possible the shutdown only the display.

Do you know the wattage? (Off and On)
And do you have the display on the whole day?

Thanks


(Jeffrey Ollie) #12

@schlaubi A 5V 2.5A power supply (which is what’s recommended for use with the display) can put out at most 12.5W of power, so it’s probably going to draw a little more than that at peak usage since power supplies aren’t 100% efficient. And that’s the maximum, typical usage is going to be much less.

As far as blanking the screen at night there are many ways to handle that. The backlight can be turned on/off from software so you could use a button, a PIR motion detector, link into the astro binding in openHAB etc - the possibilities are endless.

https://www.raspberrypi.org/forums/viewtopic.php?f=108&t=125372

The main downside of the RPi screen that I’ve found so far is that I haven’t found a good on-screen keyboard, so you’d need to keep a keyboard handy for anything that required more than point-and-click.


(Bogumil J.) #13

@schlaubi You can workaround WOL by switching off/on power source of RPi with some remote controlled power plug or relay.

Also please note: http://www.androidheadlines.com/2016/05/google-add-raspberry-pi-3-android-open-source-project.html


(Michael Heckmann) #14

yes, as it’s nicely showing temperature outside and a clock.

Agree. That’s what I would recommend, too for a RPi.


(Mark Stamp) #15

Thanks! I will be doing this as soon as I get OpenHAB up and running!


(Alfred) #16

I have installed the epiphany browser. But allways when I try to start the browser i get the message

Unable to init server: Could not connect: Connection refused Failed to parse arguments: Cannot open display:

Do you know where the probleme is?

I use openhab2.3 and the raspberryPI Touchscreen. My goal ist to use the openhab panel on touch screen.

Alfred