• machinon videos
  • Twitt machinon
  • Like machinon
  • GitHub machinon

Keep up to date with machinon

© 2019 by machinon

  • Eddie

How to use the LCD Display

The machinon has a built-in Graphics LCD, what for? Good question, keep reading...


When I was designing the specifications of machinon nearly 2 years ago, I was not really sure if an a display screen should be used, in fact the first few devices had your usual green boring screens (no graphics, no back light). Every single logic was telling me, this is going to be installed inside a box or somewhere now one is going to look at it.... and nearly two years later the display still there. - What just happened!!??


In day time I work on B2B systems, and often I find that during installation of typical PLCs, data loggers, etc... there's a bit of lack of information of how things are going. This got me thinking, ok having the display will make more expensive the total cost of the device, but if it can save hours of work or setup, then is well worth it. - I guess I'm one of those guys that values time above everything else.

In the last few weeks I have been connecting a lot of machinons and having that IP displayed there has been very convenient, then I added CPU Load and CPU temperature, even some logs of activity of what's happening, not always I have a phone or Internet access.


So how do you use the display?

In Domoticz is pretty simple using DzVents, here are the steps:


1.- Make sure to add the Text line of the display to your device library (in Domoticz, Settings -> Devices). Mine is called: 'LCD Line 3'

2.- Add this bash script 'get-ip.sh' to your 'scripts' folder inside Domoticz

3.- Add this DzVents (Lua) script into your events:


--[[

Domoticz dzVents Lua script for Machinon


Displays the device's Ethernet IP (either DHCP or static) on Machinon LCD using a shell script to get the local IP (or "unknown" if disconnected)


Change the "LCD Line 3" device name and the path to the script to suit your Machinon setup.


]]


return {

-- trigger

-- can be a combination:

on = {


-- timer riggers

timer = {

-- timer triggers.. if one matches with the current time then the script is executed

-- 1 minute is shortest interval and also the timer granularity???

'every 1 minutes'

}

},


-- custom logging level for this script

logging = {

level = domoticz.LOG_DEBUG,

marker = "show-ip script"

},


execute = function(domoticz)

--domoticz.log('Running show-ip script...', domoticz.LOG_INFO)


local cmd = "/opt/machinon/scripts/get-ip.sh"

local f = assert(io.popen(cmd, 'r'))

local s = assert(f:read('*a'))

f:close()

-- strip out any /r/n etc

s = string.gsub(s, '^%s+', '')

s = string.gsub(s, '%s+$', '')

s = string.gsub(s, '[\n\r]+', '')

if s == '' then

s = 'unknown'

end

--domoticz.log('Got IP = "' .. s .. '"', domoticz.LOG_INFO)


domoticz.devices('LCD Line 3').updateText('IP=' .. s)

end

}


4.- That is it, now every minute the IP of the device will displayed on the screen.


The same can be do with any other bit of information. Hopefully soon I'll be explaining how to push graphics to the LCD, this can be very handy for Renewable Energy monitoring like PV, Biomass or even just seeing what is going on Heating system.