Jump to content

Soft Keypadlinc-like Console from Raspberry Pi


kck

Recommended Posts

Kevin,


 


That did it. The two directories are now populating. Now I'm trying to write the config files. I have modified the samples you supplied to control a single device. However it is not working. Is it possible when you get time to write the config files for a light switch? The device I am trying to control is called Kitchenette Lights.


 


Is that something you can do or is it something I have to do locally?


 


Also the adafruit 3.5 screen is not working now. There is no display but in the graphical interface I can move the cursor around by touching the screen.  I ran the calibration script but it comes back as errors for all the commands. Saying command not found. I have a 2.8 screen that is working.


 


Aaron


Link to comment

Not sure what you mean regarding the config files for a light switch.  Pretty much everything in my examples are light switches.  Remember - you are defining a screen full of keys and each key can correspond to a switch.  So it sounds like what you want is to define a screen on which one of the keys corresponds to  Kitchenette Lights.  Assuming that is what you named that switch in the ISY setup then I'd expect the simplest config file would look something like:

 

include = auth.cfg, myclock.cfg
HomeScreenName = Test
HomeScreenTO = 45
DimLevel = 50
DimTO = 25
DimIdleListNames = MyClock
DimIdleListTimes = 20

MainChain = Test

 

Which should give you something with a single large button that should turn those lights on/off and if left untouched for a while switch to a clock screen.  If you look at some of the other examples you'll see screens that have more buttons.  I have found that a 2.8 inch screen works well with 4 or maybe 6 buttons while a 3.5 inch screen handles 8 just fine.  Beyond that I'd go to another screen that you switch to using the nav keys at the bottom.  By the way - I didn't actually test this sample so it may have some parameter bugs that you should be able to sort out.

 

As to the Adafruit screen, I haven't had any fail (though I physically broke a screen).  Did you change some settings on the OS of the Pi that might have caused that?  Otherwise my only suggestion would be to reseat all the plug points.  I have on occasion seated the screen onto the Pi connector off by one row of pins and had the screen light up but not work so check that all the pins are in the right spot on the female plug.  If none of that works you might try downloading a complete image from Adafruit that is supposed to be ready to boot on that screen, burn it to a CD, and see if it comes up.  That would at least tell you if you have a hardware issue with that screen or have done something to the software on you Pi.

[Test]
type = Keypad
label = Kitchen
[[Kitchenette Lights]]


 

Link to comment

Yes I just wanted to start out with one simple button. Get it working before moving on to more buttons, thermostats, etc....

 

I made the file test.txt and test.cfg. When I reboot the screen goes blank, and then after a few seconds the HDMI output screen goes back to the raspberry pi graphical interface. No console log is create. 

 

I tested the 3.5 screen using the adafruit easy-setup image and it works fine. Still will not work when installing the console. I notice what looked like an error while the script was running. Something about fonts-droid has no candidate.  I did not see this when using the 2.8 screen.

Link to comment

You can always run the console from the Linux command line with sudo python -u console.py (be in the consolestable directory so it can find console.py).  I have difficulty believing that there are no log files or error messages created when you run.  The console and/or python log all sorts of issues when they can't run.  Even if you didn't get to the creation of the Console.log file in the Console directory which happens very early in the code, python itself would give errors if it blew up.  Without some sort of error message there really isn't much I can do from this end.  I suspect that your credentials are wrong or not set for the ISY or some other issue exists with your config file such that the parser I use can't read it.  I would get rid of all includes and just have a config.txt file (I'm not sure what your test.txt since unless you change things from the command line console looks for a config.txt file in Console) that has the authorization info (address, username, password) and then directly (without includes) builds a simple screen.

 

The fonts droid message shouldn't matter - the program uses a font that isn't normally installed but that shouldn't bother python in practice since it just substitutes a default font.  If  you want to get rid of that you can always install that font (sudo apt-get install fonts-droid).  No idea why the 3.5 is having trouble (I assume that you have a different SD card that is configured for that screen and aren't trying to use the system built for the 2.8 screen for it - that won't work)  I have 3 3.5 screens running here at the moment and 1 2.8 screen.  Also have a 3.5 Chinese clone running (although that screen is flakey hardware-wise). 

 

So bottom line - please look in the Console directory and the home directory for logs and make sure you run as root because otherwise the console program can't get access to the frame buffer.

Link to comment

Kevin,

 

I got it to produce a config log file by running it from the command line. Attached is the results. I have the credentials set for the ISY in the config.txt file. I tried putting the credentials in the auth.cfg file. I also deleted all includes and just used the config.txt file. Same results.

 

 Sorry for being such a bother, but really would like to get this figured out. 

 

Thanks,

Aaron

Console.log.rar

Link to comment

What I can tell you from a quick look is that your config.txt file has problems.  Some simple items: add a trailing comma to MyClock in the line with DimIdleListNames and do the same with the 20 on DimIdleListTimes.  This is noted in the usagenotes documentation and is due to the way the python package parses strings versus lists of strings.  Neither of these caused the failure though.

 

I can't tell what you have in the config file that is causing the failure though.  The parser things it sees a screen called "T" and another called "s" that you never define.  It does somehow get 2 screens on its Main Chain of screens called "e" and "t" so I am guessing that you have "Test" written somewhere that isn't being parsed.  Are your "["'s correct?  A single '[" defines a topmost structure (a screen) and a "[[" would be down a level, e.g. a button on a screen.  You might send me the config.txt file and I can take a quick look.

 

I probably should add yet some more error checking code here, though the parsing is done by a library package so that me be tricky.  In any case, just sending along the log makes it pretty easy to at least localize the problem.  By the way, I assume that you must have run the console twice after the run that you sent me?  The log files are sequenced so Config.log is always the current or most recent and Config.log.1 the previous run.  Since you sent Config.log.2 that would have been 2 back which is file unless you edited after this in which case the config log you sent won't match the config text file I'm asking you to send.  So do make sure that you send me a log that corresponds to the config you actually ran so I don't spin my wheels.

Link to comment

First issue - you don't define any screens!  Your Test.cfg file is never processed because you don't include it.  Console processes the config.txt file and any other files it points at via includes but here you don't do that so you have no screens defined.  Probably the program should have a check for this but it never occurred to me that someone might have a config file that was essentially empty.  You need to add Test.cfg to the include.  Myclock is also not processed but it isn't referenced in config.txt so that's fine.  Mainchain should have that trailing comma so that the parser knows that  Test is a single name rather than a sequence of 4 names, 1 per letter.  That's the parser quirk that I can't do anything about.  So what is happening in the failure is that the console thinks there are no screens and when I try to build the navigation links between the screens it fails.  I can definitely improve the error checks here plus your case did show a subtle error in the code that I'll fix for some edge cases.  For now though try adding the include of the Test.cfg and adding a comma at the end of the line that sets Mainchain and let me know what happens.

Link to comment

I had hoped that the current version you have would let you get the minimal test you wanted up but it really expected that there was a secondary screen chain.  So, I fixed that and released an updated "currentrelease" on GitHub.  I then ran essentially what you had using my office light.  Here is the config.txt file:

 

 

cfglib = cfglib
include = auth.cfg, mintest.cfg
HomeScreenName = Test
HomeScreenTO = 45
DimLevel = 50
DimTO = 25

MainChain = Test,
SecondaryChain = Test,
 
And here is the mintest.cfg file:
 
[Test]
type = Keypad
label = Kitchen,
[[Office Ceiling]]

 

 

With this you get a single big button that turns the light on and off.  Should give you a starting position.

 

So you need to download the current release which you can do by running that setupconsole.py from the command line.  That should get you the current release.  I plan to poke around in the code to try to further harden it against config errors but as I warned at the outset, that is hard to get anywhere near perfect.  The log file does dump all the parameters it reads so it is always worth scanning for one that seems odd if you see strange results.

Link to comment

Kevin,

 

Success! With that version I now have a working button. I tried adding the Myclock to the include, but that doesn't seem to work yet. I'll play around with the config file and see if I can get that working. Thank you very much for putting so much of your time in helping me to get this working. I'll let you know how things go as I add more buttons.

 

Thanks again,

Aaron

Link to comment

Great.  Now at least you have a starting point.  To add the clockscreen, add myclock.cfg to the include.  Then add 2 lines:

DimIdleListNames = MyClock,

DimIdleListTimes = 20,

 

The trailing commas are important.  This will give you a system that shows your button then after 45 seconds (the TO you set earlier) will switch to displaying the clock.  The 20 is not significant here but if you define a set of idle screens it would switch to the next after 20 seconds.  Hope that helps.

 

Also, I found some strange race condition that I'd never seen before that happened in this minimal configuration.  I fixed it and pushed up a version so if you do run into an issue with a crash after the clock screen has been displaying for a bit grab that newer version.  You can do that from within the console app now that you have it running.  Tap the screen 5 times to get the Maintenance screen up.  Select "Select Version" there, then select "Download Release", When the button clears the download should be done, so hit return, then "Exit/Restart" then "Restart Console" and confirm.  Should restart you with the new version.  You can see the version change in the respective log files near the front.

Link to comment

I  now have 4 buttons configured. The only problem is, is that the calibration on the pitft is so far off that I can't press them. I can get to the maintenance screen but can not press any of the buttons. I manually ran the ./adafruit script but it still comes back as command not found in all the commands in the script. I looked at doing it from the adafruit instructions but that to complicated for me. Any suggests?

 

I'll try adding the clock again thanks.

Link to comment

That adafruit-pitft-touch-cal that is left in the /home/pi directory is their script.  Not sure what you mean that it comes back as command not found.  It should run as root so something like 

"sudo ./adafruit*"  or sudo python ./adafruit* should run it (it is a Python program).  Generally the current directory is not in your search path so a script like that needs to be located as ./script so perhaps that is what you mean.  I don't know why the calibration would be off since they basically take the screen type and use that to just force set the parameters.  You can look at their script to see what they do.  Key elements are rotation and screen type - if you are on your 2.8 screen make sure you pick the right type 28r or 28c depending upon resistive or capacitive.  That's about all I can suggest.

Link to comment

I'll try sudo python for the 2.8 pitft. I was running it as bash.  It's a 28r. I tried the 28c, but no response at all when I press on the screen.  I actually have the 3.5 pitft working now so all is good. I unplugged the HDMI cable and restarted it and it's working now.  All 4 buttons are working and I can get to the maintenance screen, that's pretty nifty. I like that I can update from there. Clock still not working. I'll play around with that some more.

 

Thanks,

Aaron

Link to comment

Great.  I did just find/squash one very small bug related to a configuration as simple as yours is at the moment (strangely bug wouldn't impact more complex configs).  It would have eventually locked up your system once the clock was running as a idle screen.  I pushed that to github.  The clock should run as the idle screen if you just add the 2 lines above and add it to the include.  Note that this uses the clock screen as an idle after the console has not been touched for the timeout interval so you won't see it on the navigation keys.  The only way to know it is working is to just start the console and wait a minute or so (or whatever your timeout is set to).

 

If you want to see that you can get the nav keys working I suggest you generate another key screen and list it in the MainChain list.

Link to comment

Well the clock not showing is probably that you spelled it wrong in the DimIdleListNames directive - capital c for clock.  This is reported in the log file if you look.  Also, you can't put a single screen on both the main and secondary screen lists which is what the error message in the log under Secondary Screen List Undefined screen name is.  The error about Home screen name is due to the extra comma on the home screen directive line.  Basically, the comma at the end thing is that if a directive can take a list of names then in the case where there is only on name you need the comma to indicate that it is a list of 1 item.  If the directive takes just a simple name then no comma.  I know that's confusing - I should probably look again at what I could do about it.  Overall, I do suggest that you scan the log for any message with severity 4 or 5 as these probably indicate something is wrong.  The level 3 are all just informative but if you get a level look back at the 3's because they may help understand what is going on.

 

There is an odd comms error from the ISY at the end of the log - that indicates that the ISY sent a message with an error indication about that node (Porch Door lock).  May be of no significance since you aren't using it here but it gets reported.

 

Now about the thermostat - I built as close a configuration as I can given different houses just now and it worked fine for me.  The actual screen code does start by displaying the 2 keys and then paints everything else so if the console crashed that would be consistent with it happening somewhere in the thermostat display routine.  (I am assuming that it crashed when you say the screen went blank?  I.e., the program exited?)  I am however surprised not to see any logged traceback info since Python doesn't crash without dumping such.  Are you sure you didn't have any on the screen?  The log you sent ends abruptly with that comm error message.

Link to comment

That fixed the clock issue. Display is not dimming. I'll check my config file for that. The thermostat screen goes blank and locks up the program. I have to unplug and power up the pi to get it working again.


 


The Porch Door Lock is a z-wave lock. I had dead batteries. I replace them and the error is gone now. Thanks for pointing that out.


Thanks,


Aaron


Link to comment

Now have the themostat screen working.  Only see one problem in the console log. Something about the MyClock cfg. Will be adding more buttons soon. Little confused on the dim functions. Should the display dim after a certain period of time or should it just switch to the clock display?

 

Thanks very much for your help. It's a great program.

 

Aaron

Console.rar

Link to comment

I just noticed the dimming issue.  It looks like it is an issue with the most recent version of Raspbian (Stretch).  I have older Jessie systems that dim fine.  I'm going to have to see if I can isolate what that issue is or try to find someone to punt it to on the web and stay with Jessie for now.

 

Not sure what to tell you regarding the tstat.  I have essentially the same config file as you must be running and it works fine here.  Is your Thermostat battery powered by chance?  I'm looking for some reason why the ISY might not respond when asked about its current values.  Could you try one thing when you get a chance.  At the top of your config.txt file add a line:

LogLevel = 0

That will turn on some additional logging.  Then once the console starts go to the Maintenance screen.  Tough "Set Flags" and touch "Main"  so that that button turns on.  Then Return and Exit Maintenance.  Then try going to the Thermostat screen.  If comms with the ISY have worked in the Console.log file you should see some messages that look like Main-> stuff.  That stuff is the current values the tstat is returning to the ISY.  If you don't see some stuff like that then it would appear that the comms to the tstat is failing for some reason.

Link to comment

The thermostat is working fine now. I don't know what I did, but it's working.  As a matter of fact everything is working fine now.  I'll see if I can build another pi with Jessie on it and see how that works for the dimming.   I'll run a Loglevel = 0. And post it just incase I'm missing something.  Thanks for all  your help.

Link to comment

If you have any repeat problem with the tstat do the LogLevel 0 and turning on the Main flag then go to the tstat.  Otherwise no idea what the issue there was.  Glad everything else is working.  I'm actually building a Jessie version to check the dimming myself.  I've posted a question a couple of spots on the web to see if anyone else has any insights on it.

Link to comment

Archived

This topic is now archived and is closed to further replies.


  • Recently Browsing

    • No registered users viewing this page.
  • Forum Statistics

    • Total Topics
      36.9k
    • Total Posts
      370.2k
×
×
  • Create New...