New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Subforum for general discussions. Do not dump your questions/problems here, but try to find the subforum where it belongs!

Moderators: leecollings, remb0

palnic
Posts: 36
Joined: Wednesday 13 September 2017 15:40
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.8153
Location: Chicago
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by palnic »

20240229_154334.jpg
20240229_154334.jpg (64.03 KiB) Viewed 1400 times
Thank you! Trusted network was an issue. Working to adjust a screen
Thorgal789
Posts: 815
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Thorgal789 »

For this page, it's my fault, the display is not dynamic enought, lot of value are hard coded.
I will correct it this Week end.

BTW you need to reverse color

Code: Select all

"-DTFT_INVERSION_ON=1",
palnic
Posts: 36
Joined: Wednesday 13 September 2017 15:40
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.8153
Location: Chicago
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by palnic »

20240301_101921.jpg
20240301_101921.jpg (109.06 KiB) Viewed 1374 times
Thanks. I made a change in SETTINGS screen. On the home screen when you click any SWITCH buttons, program goes on the second screen where you can turn it ON/OFF. I want to turn ON/OFF my switches on home screen, could you please point where I can look for the event handler, I am still learning. I don't want full Domoticz menu on this small screen, just 2/3 switches, 2/3 temp sensors and that it, everything on the home screen. Thanks again.
kniazio
Posts: 198
Joined: Thursday 06 October 2016 8:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7243
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by kniazio »

palnic wrote: Friday 01 March 2024 17:38 20240301_101921.jpgThanks. I made a change in SETTINGS screen. On the home screen when you click any SWITCH buttons, program goes on the second screen where you can turn it ON/OFF. I want to turn ON/OFF my switches on home screen, could you please point where I can look for the event handler, I am still learning. I don't want full Domoticz menu on this small screen, just 2/3 switches, 2/3 temp sensors and that it, everything on the home screen. Thanks again.
I join in the request @palnic :)
Thorgal789
Posts: 815
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Thorgal789 »

But the problem is to keep something homogeneous. There is so much "light" device, and just a little where the "fast clic" is possible, and not so hard to use one more clic.

BTW, was not so hard to code, so have added a special flag, you can enable it in the platformio.ini file "DFASTCLIC", it will make possible a "fast clic" for some device

Code: Select all

#ifdef FASTCLIC
        Device *d2 = (Device *)d;
        if ((d2->type == TYPE_PUSH) || (d2->type == TYPE_LIGHT) || (d2->type == TYPE_SWITCH) || (d2->type == TYPE_PLUG))
        {
            char buff[256] = {};
            lv_snprintf(buff, 256, "/json.htm?type=command&param=switchlight&idx=%d&switchcmd=%s", d2->idx, "Toggle");
            HTTPGETRequest(buff);
            return;
        }
#endif
It will use the "toogle" command, I think it will be enought ?

New version online, still on branch "test", with this feature, some graphical changes, and native support for @palnic device (vertical mode)

DBONUSPAGE is still WIP.
kniazio
Posts: 198
Joined: Thursday 06 October 2016 8:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7243
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by kniazio »

Come on, sir. Now this is MEGA. Just some extra pages and the project is beautiful. Respect.
Attachments
IMG_20240305_205052_098.jpg
IMG_20240305_205052_098.jpg (182.96 KiB) Viewed 1268 times
IMG_20240305_205050_482.jpg
IMG_20240305_205050_482.jpg (203.91 KiB) Viewed 1268 times
palnic
Posts: 36
Joined: Wednesday 13 September 2017 15:40
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.8153
Location: Chicago
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by palnic »

@Thorgal789 Thanks a lot, I am using your latest main branch. Everything works as it is supposed. Was going to replace wall switch with display, when faced another issue. Wall switch is a standard/electric switch and I can't operate it with the display. Here is my idea. The display has three GPIO on connector P3. I can create virtual switches for Domoticz. Is it possible to link these virtual switches to the GPIO? If it is possible, I can design the PCB to add some relays there and manage local switches. Also I can order some prototype PCBs to play with. What is your thoughts?
Thorgal789
Posts: 815
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Thorgal789 »

Yeah I had the same idea when I have started the project, use the GPIO or other stuff integred to the device, on mine I have temperature, luminosity, led, sound and ect ...

But the problem is the communication with domoticz.
My first idea was to make a plugin, so all sensors can be usable, and will be possible to send command to the device (double side communication), like a dynamic display, all will be managed by the plugin and not the device. But there is no interface, so it mean making plenty scripts to make a custom display or select which one device to use or not.

ATM the device is able to send request, so it can send request to a virtual device created in domoticz to enable or disable it.
But it receive only websocket, haven't enabled a server feature. So not possibble to trigger GPIO from domoticz (or using a hacky code that scan websocket for a special device name and trigger gpio, this is possible too)

The code is dynamic, so you can make all you want with it, change the widget number, the page to use, the device you prefer, but not possible to add "special" widget controled only by the device.
So it mean another solution will be to create a special page with just 2 switches to enable/disable the gpio, in local mode. This is easy and can be disabled by defaut for others users to prevent memory use. But more hardware work, haven't see if it's possible yet.

It's possible too using 220 V module behind the device, for exemple a zigbee one.

On my side I have give up with the gpio use for power for 2 reasons :
- it's 240 V, and I'm afraid of fires, I don't want to use DIY stuff for this part.
- Actual available GPIO on mine (the extended GPIO connector) are input only, so need to use a different interface, have checked fastly your device, and I think it's same for you, so probably need to use a serial port ...

If you want to make try, I can code something, I don't think the problem will be the software but more the hardware.

