Page 3 of 4
Re: LCD (20x4 made in China)
Posted: Friday 13 November 2015 11:02
by D'rMorris
This is really great

!!
I got my LCD's and it's working like a charm! The only thing I can't quite get is this.
I have 2 screens attached. One has address 27, one has address 3f.
I've modified your script to my parameters and it works on only one screen. In lcd_display.py, should I just add the second address like this:
Code: Select all
import i2c_lib
from time import sleep
# LCD Address
ADDRESS = 0x27
ADDRESS = 0x3f
Or do I have to change something in your script? I changed the TotalScreens to 2 in your script.
Re: LCD (20x4 made in China)
Posted: Friday 13 November 2015 11:16
by D'rMorris
hhmmm no, that didn't work

. I just realized that the TotalScreens variable only determines which of the screens you get to see.
If you set it to 2, you will only get the screen_home and screen_system.
Just adding the second screen to the lcd_display.py obviously does not work. Do I need to create 2 variants of lcd_display.py and lcd.py for each screen I want to control?
So for example:
- lcd1.py that imports lcd_display.py_1 (which has address 0x27 in it)
- lcd2.py that imports lcd_display.py_2 (which has address 0x3f in it)
EDIT: indeed, when you create it like I described above, you can have 2 screens with different information on them

.
This is cool!!
Now I'm still figuring out what to do with the lcd_init and lcd_off scripts.
I have to get myself a Python noob book, so that I can do all kinds of cool stuff with this

.
Re: LCD (20x4 made in China)
Posted: Monday 16 November 2015 14:32
by NickHead

- lcd2small.jpg (129.29 KiB) Viewed 5503 times
I got one i2c and a very large parallel one going on mine.
Re: LCD (20x4 made in China)
Posted: Saturday 21 November 2015 16:06
by gizmocuz
just have a look in the mysensors forum topic here, and my V_CUSTOM implementation
you can request any sensor value from domoticz that you want
Re: LCD (20x4 made in China)
Posted: Monday 23 January 2017 11:53
by marcel19
i understand this is a old post,
but i'm trying to get it to work.
i have the following setup:
1X raspberry pi 2 with domoticz installed
1X Slimme meter kabel P1:
https://www.sossolutions.nl/slimme-meter-kabel
1X Arduino UNO with this lcd shield:
https://benselectronics.nl/lcd-1602-lcd-key-pad-shield/
Domoticz is up and running, and working like a charm.
It would be pretty nice, when i can display the usage of the power and gas meter to the display.
Can someone help me out with this setup, and coding?
if it's possible to use that display directly to the Raspberrypi then i prefere that option.
Re: LCD (20x4 made in China)
Posted: Sunday 12 February 2017 11:34
by jadijkstra2000
When I have time I Will check for you!
Re: LCD (20x4 made in China)
Posted: Sunday 12 February 2017 12:02
by edwin1234
very nice project
i will try this too
thanks
Re: LCD (20x4 made in China)
Posted: Sunday 12 February 2017 12:38
by MikeF
Did you see my posts dated 25 October 2015 in this thread? I'm using a separate Raspberry Pi, and displaying multiple screens of data from Domoticz.
Re: LCD (20x4 made in China)
Posted: Friday 17 February 2017 13:56
by Jufo
HI
Where can I find the library "from lcd_display import lcd"
Best Regards
Robert
Re: LCD (20x4 made in China)
Posted: Friday 17 February 2017 15:17
by MikeF
@Jufo,
There's a library called lcd_display in the zip file attached to this earlier post in this thread (pepijn » Sunday 17 May 2015 20:51) :
Re: LCD (20x4 made in China)
Posted: Friday 17 February 2017 20:55
by Jufo
@MikeF
Thanks,
I have another question, how to collect data about your computer domoticz:
Code: Select all
def screen_systeem():
lcd.clear
lcd.display_string_l(unichr(255)+" Systeem "+unichr(255)+unichr(255)+unichr(255)+unichr(255)+unichr(255)+unichr(255)+unichr(255)+unichr(255)+unichr(255)+unichr(255), 1)
lcd.display_string_l("Processor : " + get_domoticz_sensor(7)["Data"],2)
lcd.display_string_l("Geheugen : " + get_domoticz_sensor(1)["Data"],3)
lcd.display_string_l("Temperatuur : " + get_domoticz_sensor(4)["Data"],4)
You probably you are using virtual devices, but have an interesting script to retrieve the data?
My small upgrade for temperature:
Thanks

