Jump to content

Soft Keypadlinc-like Console from Raspberry Pi


kck

Recommended Posts

Posted

Just an FYI for anyone building one of these:  I updated the 3D design files on Thingiverse (https://www.thingiverse.com/thing:1652666) to include a V5 version that incorporates the great ideas Emile provided about to do a much better bezel and to use inserts for the screws that secure the case and the Pi and screen.  Overall these changes make the case look better and make it easier to assemble.

  • 3 months later...
Posted

Kevin,

 

I hope you are still monitoring this thread. I gave up trying to get the console loaded and running. I recently came back and trying again. I can not get the piprepadafruit.sh to create the directories required. It appears to run properly but still no directories. What am I doing wrong? Can you help please?

 

Regards,

Aaron

Posted

Yup -still here.  I haven't done a complete clean install in quite a while so I should probably try one to see if anything has "rusted" over time in the scripts.  Meanwhile - can you send the log files from the install.  Also - which directories aren't getting created?  The consolestable and Console ones?  I'll take a look later this afternoon and see what I can tell you.

 

Kevin

P.S.  Just as an FYI my consoles seem to run completely stable these days.  I only see a reboot when my home router gets sick, which it seems to do periodically with the result that all the home comms go out for a while.  Even then, though, the consoles reboot and reconnect when the router recovers.

Posted

I can only find one log file it is called prep.log. It only states that Pi setup script started. When I run earlyprep.sh script it does create the piprepadafruit.sh file. But when I run the piprepadafruit.sh script it does not create the consolestable and Console directories or create any other files..

 

Thanks,

Aaron

Posted

Hmm.  Looks like some major instruction changes I made earlier in the year while was working from a different development system didn't propogate through github into the current stuff.  Let me sort that out and tell you what to do.  I think the new scripts are there and it is just the instructions that are wrong but I don't want to waste your time if something else also didn't propogate correctly.  

Posted

OK - I recreated the lost changes to the docs and the install scripts and installed it successfully on the latest version of Raspbian (Stretch) from the Raspbian site.  It should also work on Jessie but I haven't tried that.  Tomorrow I will try to do one more completely clean install using the current scripts and directions just to make sure that I didn't assume anything when I did it just now.  However, I am pretty sure that what is out there will work ok if you want to go ahead and use it.  As I warn in the notes there are some long waits for some of the scripts to do their work.  I did see one place where for some reason a script (not mine) that I call needed an extra carriage return.  If the system seems to hang with a message saying that Bluetooth support has been installed in a message ending with "++++" wait a bit but if nothing seems to be happening hit return .  You should then see another question about enabling BT.  The hang I think I saw doesn't seen to exist in the script so it may just have been something I did accidently while running it.

 

Kevin

Posted

kevin,

 

Thank you for the updated instructions. Progress is being made. I can now run the console.py file. When I do I get a red screen saying no configuration file. I copied your config files to consolestable folder hoping I would get different results but still get the red screen. Looking at the examples you have provide I now have another hurtle to get over, setting up my own config files. I figured out the auth.py file adding my isy info. Just not sure which folder it goes in.

 

Thanks for the quick responses and the updates. Any other help will be greatly appreciated.

 

Aaron

Posted

There was on small error in the pisetup that might have an impact.  The last command in the script sets the calibration for the Adafruit screen and it was missing the parameter that sets the type of screen.  If you grabbed things before I got that fixed then the symptom you'd see is that the buttons don't react corresponding to where you touch the screen.  Fix is easy - just rerun that command with an extra parameter -t <screentype> where screentype is 35r, 28r, or 28c depending upon which screen you have.  It should look like:

./adafruit-pitft-touch-cal -f -r 0 -t 35r 

if you have the 3.5" for example.  Run it as root.

 

As to setting up your own screens, the default location for the config.txt file is the Console directory not the consolestable.  Basically you should never need to manually touch consolestable - that's just the code.  The default location for the include library files is Console/cfglib.  All these locations are settable but why make life harder.  So you should put at least a minimal config.txt file in Console and if you want any includes put those in cfglib.  I suggest that you start by taking one simple room with a couple of lights and build a screen for that.  If you just want to try things out even before that, define only a clock screen in you configs and you should just get that with now interaction beyond authorization with your ISY.

 

Let me know if you have questions and I'll try to help.

 

Kevin

Posted

There was on small error in the pisetup that might have an impact.  The last command in the script sets the calibration for the Adafruit screen and it was missing the parameter that sets the type of screen.  If you grabbed things before I got that fixed then the symptom you'd see is that the buttons don't react corresponding to where you touch the screen.  Fix is easy - just rerun that command with an extra parameter -t <screentype> where screentype is 35r, 28r, or 28c depending upon which screen you have.  It should look like:

./adafruit-pitft-touch-cal -f -r 0 -t 35r 

if you have the 3.5" for example.  Run it as root.

 

As to setting up your own screens, the default location for the config.txt file is the Console directory not the consolestable.  Basically you should never need to manually touch consolestable - that's just the code.  The default location for the include library files is Console/cfglib.  All these locations are settable but why make life harder.  So you should put at least a minimal config.txt file in Console and if you want any includes put those in cfglib.  I suggest that you start by taking one simple room with a couple of lights and build a screen for that.  If you just want to try things out even before that, define only a clock screen in you configs and you should just get that with now interaction beyond authorization with your ISY.

 

Let me know if you have questions and I'll try to help.

 

Kevin

Kevin,

 

I've been making progress, but still have some issues. When I start the console it apprears to load and displays booting information on the screen but then stops. Here is the console log that shows some errors. Can you please take a look at it and see what I'm doing wrong? I can not attach the file so I will just paste it here.

 

09-01-17 10:18:54 Sev: 3 Soft ISY Console

09-01-17 10:18:54 Sev: 3   \xa9 Kevin Kahn 2016

09-01-17 10:18:54 Sev: 3 Software under Apache 2.0 License

09-01-17 10:18:54 Sev: 3 Version Information:

09-01-17 10:18:54 Sev: 3  Run from: /home/pi/consolestable

09-01-17 10:18:54 Sev: 3  Last mod: /home/pi/consolestable/exitutils.py

09-01-17 10:18:54 Sev: 3  Mod at: Wed Aug 30 09:54:44 2017

09-01-17 10:18:54 Sev: 3  Tag: development

09-01-17 10:18:54 Sev: 3  Sha: not auto installed

09-01-17 10:18:54 Sev: 3  How: *nodate*

09-01-17 10:18:54 Sev: 3  Version date: *nodate*

09-01-17 10:18:54 Sev: 3 Start time: Fri Sep  1 10:18:54 2017

09-01-17 10:18:54 Sev: 3 Console Starting  pid: 1538

09-01-17 10:18:54 Sev: 3 Main config file: /home/pi/Console/config.txt Wed Aug 30 09:54:44 2017

09-01-17 10:18:54 Sev: 3 Including config files:

09-01-17 10:18:54 Sev: 3   +auth.cfg Fri Sep  1 10:09:10 2017

09-01-17 10:18:54 Sev: 3   +pdxalerts.cfg Wed Aug 30 09:54:44 2017

09-01-17 10:18:54 Sev: 3   +tstat.cfg Wed Aug 30 09:54:44 2017

09-01-17 10:18:54 Sev: 3   +weathPump.cfg Wed Aug 30 09:54:44 2017

09-01-17 10:18:55 Sev: 3   +weathCC.cfg Wed Aug 30 09:54:44 2017

09-01-17 10:18:55 Sev: 3   +weathPDX.cfg Wed Aug 30 09:54:44 2017

09-01-17 10:18:56 Sev: 3   +myclock.cfg Wed Aug 30 09:54:44 2017

09-01-17 10:18:56 Sev: 3   +BR-kck.cfg Wed Aug 30 09:54:44 2017

09-01-17 10:18:56 Sev: 3   +upperlev.cfg Wed Aug 30 09:54:44 2017

09-01-17 10:18:56 Sev: 3   +bathroom.cfg Wed Aug 30 09:54:44 2017

09-01-17 10:18:56 Sev: 3   +LR.cfg Wed Aug 30 09:54:44 2017

09-01-17 10:18:56 Sev: 3   +othermain.cfg Wed Aug 30 09:54:44 2017

09-01-17 10:18:56 Sev: 3   +downstairs.cfg Wed Aug 30 09:54:44 2017

09-01-17 10:18:56 Sev: 3   +weathLQ.cfg Wed Aug 30 09:54:44 2017

09-01-17 10:18:56 Sev: 3   +timetempLQ.cfg Wed Aug 30 09:54:44 2017

09-01-17 10:18:56 Sev: 3 Log level: 3

09-01-17 10:18:56 Sev: 3 Screensize: 320 x 480

09-01-17 10:18:56 Sev: 3 Scaling ratio: 1.00:1.00

09-01-17 10:18:56 Sev: 3 Param: KeyOutlineOffset: 3

09-01-17 10:18:56 Sev: 3 Param: KeyColor: aqua

09-01-17 10:18:56 Sev: 3 Param: CmdCharCol: white

09-01-17 10:18:56 Sev: 3 Param: MaxLogFiles: 5

09-01-17 10:18:56 Sev: 3 Param: CmdKeyCol: red

09-01-17 10:18:57 Sev: 3 Param: DimHomeScreenCoverName:

09-01-17 10:18:57 Sev: 3 Param: DimIdleListTimes: ['20', '20']

09-01-17 10:18:57 Sev: 3 Param: KeyCharColorOff: black

09-01-17 10:18:57 Sev: 3 Param: BrightLevel: 100

09-01-17 10:18:57 Sev: 3 Param: KeyColorOn:

09-01-17 10:18:58 Sev: 3 Param: KeyLabelOff: ['']

09-01-17 10:18:58 Sev: 3 Param: MultiTapTime: 400

09-01-17 10:18:58 Sev: 3 Param: KeyOnOutlineColor: white

09-01-17 10:18:58 Sev: 3 Param: DimLevel: 5

09-01-17 10:18:58 Sev: 3 Param: KeyColorOff:

09-01-17 10:18:58 Sev: 3 Param: KeyLabelOn: ['']

09-01-17 10:18:58 Sev: 3 Param: HomeScreenName: BR

09-01-17 10:18:58 Sev: 3 Param: KeyOffOutlineColor: black

09-01-17 10:18:58 Sev: 3 Param: ISYaddr: 192.168.0.18

09-01-17 10:18:58 Sev: 3 Param: BackgroundColor: maroon

09-01-17 10:18:58 Sev: 3 Param: DimIdleListNames: ['MyClock', 'LQTT']

09-01-17 10:18:58 Sev: 3 Param: PersistTO: 20

09-01-17 10:18:59 Sev: 3 Param: KeyCharColorOn: white

09-01-17 10:18:59 Sev: 3 Param: LogFontSize: 23

09-01-17 10:18:59 Sev: 3 Param: HomeScreenTO: 90

09-01-17 10:18:59 Sev: 3 Param: ISYuser: admin

09-01-17 10:18:59 Sev: 3 Param: CharColor: white

09-01-17 10:18:59 Sev: 3 Param: DimTO: 25

09-01-17 10:18:59 Sev: 3 Successful node read: 200

09-01-17 10:19:00 Sev: 4 Scene with no membersAuto DR

09-01-17 10:19:01 Sev: 3 Successful programs read: 200

09-01-17 10:19:01 Sev: 3 Successful variable read: 200/200

<type 'exceptions.KeyError'>

Python 2.7.13: /usr/bin/python

Fri Sep  1 10:19:02 2017

A problem occurred in a Python script.  Here is the sequence of

function calls leading up to the error, in the order they occurred.

 /home/pi/consolestable/console.py in <module>()

  176 config.ISYrequestsession.auth = (config.ISYuser, config.ISYpassword)

  177

  178 config.ISY = isy.ISY(config.ISYrequestsession)

  179 config.Logs.Log("Enumerated ISY Structure")

  180

config = <module 'config' from '/home/pi/consolestable/config.pyc'>

config.ISY = None

isy = <module 'isy' from '/home/pi/consolestable/isy.pyc'>

isy.ISY = <class 'isy.ISY'>

config.ISYrequestsession = <requests.sessions.Session object>

 /home/pi/consolestable/isy.py in __init__(self=<isy.ISY object>, ISYsession=<requests.sessions.Session object>)

  424    self.varsState[v['@name']] = int(v['@id'])

  425    self.varsStateInv[int(v['@id'])] = v['@name']

  426   configdict = xmltodict.parse(r2.text)['CList']['e']

  427   for v in configdict:

  428    self.varsInt[v['@name']] = int(v['@id'])

configdict = [OrderedDict([(u'@id', u'1'), (u'@name', u'sLeakBasement')]), OrderedDict([(u'@id', u'2'), (u'@name', u'iStartup')]), OrderedDict([(u'@id', u'3'), (u'@name', u'Front_Door_Batt')]), OrderedDict([(u'@id', u'4'), (u'@name', u'Garage_Door')]), OrderedDict([(u'@id', u'5'), (u'@name', u'Front_Door_Lock')])]

global xmltodict = <module 'xmltodict' from '/usr/local/lib/python2.7/dist-packages/xmltodict.pyc'>

xmltodict.parse = <function parse>

r2 = <Response [200]>

r2.text = u'<CList type="VAR_INT"></CList>'

<type 'exceptions.KeyError'>: 'e'

    __class__ = <type 'exceptions.KeyError'>

    __delattr__ = <method-wrapper '__delattr__' of exceptions.KeyError object>

    __dict__ = {}

    __doc__ = 'Mapping key not found.'

    __format__ = <built-in method __format__ of exceptions.KeyError object>

    __getattribute__ = <method-wrapper '__getattribute__' of exceptions.KeyError object>

    __getitem__ = <method-wrapper '__getitem__' of exceptions.KeyError object>

    __getslice__ = <method-wrapper '__getslice__' of exceptions.KeyError object>

    __hash__ = <method-wrapper '__hash__' of exceptions.KeyError object>

    __init__ = <method-wrapper '__init__' of exceptions.KeyError object>

    __new__ = <built-in method __new__ of type object>

    __reduce__ = <built-in method __reduce__ of exceptions.KeyError object>

    __reduce_ex__ = <built-in method __reduce_ex__ of exceptions.KeyError object>

    __repr__ = <method-wrapper '__repr__' of exceptions.KeyError object>

    __setattr__ = <method-wrapper '__setattr__' of exceptions.KeyError object>

    __setstate__ = <built-in method __setstate__ of exceptions.KeyError object>

    __sizeof__ = <built-in method __sizeof__ of exceptions.KeyError object>

    __str__ = <method-wrapper '__str__' of exceptions.KeyError object>

    __subclasshook__ = <built-in method __subclasshook__ of type object>

    __unicode__ = <built-in method __unicode__ of exceptions.KeyError object>

    args = ('e',)

    message = 'e'

The above is a description of an error in a Python program.  Here is

the original traceback:

Traceback (most recent call last):

  File "console.py", line 178, in <module>

    config.ISY = isy.ISY(config.ISYrequestsession)

  File "/home/pi/consolestable/isy.py", line 426, in __init__

    configdict = xmltodict.parse(r2.text)['CList']['e']

KeyError: 'e'

Thanks,

Aaron

Posted

Looks like I don't expect anyone to have no integer variables defined.  Apparently you have a few state variables and no integer ones.  My bad for that assumption.  As a quick fix to get you going just define an integer variable (don't need it to do anything) which should make the current code happy.  I'll fix the no variable case bug next chance I get.  Let me know if that gets you moving.

 

