Self made wall touch panel project

I’m using this project here to do it: GitHub - jpmens/mqtt-launcher: Execute shell commands triggered by published MQTT messages
With this I can subscribe to MQTT events on my RPi and trigger some scripts.
E.g. my config looks like this:

mqtt_broker = 'x.x.x.x'         # default: 'localhost'
mqtt_port = 1883                # default: 1883
mqtt_clientid = 'mqtt-wallpanel'
mqtt_username = ''
mqtt_password = ''

topiclist = {

    # topic                     payload value       program & arguments
    "wallpanel/monitor"          :   {
                                'off'        :   [ 'vcgencmd display_power 0' ],
                                'on'         :   [ 'vcgencmd display_power 1' ]
                            },
    "wallpanel/system"          :   {
                                'reboot'     :   [ 'sudo reboot' ],
                            },
}

WIthin openhab I send the correct MQTT messages to my broker either via switch or e.g. via my motion detector. Depending on your system you may need to use a different command to turn on/off the screen (e.g. tvservice).

I’m not sure if RPi 4 has already WoL. The RPi 3 doesn’t so I have no way to put it to sleep and wake it up via a trigger (switch/motion detector). Except of course you can control the power supply or power outlet. For me this is not big issue since the power consumption of the PI is very low and I turn off the monitor anyway.

In my system I react on different events from openHab published on the Event Bus. Not sure if this is the most elegant solution but it works. Depending on those events, I trigger different states on my application (e.g. switch the view).

Thank you very much for the great, fast and detailed response Wolfgang! I will directly start to implement it.
WoL in not implemented in the RPi4. There is an hardware extension for RPI available but as you mentioned the power consumption is not a big deal.

Hello,

I was fighting the whole weekend with the mqtt-launcher.

The mqtt broker themself seems to be ok:

**●**  mosquitto.service - Mosquitto MQTT v3.1/v3.1.1 Broker

 Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)

 Active:  **active (running)**  since Sat 2020-07-25 23:32:11 CEST; 18h ago

 Docs: man:mosquitto.conf(5)

 man:mosquitto(8)

 Main PID: 588 (mosquitto)

 Tasks: 1 (limit: 3862)

 CGroup: /system.slice/mosquitto.service

 └─588 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

Jul 25 23:32:11 fullpageos systemd[1]: Starting Mosquitto MQTT v3.1/v3.1.1 Broker...

Jul 25 23:32:11 fullpageos systemd[1]: Started Mosquitto MQTT v3.1/v3.1.1 Broker.

the „launcher.conf“ I copied in basic folder (not in root):

**pi@fullpageos** : **~ $**  ls

**Downloads**   launcher.conf  mosquitto-repo.gpg.key  mqtt_test.py   **scripts**

and looks like:

mqtt_broker = '192.168.xxx.xx'         # here I put IP of my Rasp (FullscreenOS)
mqtt_port = 1883                       # default: 1883
mqtt_clientid = 'mqtt-wallpanel'
mqtt_username = 'pi'                   # here I put user („pi“) of my Rasp (FullscreenOS)
mqtt_password = 'xxx'                  # here I put user pw of my Rasp (FullscreenOS)

topiclist = {

    # topic                     payload value       program & arguments
    "wallpanel/monitor"          :   {
                                'off'        :   [ 'vcgencmd display_power 0' ],
                                'on'         :   [ 'vcgencmd display_power 1' ]
                            },
    "wallpanel/system"          :   {
                                'reboot'     :   [ 'sudo reboot' ],
                            },
}

The mqtt command I sent in MQTT.fx application was "cmd/wallpanel/monitor“ and „on“ /„off“ => THIS DOES NOT WORK SO FAR!

I guess it is a simple beginner failure…hope you can help…

Finally the OH settings:

The broker with the following Thing in OH is online:

