emonPi LCD V3.0 Update: SSH toggle, Shutdown, Config & CPU reduction

Following on from the emonPi SSH disabled by default thread, thanks a lot for everyone who contributed.

With significant contribution from @alandpearson we have now implemented an update (V3.0.1) to the emonPi LCD service. The update will make it easy to toggle SSH (enable/disable) as required on all emonPi’s. The main features of the update are:

  • Add toggle SSH features to the LCD
  • Add shutdown feature to the LCD (shutdown button still works the same)
  • Add config file for customizing the LCD service e.g. enable custom MQTT data to be displayed
  • Refactor Redis polling: reduce Pi CPU usage 30%-40%

Here is a video overview of the new update in action:

The update has been merged into master branch and is available to all emonPi users via emonPi update.

This update will be very useful for existing emonPi users to easily disable SSH if it’s not required.

Advance users can now easily customize features such as backlight timeout, default screen and display custom MQTT feed data. Here is the default LCD config file :

uselogfile = True

# LCD backlight timeout in seconds 0: always on, 300: off after 5 min
# as the emonpi could be installed in a dark place, keep the backlight on, eh ?
backlight_timeout = 0

#How often the LCD is updated when a button is not pressed
lcd_update_sec = 30 

# which page to show after startup (3 is pv/utility readings which should be useful)
default_page = 0
#Names for the power feeds displayed on the LCD
feed1_name = Power1
feed2_name = Power2
feed1_unit = W
feed2_unit = W

mqtt_user = emonpi
mqtt_passwd = emonpimqtt2016
mqtt_host =
mqtt_port = 1883
mqtt_emonpi_topic = emonhub/rx/5/values
mqtt_feed1_topic = emon/emonpi/power1
mqtt_feed2_topic = emon/emonpi/power2

redis_host = localhost
redis_port = 6379

hilink_device_ip =

To view the emonPiLCD script version see the log file:

$ cat /var/log/emonpilcd/emonpilcd.log


2018-12-12 14:34:57,532 INFO Starting emonPiLCD V3.0.1
2018-12-12 14:34:57,618 INFO I2C LCD DETECTED 0x27
2018-12-12 14:34:58,062 INFO SD card image build version: emonSD-30Oct18
2018-12-12 14:34:58,063 INFO Attaching push button interrupt...
2018-12-12 14:34:58,076 INFO Attaching shutdown button interrupt...
2018-12-12 14:34:58,084 INFO Connecting to redis server...
2018-12-12 14:34:58,088 INFO Connected to redis
2018-12-12 14:34:58,089 INFO Connecting to MQTT Server: on port: 1883 with user: emonpi
2018-12-12 14:34:58,094 INFO Connected to MQTT
2018-12-12 14:35:34,203 INFO Mode button SHORT press
2018-12-12 14:35:34,204 INFO Page: 0

Big thanks to @alandpearson for this update :+1:
Here is the original PR:

Great to see this finally added, it’s logical to both enable + disable SSH from the interface.


1 Like

I tried to use the backlight_timeout feature (the emonpi is in my kitchen so I don’t want it on all the time) but it has clearly not been tested with non-zero values.

File "./emonPiLCD.py", line 543, in main
    if (backlight_timeout) and now - buttonPress_time > backlight_timeout and lcd.backlight:
NameError: global name 'now' is not defined

Got it working by adding a global declaration of “now”.

Thanks, good spot. This must have got missed out during the refactor

I had to add now = now.time() to setup the backlight timer:

Change has been committed to master (V3.0.1)

Really glad to see this in the wild.
Good spot on the timeout issue on the display.

I’ll keep an eye here for any further issues that may arise.

Thanks Glyn for the cool video showing it in action.

1 Like

2 posts were split to a new topic: Force the Emonpi to AP-mode

6 posts were split to a new topic: Problems with GPIO push button on self build emonPi