Kevin

Posted

Just like a state var. Not in front of isy console at moment but just look at isy docs. You have some state vars defined - just add a non state one.

 

Sent from my SAMSUNG-SM-G935A using Tapatalk

Posted

So if you haven't figured this out: in the ISY admin console just go to the Programs tab and then within that tab go to the Variables subtab.  There are 2 subtabs there - Integer and State.  You already have some State variables.  Just go the Integer tab and at the bottom click to add a variable and click Save.  That should do it.

Posted

Kevin,

 

Did a rebuild of the pi. After the installconsole.sh script finished it created the directories, but did not populate the consolestable directory. Attached is the log file.

 

Thanks,

Aaron

log.txt

Posted (edited)

I just ran the tiny python program that does both the creation of those directories and the populating of them and it worked fine here.  The real log that you should have sent is prep.log.  Is there anything like an error report near the end of that log?  If you want to try to manually rerun just the part that seems to have failed you look at the end of the installconsole.sh script.  There are 2 lines that start "wget" and one after those that starts "python".  Rerun those 3 commands as root.  You can just retype them at the console.  If you want to have the console autorun at start the mv and chmod commands just below that may also be needed in case the script didn't run them originally.  I'd still like to see that real log if you get a chance to find out why it didn't run correctly since it does fine here.

