Nextion as central info station

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Nextion as central info station

#1 Post by Wiki » 16 Apr 2020, 16:05

During the last two years or so I have been building an easy to use centralized user access point for my little Smarthome project. I think, now I have reached a state to proudly present the alpha stadium of this my small project.

In my network meanwhile around 30 ESP8266 Wemos D1, Sonoff and Blitzwolf devices are doing its jobs to fullfill my needs and wishes. I have integrated various old systems which never knew, that something like a networks exists, ie an 25 years old gas central heating, a WDE weatherstation, a WS2310 weatherstation a.s.o.

The last wish I wanted to be satisfied was a phone call list. This is done by now and I only have to design the Gui on my Nextion display.

The display I am using is a NX8048K070_11, a 7.0 inch, 32MB Nextion display attached to a Wemos D1 Mini Pro.

The pictures I made are not the best quality, but may give an overview what I have done up to now:
Main.jpg
Main.jpg (95.11 KiB) Viewed 11098 times
Klima1.jpg
Klima1.jpg (98.27 KiB) Viewed 11098 times
Klima.jpg
Klima.jpg (98.52 KiB) Viewed 11098 times
Solar.jpg
Solar.jpg (98.33 KiB) Viewed 11098 times
Aussen.jpg
Aussen.jpg (99.99 KiB) Viewed 11098 times
Anrufe.jpg
Anrufe.jpg (95.51 KiB) Viewed 11098 times
The solar and the batterie inverters are read using a python script on a RPI, using modbus protocol, the call list is filled up by reading the call monitor of a Fritz!Box with a small python script, too.

At least the possibility of switching the heating and the AC depending on the readings of my solar panel, giving an idea when it makes sense to start the dihwasher and the calling list out of the Fritz!Box using the different pages on my Nextion by just tipping raised the WAF dramatically. In the past every time a small package arrived from China I got a harsh comment what for I did spend my small pocket money. Nowadays I am asked, which nice feature I would add.....

For those, who are interested in: I have found the sources of a small Fritz!Box monitor on github and modified it for my needs:

Code: Select all

import socket
import sys
import time
import http.client
import json
import pycurl

FRITZBOX_ADDRESS = "xxx.xxx.xxx.xxx"


def left(s,amount):
    return s[:amount]

def right(s,amount):
    return s[-amount:]



while True:
    while True:
        print("Verbindung aufbauen...\n")
        try:
            sock = socket.create_connection((FRITZBOX_ADDRESS,1012))
            sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
            sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPIDLE, 60)
            sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPINTVL, 60)
            sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPCNT, 2)
        except:
            print("Verbindungsaufbau fehlgeschlagen\n")
            time.sleep(60)
            continue
        break

    print("Verbunden\n")

    while True:
        try:
            data = sock.recv(1024)
        except:
            break
        ret = data.decode('utf8').split(";")
        if (ret[1] == "RING"):
            sentence = (ret[0])
            sentence = ''.join(sentence.split())
            datum = left(sentence,8)
            uhrzeit=right(sentence,8)
            uhrzeit=left(uhrzeit,5)
            c = pycurl.Curl()
            Aufruf='http://192.168.xxx.yyy/control?cmd=Di,page4.t13.txt="'+uhrzeit+'"'
            c.setopt(c.URL, Aufruf)
            c.perform()
            Aufruf='http://192.168.xxx.yyy/control?cmd=Di,page4.t14.txt="'+datum+'"'
            c.setopt(c.URL, Aufruf)
            c.perform()
            Aufruf='http://192.168.xxx.yyy/control?cmd=Di,page4.t12.txt="'+ret[3]+'"'
            c.setopt(c.URL, Aufruf)
            c.perform()
            c.close
        else:
            continue
I didn't have the skills to daemonize this script, so I decided to go the easy way:

Code: Select all

Dummy ~ # python3 ESPFritzmon/ESPFritzmon.py > /dev/null 2>&1 &
[1] 14539
Dummy ~ # disown 14539
Is not the best way, but works. You only should remember the pid of the process to be able to kill it if needed.

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

TD-er
Core team member
Posts: 8749
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Nextion as central info station

#2 Post by TD-er » 16 Apr 2020, 20:53

raised the WAF dramatically. In the past every time a small package arrived from China I got a harsh comment what for I did spend my small pocket money. Nowadays I am asked, which nice feature I would add.....
And that's the point of no return my friend...
I remember the MythTV PC I built back in 2006 as a replacement for the good old VHS.
That system was running until roughly a year ago (HDDs with close to 100'000 power-on hours) and it was harder to schedule a window of maintenance on that PC than it would have been on the main control computer of a nuclear power plant.

Looks very nice and professional.
Do you also have an overview photo of how it is mounted in the room?

Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Re: Nextion as central info station

#3 Post by Wiki » 17 Apr 2020, 01:10

TD-er wrote: 16 Apr 2020, 20:53
raised the WAF dramatically. In the past every time a small package arrived from China I got a harsh comment what for I did spend my small pocket money. Nowadays I am asked, which nice feature I would add.....
And that's the point of no return my friend...
I remember the MythTV PC I built back in 2006 as a replacement for the good old VHS.
That system was running until roughly a year ago (HDDs with close to 100'000 power-on hours) and it was harder to schedule a window of maintenance on that PC than it would have been on the main control computer of a nuclear power plant.

Looks very nice and professional.
Do you also have an overview photo of how it is mounted in the room?
Thanks for the flowers. The GUI is still in progress, I am switching the surface from flat boring 2D to 3d graphics (result shows the second picture, six buttons are already done). But thats only cosmetic, the functionality is somehow fixed - but nevertheless still quite expandable.

....and in this case I am glad to have reached exactly this point of WAF - it was hard enough in the past to explain why I have to solder a new Dallas to one of my wall mounted devices in the middle of the living room, blocking space on the living room table with my solder equipment, tools and a bunch of wires.

I know exactly what you are talking about. Some years ago - after several nervous breakdowns on my side - I managed to install a DVB receiver and recorder (Reelbox Avantgarde II) with 2TB hdd for recordings in it and network access to my 12TB raid array video pillbox strictly dedicated for my goverment - it is still her and only her entertainment playground. Since I installed this guy I was able to reget access to my own equipment. And if the raid array wasn't present or reachable I was able to blame the internet provider..... - me personally never ever made a mistake. That was the only way I've found to solve this challenge - not even cheap, but working.

The display is mounted directly beside the entrance of the living room (entrance on the left hand on the picture). Due to the complicated structure of my living room especially in this area its not possible to take an overall picture, the central chminey would have been to be removed - somewhat impossible. But here is a picture taken with maximum distance possible (and, yes, cable routing to be optimized):
WaalMount.jpg
WaalMount.jpg (96.42 KiB) Viewed 11071 times

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

nbrown6
New user
Posts: 3
Joined: 10 May 2020, 12:38

Re: Nextion as central info station

#4 Post by nbrown6 » 10 May 2020, 12:49

Hi,

You have done exactly what i want to achieve. I too have a Nextion display that i would like to connect an ESP8266 Node MCU to. However, im nit in the position to create the .bin file to allow communication to the Nextion. How have you done this?

Thanks
Neil

Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Re: Nextion as central info station

#5 Post by Wiki » 11 May 2020, 13:05

I am using the developer (..._dev_...) versions of the release builds in which the Nextion plugin is included.

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

Post Reply

Who is online

Users browsing this forum: No registered users and 78 guests