Re: LCD (20x4 made in China)
Posted: Saturday 18 February 2017 11:51
by MikeF
@Jufo, as I mentioned in an earlier post:
MikeF wrote:The values in the get_domoticz_sensor() calls are the idx's of my various Domoticz devices
- you can find the idx's for your devices in Setup > Devices in Domoticz.
I also did that upgrade for degrees C in a later version. As well as this, if you define
then you can do the following (e.g.), to avoid typing unichr(255) multiple times:
Code: Select all
lcd_string(ch + " System " + (ch*11), 1)
(I find I come across these little tweaks by Googling / trial-and-error - I'm no expert!)
Re: LCD (20x4 made in China)
Posted: Saturday 18 February 2017 12:24
by Jufo
My script for RPi stats:
Code: Select all
#!/bin/bash
#CPU_Temp
CPU_Temp=`/opt/vc/bin/vcgencmd measure_temp|cut -c6-9`
OUTPUT=`curl "http://192.168.3.200:8080/json.htm?type=command¶m=udevice&idx=21&nvalue=0&svalue=$CPU_Temp"`
#CPU_Usage
CPU_Usage=`top -bn 1 | awk 'NR>7{s+=$9} END {print s/4}'`
OUTPUT=`curl "http://192.168.3.200:8080/json.htm?type=command¶m=udevice&idx=19&nvalue=0&svalue=$CPU_Usage"`
#RAM_Usage
RAM_Usage=`free -m | awk 'NR == 2 {printf "%.2f\n", $3*100/$2}'`
OUTPUT=`curl "http://192.168.3.200:8080/json.htm?type=command¶m=udevice&idx=20&nvalue=0&svalue=$RAM_Usage"`
#HDD_Usage
HDD_Usage=`df $PWD | awk 'NR > 1 {print $5+0}'`
OUTPUT=`curl "http://192.168.3.200:8080/json.htm?type=command¶m=udevice&idx=22&nvalue=0&svalue=$HDD_Usage"`
LCD (20x4 made in China)
Posted: Saturday 18 February 2017 18:22
by pepijn
Jufo wrote:My script for RPi stats:
Code: Select all
#!/bin/bash
#CPU_Temp
CPU_Temp=`/opt/vc/bin/vcgencmd measure_temp|cut -c6-9`
OUTPUT=`curl "http://192.168.3.200:8080/json.htm?type=command¶m=udevice&idx=21&nvalue=0&svalue=$CPU_Temp"`
#CPU_Usage
CPU_Usage=`top -bn 1 | awk 'NR>7{s+=$9} END {print s/4}'`
OUTPUT=`curl "http://192.168.3.200:8080/json.htm?type=command¶m=udevice&idx=19&nvalue=0&svalue=$CPU_Usage"`
#RAM_Usage
RAM_Usage=`free -m | awk 'NR == 2 {printf "%.2f\n", $3*100/$2}'`
OUTPUT=`curl "http://192.168.3.200:8080/json.htm?type=command¶m=udevice&idx=20&nvalue=0&svalue=$RAM_Usage"`
#HDD_Usage
HDD_Usage=`df $PWD | awk 'NR > 1 {print $5+0}'`
OUTPUT=`curl "http://192.168.3.200:8080/json.htm?type=command¶m=udevice&idx=22&nvalue=0&svalue=$HDD_Usage"`
Domoticz supports raspberry pi system monitoring by default. The script just uses the Domoticz devices. So you don't need to run a script to collect these values.
Re: LCD (20x4 made in China)
Posted: Sunday 19 February 2017 1:48
by Jufo
pepijn wrote:
Domoticz supports raspberry pi system monitoring by default. The script just uses the Domoticz devices. So you don't need to run a script to collect these values.
Good!. How to start?

))
Best Regards
Robert
Re: LCD (20x4 made in China)
Posted: Sunday 19 February 2017 23:20
by MikeF
Jufo wrote:
Good!. How to start?

))
First, decide how many screens you want, and what you want to display in each screen
- you can rename / add / delete the def screen_xxx() sections, but ensure that all the names are in the screens dictionary immediately afterwards, and that TotalScreens is correct.
Then, for each screen, change the lcd.display_string_l lines to correspond to
your Domoticz devices
- change the text to appear at the left
- the parameter in get_domoticz_sensor() is the idx of the Domoticz device, as found in the Setup > Devices page
- the value in [] is the key of the data item from the JSON for that device (see below)
- add any text to appear on the right
- the last number is the row on the screen.
To find the key of the data item to display, you'll need to type the following in your browser:
Code: Select all
http://<Domoticz URL>:<port>/json.htm?type=devices&rid=<idx>
(replacing values in angle brackets as appropriate)
For example in my system, one of my temperature devices (called "Lounge") has idx = 211, so typing
Code: Select all
http://192.168.0.63:8080/json.htm?type=devices&rid=211
I get:
- Spoiler: show
Code: Select all
{
"ActTime": 1487542149,
"ServerTime": "2017-02-19 22:09:09",
"Sunrise": "07:10",
"Sunset": "17:24",
"result":
[
{
"AddjMulti": 1.0,
"AddjMulti2": 1.0,
"AddjValue": 0.0,
"AddjValue2": 0.0,
"Barometer": 1023.4,
"BatteryLevel": 72,
"CustomImage": 0,
"Data": "22.8 C, 41 %, 1023.4 hPa",
"Description": "",
"DewPoint": "8.86",
"Favorite": 1,
"Forecast": 5,
"ForecastStr": "Some Clouds",
"HardwareID": 24,
"HardwareName": "MySensors_2",
"HardwareType": "MySensors Gateway USB",
"HardwareTypeVal": 41,
"HaveTimeout": false,
"Humidity": 41,
"HumidityStatus": "Comfortable",
"ID": "1303",
"LastUpdate": "2017-02-19 22:04:51",
"Name": "Lounge",
"Notifications": "false",
"PlanID": "2",
"PlanIDs":
[
2
],
"Protected": false,
"ShowNotifications": true,
"SignalLevel": "-",
"SubType": "Weather Station",
"Temp": 22.8,
"Timers": "false",
"Type": "Temp + Humidity + Baro",
"TypeImg": "temperature",
"Unit": 3,
"Used": 1,
"XOffset": "350",
"YOffset": "277",
"idx": "211"
}
],
"status": "OK",
"title": "Devices"
}
The value I want is "Temp", so my code for this is:
Code: Select all
lcd_string("Lounge : " + str(get_domoticz_sensor(211)["Temp"]) + deg,2)
I hope this helps.
Re: LCD (20x4 made in China)
Posted: Monday 20 February 2017 10:43
by Jufo
MikeF wrote:...
I'll have everything I've done and it works.
My script shows how to get data on Domoticz.
On the LCD I already have all from Virtual Devices and others.
I'm interested in how to acquire data about RPI "Domoticz supports raspberry pi monitoring system by default."
Best Regards,
Robert
Re: LCD (20x4 made in China)
Posted: Monday 20 February 2017 11:27
by MikeF
pepijn wrote:
Domoticz supports raspberry pi system monitoring by default. The script just uses the Domoticz devices. So you don't need to run a script to collect these values.
Jufo wrote:
I'm interested in how to acquire data about RPI "Domoticz supports raspberry pi monitoring system by default."
What @pepijn means is: If you look in Setup > Devices in Domoticz, you will see the Raspberry Pi devices listed under Hardware = Motherboard - Domoticz provides these by default. Therefore you can just leave it to the python program to get these values - you don't
need a separate script, but if this works for you, that's fine.
Re: LCD (20x4 made in China)
Posted: Monday 20 February 2017 11:56
by Jufo
I do not see sensors RPI in "devices" (except for by myself added - Virtual Devices)

Re: LCD (20x4 made in China)
Posted: Monday 20 February 2017 19:30
by MikeF
Ah, I wonder if you've got 'Hide Disabled Hardware Sensors' checked in Settings?