Edited by kck
Posted

I manually ran the commands in the script and still did nit populate any directories. TODO file only states to create configuration files. I have tried building a Pi 3 and a Pi 2 model b, both have the same results. I'm out of ideas, except that the Pi's I have are both bad. 

 

Aaron

Posted

Aaron

 

Any chance that permissions are a problem? I log into the "Pi" account on my Pi,  yet I have prefix many commands with sudo

 

Either sudo the install command, and/or chmod the directory(ies) that need directories created in them

 

 

Paul

Posted

Paul,

 

Thanks for the insight. I guess permissions could be a issue. I'll try running the scripts with the prefix sudo. I am running them as the root user.

 

Aaron

Posted

I'm at a loss to know what you are doing that makes it fail - I just ran the Python setup script and it did exactly what it should do.  If it is failing it should generate an error message of some sort out of Python.  To be precise as to what I just did:

 

I did the 2 wgets that you see in the installconsole.sh file that get the files setupconsole.py and githubutil.py and had them in /home/pi

I then ran sudo setupconsole.py.  

 

What you should see on your console if you do this from the command line will look something like this:

 

 

*** Setupconsole ***
Already present:  Console
Created:  consolestable
Created:  consolebeta
Already present:  consolerem
Staging  homerelease  in  consolestable  because  InitialInstall--2017-09-03 17:24:54--  https://github.com/kevinkahn/softconsole/archive/homerelease.tar.gz
Resolving github.com (github.com)... 192.30.255.112, 192.30.255.113
Connecting to github.com (github.com)|192.30.255.112|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/kevinkahn/softconsole/tar.gz/homerelease [following]
--2017-09-03 17:24:54--  https://codeload.github.com/kevinkahn/softconsole/tar.gz/homerelease
Resolving codeload.github.com (codeload.github.com)... 192.30.255.120, 192.30.255.121
Connecting to codeload.github.com (codeload.github.com)|192.30.255.120|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ‘homerelease.tar.gz’
homerelease.tar.gz      [ <=>                ]  78.62K  --.-KB/s    in 0.09s  
2017-09-03 17:24:55 (902 KB/s) - ‘homerelease.tar.gz’ saved [80503]
 Stage homerelease as stable