For the moment my solution will be a new hole, I will put a cache when I sell the house. Or replace unused switch, I don't need 4 commands for a light with a presence sensor.
palnic
Posts: 36
Joined: Wednesday 13 September 2017 15:40
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.8153
Location: Chicago
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by palnic »

It is good to free yourself from illusions. You are right, I am not talking about communication, interface and so on issue, just general technical questions. I can buy a Zigbee relay for $3 and use it to replace a wall switch. Just a single 5V relay cost $5. You can buy 7" android tablet for $40 and run fully functional domoticz. It is hard to compete to China.
Thorgal789
Posts: 815
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Thorgal789 »

Code: Select all

It is hard to compete to China.
Lol sure, imagine your device have wifi+bluetooth+full OS+sensors+display+touchpad for less than 10 euros ^^
kniazio
Posts: 198
Joined: Thursday 06 October 2016 8:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7243
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by kniazio »

To @Thorgal789 . I see there are some updates on Github. Please write on the forum what has changed
Thorgal789
Posts: 815
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Thorgal789 »

Honnestly I don't remember, the code move a lot ATM, last changes was :
- The "multi page" support, working but setting are still hardcoded
- A special support for the Rain widget.
- Minor Graphical changes
- ATM I m trying to reduce the memory used, so invisible for you.

And we are trying to make a support for the ESP32-4848S040, a square device with relay.
Rik60
Posts: 82
Joined: Sunday 25 June 2023 21:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: The Netherlands
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Rik60 »

Hi, interesting project.
I have a Sunton display EPS32-8048S043C ips display with touch resolution 800*480. I think its a bit simular with the esp32-E32S3RGB43. I have tried this but is not working. I can compile and upload it to the display without errors but the display stays dark, backlight is off. What settings do i have to use/change to make it work?
Thanks
Thorgal789
Posts: 815
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Thorgal789 »

I have found this code https://github.com/Zer0-bit/8048S043C-t ... 048S043C.h
So have used it to make a try with your device, still on branch "test"
In the platformio.ini file just comment/uncomment
[platformio]
;default_envs = esp32-2432S028R
;default_envs = esp32-2432S024C
;default_envs = esp32-E32S3RGB43
;default_envs = esp32-4848S040
default_envs = esp32-8048S043C
We had the same problme for the esp32-E32S3RGB43, your device don't have "special feature" for backlight with solder or not a resisitor ?
Rik60
Posts: 82
Joined: Sunday 25 June 2023 21:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: The Netherlands
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Rik60 »

Thanks for the update.
After seareching the web i found another solution, i modified esp32-E32S3RGB43 a bit, i had to change some IO pins, after that the backlight went on and the calibration screen was visible, but the touch didn't work.
After updating the testversion the dispay starts and the calibration screen was visible, but only 1 cross is visible. With some luck the wifi setting screen shows but i can't select a wifi and the keyboard is partly visible. I think i have to play with some setting.
Thorgal789
Posts: 815
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Thorgal789 »

You are using the code on the github (branch "test") or using a custom one ?
Can you share it if it's a custom one ? I have see some issues (corrected) about this device and the touchpad resolution.
Rik60
Posts: 82
Joined: Sunday 25 June 2023 21:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: The Netherlands
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Rik60 »

Finale i have the display running, using the branch "test"on github. I had to make some changes:
platformio.ini:
line 166 changed 800 to 480
line 167 changed 480 in 800

in driver esp32-8048043C.h:
line 55 and 57 change text TFT_WIDTH in 800
line56 and 58 change text TFT_HEIGHT in 480



In settingsscreen i can select rotate screen, but has no effect. On the home screen i only have 4 devices on the top line. If i try to slect more devices in setting(Dft devices), they are not visible.
Also a tip: On a empty home screen, is it possible to have some text here so you can see that the startup is finished
Thorgal789
Posts: 815
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Thorgal789 »

Thx, have corrected the code with yours values
In settingsscreen i can select rotate screen, but has no effect
Yes was not enabled with your driver, because I can't try it, and hard to add new device with more exotic settings. I have re-enabled it on the new "test" branch

Code: Select all

#ifdef LOVYANGFX
    tft.setRotation(global_config.rotateScreen ? 3 : 1);
#endif
The code switch between value 3 and 1, values can go from 0 to 3 and 4 to 7 in "mirored" mode.
This setting is to rotate at 180 degré, not 90, it's to have the USB port on the other side, no to switch portrait/landscape.
If i try to slect more devices in setting(Dft devices), they are not visible
Perhaps a typo ?
You can see what happen using the "serial monitor", there is so much usefull log for the moment.

Also a tip: On a empty home screen, is it possible to have some text here so you can see that the startup is finishe
As yes, not a bad idea, on first run, if the user haven't used hard coded value, the application take all idx from 0 to 9, hoping for at least one of them is working.
Rik60
Posts: 82
Joined: Sunday 25 June 2023 21:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: The Netherlands
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Rik60 »

Thx,
I have downloaded the updated code. Worked fine.
I am trying to fill the homescreen, i can't put all switches there, seems that only the types "switch" can by put there. If i try a type "Lighting 1" is is not visible. If i try a screen (type = Switch) it is on the homescreen but i can't control it. There is no command in the serial screen.
Thorgal789
Posts: 815
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: New project, a small wall display to control Domoticz using CYD (Cheap ESP32 touchscreen)

Post by Thorgal789 »

It's possible I miss some widget type, like the "ARC" type.
If you know how to get information (using http://IP:PORT/json.htm?type=command&param=getdevices&rid=ID, can you give me the type/subtype (and switchtype if exist) ?
Else a widget capture from domoticz.
And yes, if the device type is not supported you will have an empty place, but it's fast to correct.

I have take a look fast here , but I don't see what can be the "Lighting 1" https://www.domoticz.com/wiki/Developin ... vice_Types
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests