Problems with GPIO push button on self build emonPi

(tonertiffi) #70

I changed on the My account,My profile, Beta Features:

Device Module Beta

was On, to OFF
started working 100%

(tonertiffi) #71

Its now 24:30pm here, will run it till the morning and let you know, If its still updating ok.

(Paul) #72

Please do. If the issue persists it sounds like something @TrystanLea should be aware of.

Just as another test, can you try using input and feed names without any special characters, it should be able to handle a couple of underscores, but you never know.

(tonertiffi) #73

Hi @pb66 ran it through the night, till now no problem, feeds r there, everything working 100%.As long as i do not switch to

(tonertiffi) #74

Hi @pb66, wondered on something, some off the gpio pins,on the RPI seem to have a low voltage not activated. I noticed that when i plug in the relay, eg IN1 signal to a random gpio pin on the RPI, the led on the pba has a very small glow, without doing anything.(this relay pba has 2x status leds) can i assume the following, that the pin gets the correct state, when being told what to do so from the script (else a small voltage on the pin if unused.)

, any idea? Not using it that way now RPI supplies the ground and power .
but that is my plan to use it as the final build.dJ5wKNh

(tonertiffi) #75

The end goal, so far all this is working 100%, thanks to allot of help from @pb66

(tonertiffi) #76

Hi @pb66 sorry for asking you again, I have acquired a 20x4 lcd I2c, it updates a hole lot quicker than the 16x2 for some strange reason. Sorry my question would i be able to use the extra 2 lines to display values.

I assume you have to alter, home/emonpi/lcd/

# MQTT Settings
# ------------------------------------------------------------------------------------
mqtt_user = config.get('mqtt','mqtt_user')
mqtt_passwd = config.get('mqtt','mqtt_passwd')
mqtt_host = config.get('mqtt','mqtt_host')
mqtt_port = config.getint('mqtt','mqtt_port')
mqtt_emonpi_topic = config.get('mqtt','mqtt_emonpi_topic')
mqtt_feed1_topic = config.get('mqtt','mqtt_feed1_topic')
mqtt_feed2_topic = config.get('mqtt','mqtt_feed2_topic')

# ------------------------------------------------------------------------------------
# Redis Settings
# ------------------------------------------------------------------------------------
redis_host = config.get('redis', 'redis_host')
redis_port = config.get('redis', 'redis_port')
r = redis.Redis(host=redis_host, port=redis_port, db=0)

# ------------------------------------------------------------------------------------
# General Settings
# ------------------------------------------------------------------------------------

# LCD backlight timeout in seconds 0: always on, 300: off after 5 min
backlight_timeout = config.getint('general','backlight_timeout')
default_page = config.getint('general','default_page')

#Names to be displayed on power reading page
feed1_name = config.get('general','feed1_name')
feed2_name = config.get('general','feed2_name')
feed1_unit = config.get('general','feed1_unit')
feed2_unit = config.get('general','feed2_unit')
(tonertiffi) #77

Please tell me its as simple as adding in 2 more feeds :slight_smile:

(tonertiffi) #78

Here are the 2x files i tried to alter but ya no luckemonPiLCD (2).txt (18.9 KB)
emonPiLCD.txt (996 Bytes)

(Paul) #79

I’m not familiar enough with the emonPiLCD code to know offhand.

I have no doubt it is possible, maybe @glyn.hudson can give us some pointers (he wrote the current code), otherwise I will try and look into it over the next few days, but I can’t say exactly when or comment too much further until I do.

(tonertiffi) #80

Hi @pb66 much appreciated as always, thanking you

(tonertiffi) #81

Hi @pb66 i did send @glyn.hudson a message, heard nothing till now. Take it he is a busy man like you. Thanks again for all your help much appreciated.

(tonertiffi) #82

Hi @pb66 any luck with regards to the Lcd, i have tried getting hold off @glyn.hudson ,proving to be a real challenge.

(Paul) #83

Sorry, no I haven’t had a chance to do it. I have just looked through the code again now and it’s not a straight forward edit as far as I can make out.

It certainly isn’t “its as simple as adding in 2 more feeds” I’m afraid.