Bridge mqtt:broker:FullscreenOS "MQTT Broker FullscreenOS" @ "MQTT FullscreenOS" [ 
  host="192.168.xxx.xx",
  port=1883,
  secure="AUTO",
  qos=0,
  retain=false,
  clientid="mqtt-wallpanel",
  keep_alive_time=30000,
  reconnect_time=60000,
  username="pi",
  password="xxx"
]

Do your files really have the lower speech marks: „ and ‚ ? I’ve never seen these used before - perhaps they are the issue? Try changing them to " and ’

Didn’t see your mqtt broker config, but as for me, I’m using the eclipse-mosquitto docker image for my broker. There I don’t provide a user/pwd because everything is running in my local network on a separete LAN anyway. Maybe that’s the issue already, because you write you are provding the user/pwd of the Pi? The broker user/pwd does not necessarily be the same as the Pi user (depends on your config).

For testing I’m using this http://workswithweb.com/mqttbox.html here to connect and send/receive messages. Works quite well. You will see there immediately if you have e.g. a connection issue or something else. Just create a MQTT client, enter your settings and connect. If it is connected you can try out to send messages to your fullscreen OS without openHAB to test that direction first.

Thank you for the quick response. You are right! The speeck marks in my original code is ok (as you mentioned). It was a “copy-past” error from my side when I prepared this post in my mail program and past it here. I corrected my post.

Thank you for the quick response. I will try today.

…the mqtt is now running on mqttbox. => all checks are green!

What is the payload/command? “cmd/wallpanel/monitor”? How can I send the on/off command?

…I am really lost with mqtt-launcher:

the logfile shows:

2020-08-06 00:31:16,615 Starting
2020-08-06 00:31:16,616 DEBUG MODE
2020-08-06 00:31:16,618 Connected to MQTT broker, subscribing to topics…
2020-08-06 00:31:16,619 wallpanel/monitor 0 off
2020-08-06 00:31:16,620 Running t=wallpanel/monitor: [‘vcgencmd display_power 0’]
2020-08-06 00:31:29,838 wallpanel/monitor 0 off
2020-08-06 00:31:29,839 Running t=wallpanel/monitor: [‘vcgencmd display_power 0’]
2020-08-06 00:31:39,962 wallpanel/monitor 0 on
2020-08-06 00:31:39,963 Running t=wallpanel/monitor: [‘vcgencmd display_power 1’]
2020-08-06 00:31:48,560 wallpanel/monitor 0 off
2020-08-06 00:31:48,561 Running t=wallpanel/monitor: [‘vcgencmd display_power 0’]

when I put in the “off” / “on” command in MQTT-Box after running “mqtt-launcher.py” manually (in Terminal). That indicate for me, that mqtt-lancher is running!? The monitor does not react :frowning:
When I put in the “vcgencmd display_power 0/1” command directly (in Terminal)…the monitor switched OFF/ON.

Some ideas/hints what is wrong?

It’s the same as this original post maker touchscreen. :smiley:

Hi, are you doing this with a relay or does the FullPageOS allow for control using MQTT?

It is internal of android but…
I’ve had hook and old android box to a HDMI touch panel and the android box Android is not able to shut DowN display by an MQTT order…

Maybe my android version is too old to have this right or it can’t drive the HDMI box components…

I described my way a few posts up: Self made wall touch panel project - #41 by sheppard
Basically I run a MQTT service on my FullPageOS (it’s just Linux under the hood) and subscribe to specific events. Those are triggering some scripts or linux commands.

Hi @sheppard

Great project.

I have similar project, however I am still searching a way to configure wifi over UI without needing to use the text file in order to change the wifi credentials. Do you have a suggestions ?

Best regards

Medo

No sorry, I always do that in the text file.

1 Like

Thank you for your prompt reply

You can always hash the password in the /etc/network/interfaces This will prevent others from seeing your wifi password.

Check out this article:
networking - How to encrypt/hide password in /etc/network/interfaces file on debian? - Unix & Linux Stack Exchange