Installed staged stable
Staging  currentbeta  in  consolebeta  because  InitialInstall--2017-09-03 17:27:22--  https://github.com/kevinkahn/softconsole/archive/currentbeta.tar.gz
Resolving github.com (github.com)... 192.30.255.113, 192.30.255.112
Connecting to github.com (github.com)|192.30.255.113|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/kevinkahn/softconsole/tar.gz/currentbeta [following]
--2017-09-03 17:27:23--  https://codeload.github.com/kevinkahn/softconsole/tar.gz/currentbeta
Resolving codeload.github.com (codeload.github.com)... 192.30.255.121, 192.30.255.120
Connecting to codeload.github.com (codeload.github.com)|192.30.255.121|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ‘currentbeta.tar.gz’
currentbeta.tar.gz      [ <=>                ]  78.63K  --.-KB/s    in 0.1s   
2017-09-03 17:27:24 (713 KB/s) - ‘currentbeta.tar.gz’ saved [80515]
 Stage current beta release
Installed staged beta
 

Just to make things hard I had actually deleted consolestable and consolebeta but not the other 2 directories Console and consolerem.  That is why you see the messages at the top that those 2 are already present.  This python program doesn't do much magic.  It simply calls the utility StageVersion from githubutil.  That procedure issues a wget for the requested version (in your case currentrelease) .  It then issues a tar call to unpack that file into consolestable/stagedversion.  There is some magic to identify the GitHub version (the sha stuff) that you can ignore unless it blows up for some reason.  Then setupconsole calls InstallStagedVersion which just saves any existing version (you won't have one) into previousversion and pulls the stagedversion into consolestable.  The last thing it does, which again for you should not matter, is to run a script to update any python libraries in case the new version needs something the old one didn't.  If you look in /home/pi/text.txt you'll probably see a bunch of messages that requirements are already met.

 