On that point, you do not necessarily need to add more data feeds, that is an independent decision. Other users have made changes to the data that is displayed and with a bit of searching here on the forum you might find something to assist modifying the content displayed.

However, what you are actually needing is to change HOW the content is displayed, currently there are a number of pages of 2 lines each. To utilise the other 2 lines of your 4 line display, you essentially need to either show the same data over half as many pages or indeed, expand the data to fill half of each of the current pages, or somewhere in between.

Once the code is amended to fill 4 lines per page, I think it might be trivial to add feeds and/or pages. That is however, just my expectation, not a confirmed position.

It seems you are in luck with the library as that appears to have the ability to work with up to 4 lines,

but I have no idea where that lib came from or if it’s fully tested with 4 lines. All I know is what you see above.

In the file you see there are numerous references to lcd[0] and lcd[1], these are the 2 lines for the existing display, to use all 4 lines of your display, lcd[2] and lcd[3] will need to be introduced for each page (either with new info/feeds or by rearranging the existing pages).

Since I do not have a display to test, nor am I familiar with the existing code, I’m not sure I how much use I’ll be to you. This is significantly less straightforward than the temperature stuff we’ve already done.

I’m struggling to understand the code, it seems the “lcd” class is defined twice, once as LCD in themiddle of the file and also as lcd in the included file, as far as I can tell the LCD isn’t used, but I can’t be sure. Maybe I’ll take another look another time, but I’m pretty busy and whilst i don’t mind helping you. I do not really have the time to write this for you. The temperature stuff was easy as I had experience and examples of my own to call on.

(tonertiffi) #84

Thank you @pb66, fortunately I do understand what you are explaining to me here, as I have spent allot of time on Google looking at examples, lcd[0] ,LCD [1] got me a bit , as all the examples I came across use LCD Wright 1,2,3,4 line ect, never did I see LCD[0], [1], I did try adding , in under the feeds page lcd[2], LCD [3], adding a 3rd and 4th feed aswell, the script stops working.
On the UI administrator you can see that aswell.

I really do apriciated, every second you offer, thank you so much. If it were not for guys like you, I would not even have considered building this project, must say it has been one of the most rewarding to date. Thank you Paul

(tonertiffi) #85

I tried this

        if r.get("feed1") is not None:
            lcd[0] = feed1_name + ':'  + r.get("feed1") + feed1_unit 
            lcd[0] = feed1_name + ':'  + "---"

        if r.get("feed2") is not None:
            lcd[1] = feed2_name + ':'  + r.get("feed2") + feed2_unit 
            lcd[1] = feed2_name + ':'  + "---"

		if r.get("feed3") is not None:
            lcd[2] = feed3_name + ':'  + r.get("feed3") + feed3_unit 
            lcd[2] = feed3_name + ':'  + "---"

		if r.get("feed4") is not None:
            lcd[3] = feed4_name + ':'  + r.get("feed4") + feed4_unit 
            lcd[3] = feed4_name + ':'  + "---"

[email protected]:~/emonpi/lcd $ python
  File "", line 271
    if r.get("feed3") is not None:
IndentationError: unexpected indent
[email protected]:~/emonpi/lcd $
(Robert Wall) #86

Paul wrote earlier:

Just because it looks the same, does not mean it is the same. Check that you really do have exactly the correct indentation, not a mix of non-printing characters (tab, space, etc) that look the same to you but are not the same.

Also, check the line or lines immediately above the place where the error is reported.

(Bill Thomson) #87

I’m not a Python expert, (I leave that to PB)
but Python is flagging an indent that shouldn’t be there.

if r.get("feed3") is not None:
as well as the
if r.get("feed4") is not None:

lines are both indented, but the

if r.get("feed1") is not None:
if r.get("feed2") is not None:
lines are not indented.

i.e. if r.get ("feed3") should be aligned with the start of the if r.get ("feed1") line.
Same for the if r.get ("feed4") line.

(tonertiffi) #88

@Bill.Thomson i think you right, because any comb of Lcd [2]or [3] the script stops working,just need to find a way around it to use all 4 lines, of the 20x4

I really do like this display as it seems to update faster than the 2x16

(tonertiffi) #89

Progress is slow, allest i know it can do it as i altered the, and 4 lines.