That's all that's going on here - really not much.  As I said - I've just run it again and it ran yesterday for me when I was building a new system.  If something is going wrong you are going to have to give me some more information about error messages or the like.  You could try issuing the wget that setupconsole issues for the currentrelease directly from the command line and see if you get the gz file downloaded from GitHub.  If that works you could try issuing the tar command manually against that gz file.  But I need some other clue if I am going to help further.

 

Kevin

P.S. You do need to run all these as root.  When you run the installconsole.sh script it actually checks to see that you are running as root and exits with a message if you are not.  However, if you are running the pieces manually then you need to make sure of that yourself.

Posted

I am sure it is something that I am doing that is causing the problem. I have ordered a new Pi 3 just to be sure that is not the problem.

 

I ran the setupconsole command as the root with the command "sudo python setupconsole.py".

 

If it helps with troubleshooting or explanation as to what I am doing wrong is attached is a txt file that shows the error I get when I run it. The other 2 wget commands seem to work fine and create the files required.

 

Thanks,

Aaron

 

 

setupconsole error.txt

Posted

Aha!  That error message was what I needed - thanks.  Somehow a typo crept in - in setupconsole.py the line should read StageVersion not StagedVersion.  I was not seeing this because I run "homesystem" which uses the other arm of that if statement where the typo wasn't present.  Great as python is as a language it is so dynamic that it doesn't catch this kind of error whereas most languages would.  In any case - my bad.  You can edit your version of the file or just download it again since I just pushed a fix of it or you can rerun the full build but it should work now.

 

Really sorry for causing you the problem,

 

Kevin

Guest
This topic is now closed to further replies.

×
×
  • Create New...