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

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 asking, but no at the moment. I am going to try next week
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 »

Rik60 wrote: Saturday 27 April 2024 17:58
Thorgal789 wrote: Saturday 27 April 2024 12:13 Ha yes, I m reading the value, data don't contain "open" or "closed" but the level (except for 0 and 100 value, so only full closed or full open)

Code: Select all

Data	: "Set Level: 38 %"

Code: Select all

For me i like the On, Off, Open, Closed as text in a icon.
So you don't to change the icon but add a text for the covering ?

If it's just that, I can make the code today. But if you want to search yourself, you can use

Code: Select all

d->level
to have the covering level and print "open" or "closed" (it's a numeric value, from 0> 100)

or use

Code: Select all

if (d->type == TYPE_BLINDS && strcmp(d->data, "Closed") == 0)
with that you will check the "full closed", and all others values will be the "Open"

Check the "data" value on a browser using the URL

Code: Select all

http://192.168.1.1:8080/json.htm?type=command&param=getdevices&rid=ID
you can have a "custom" device not managed like mines.
Thx,
I am going to try to edit the code myself.
Thanks for the tips.
Tried to edit the code, but i am running into trouble.
For the switch and powersockets i use:

Code: Select all

if (d->type < TYPE_SWITCH && strcmp(d->data, "On") == 0)
and

Code: Select all

if (d->type < TYPE_SWITCH && strcmp(d->data, "Off") == 0)
These are working fine.
For the blinds i use:

Code: Select all

if (d->level < TYPE_BLINDS && strcmp(d->data, "Open") == 0)
this is printing 'Open' but:

Code: Select all

if (d->level < TYPE_BLINDS && strcmp(d->data, "Closed") == 0)
doesn't print 'Closed' in the icon.
Am i doing something wrong?
I like to have 'Open', 'Closed' and, if possible the level between them.
I can see in the data the level status as:

Code: Select all

Data	: "Set Level: xx %"
, where xx is the level

Code: Select all

Data	: "Closed"
and

Code: Select all

Data	: "Open"
Do you have a suggestion?
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 »

Code: Select all

d->level
is the level, a number beetween 0 and 100 so need to use for exemple

Code: Select all

if (d->level > 0) 
Can be used too to display the level, it's exaclty the value you are searching ^^
But easier the code can be just

Code: Select all

    // Display a open/clode state for covering
    if (d->type == TYPE_BLINDS)
    {
        lv_obj_t * label = lv_label_create(Button_icon);
        lv_obj_set_style_text_color(label, color, 0);
        lv_obj_align_to(label, img,  LV_ALIGN_OUT_RIGHT_BOTTOM, 0, 0);
        if (strcmp(d->data, "Closed") == 0)
        {
            lv_label_set_text(label, " Closed");
        }
        else
        {
            lv_label_set_text(label, " Open");
        }
    }
(The text will be bee probably too big, perhaps just a symbol ?)

To print the level can use

Code: Select all

lv_label_set_text_fmt(label, "%d %",d->level );
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,
Added and edited a bit:

Code: Select all

    // Display a open/clode state for covering
    if (d->type == TYPE_BLINDS)
    {
        lv_obj_t * label = lv_label_create(Button_icon);
        lv_obj_set_style_text_color(label, color, 0);
        lv_obj_align_to(label, img,  LV_ALIGN_OUT_RIGHT_BOTTOM, 0, 0);
        if (strcmp(d->data, "Closed") == 0)
        {
            lv_label_set_text(label, " Dicht");
        }
        if (strcmp(d->data, "Open") == 0)
        {
            lv_label_set_text(label, " Open");
        }
        if ((strcmp(d->data, "Closed") != 0) && (strcmp(d->data, "Open") != 0))
        {
            lv_label_set_text_fmt(label, " %d %%",d->level );
        }
    }
With this as result (and some translation):
Attachments
Display_4x4_level.jpg
Display_4x4_level.jpg (206.39 KiB) Viewed 1459 times
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 »

Ha, so the data contain "open" or "close" or a level ? there is 3 possibles values ?

BTW I will take your capture for the project ^^.
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 »

Yes, the data can contain 3 possible values:
Open
Closed
Level %
ElMyggo
Posts: 10
Joined: Sunday 01 November 2020 20:48
Target OS: Windows
Domoticz version: 2024.4
Location: Sweden
Contact:

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

Post by ElMyggo »

I get this 7" displayboard and wonder if this can work with same software, do i have to make the driver myself?
Panlee ZX7D00CE01S-V13
http://en.smartpanle.com/product-item-19.html

https://www.aliexpress.com/item/1005006156603547.html

data:
https://img01.71360.com/file/read/www2/ ... asheet.pdf
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 »

Have found somes usefull links
https://github.com/moononournation/Ardu ... ssions/361
https://github.com/moononournation/Ardu ... ssions/368
https://github.com/fbiego/jarvis-lvgl-esp32

So based on them have created a esp32-ZX7D00CE01S environnement to test on branch "test", need to enable your device in platformio.ini file to test it

Code: Select all

default_envs = esp32-ZX7D00CE01S
I m not using the same code than them for the touch, but it seem you have a GT911 too and the code I m using is already tested for another device.
ElMyggo
Posts: 10
Joined: Sunday 01 November 2020 20:48
Target OS: Windows
Domoticz version: 2024.4
Location: Sweden
Contact:

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

Post by ElMyggo »

Super! i do some testing :-)
ElMyggo
Posts: 10
Joined: Sunday 01 November 2020 20:48
Target OS: Windows
Domoticz version: 2024.4
Location: Sweden
Contact:

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

Post by ElMyggo »

Have done som testing now and i get no backlight so dont know if screen is working, touchdriver seems to work, i can calibrate screen according to log.
No backlight
no-backlight.jpg
no-backlight.jpg (73.79 KiB) Viewed 1284 times

Code: Select all

--- Terminal on COM5 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x128
load:0x403c9700,len:0xb90
load:0x403cc700,len:0x28cc
entry 0x403c98b8
Starting application
Config version: 0
Clearing Global Config
Init 911 driver

Driver GT911 started: (800x480)
Check ACK on addr request on 0x
5D
: SUCCESS
Starting calibration
Calibration coef: 1.2 , -1.4
Calibration offset: -103.8 , 602.4
Display buffer size: 38400 bytes
Screen init done
Brightness value: 255
I tested the files from https://github.com/fbiego/jarvis-lvgl-esp32 and then i get backlight and working screen for 1 second then start flickering one line.. i have marked photo to see that the backlight is on
backlight.jpg
backlight.jpg (72.39 KiB) Viewed 1284 times
flicker.jpg
flicker.jpg (72.07 KiB) Viewed 1284 times
I try to find out how the backlight is turning on and do some more testing
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 »

Try adding in esp32-ZX7D00CE01S.h file

Code: Select all

#define GFX_BL 45
It's the code Im using for other device, can be enought.

On his code he have disabled this one and use instead

Code: Select all

#define GFX_BL 45
const int freq = 1000;
const int ledChannel = 7;
const int resolution = 8;

Code: Select all

  // #ifdef GFX_BL
  //   pinMode(GFX_BL, OUTPUT);
  //   digitalWrite(GFX_BL, HIGH);
  // #endif

  ledcSetup(ledChannel, freq, resolution);
  ledcAttachPin(GFX_BL, ledChannel);
  ledcWrite(ledChannel, int(2.55 * 95));
For the second part, file to edit is screen_driver.cpp around line 524
ElMyggo
Posts: 10
Joined: Sunday 01 November 2020 20:48
Target OS: Windows
Domoticz version: 2024.4
Location: Sweden
Contact:

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

Post by ElMyggo »

I added #define GFX_BL 45 in driver file and i get picture :) , i have to change resolution to 800x481 because a white line at bottom (read this on the other link you find)
But i cant swipe right (settings) screen get white and restart, swipe left is working.

I upload a video here:
(Havent fix the custom font)
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 »

Nice, updating the code (not sure I have set the 481 at good place, in the platformio.ini file ?

Ok so you have crash on the "tool" panel (There is in order, tool/home/home_bis/group/info)
This page display hardware information, there is perhaps something bad on memory stuff ATM for your device
Can you try to catch logs using the serial monitor ?

Else I think the guilty code is here, the rest only display 2 buttons.

Code: Select all

    lv_mem_monitor_t mon;
    lv_mem_monitor(&mon);
    uint32_t used_size = mon.total_size - mon.free_size;

    char Text[151];
    lv_snprintf(Text, 150, "+ HEAP Memory Usable (Kb) %d, Max %d, Total %d\n", ESP.getMaxAllocHeap()/1024, ESP.getFreeHeap()/1024, ESP.getHeapSize()/1024);
    lv_snprintf(Text + strlen(Text),150, "+ PSRAM Memory Free (Kb) %d, Total %d\n", ESP.getFreePsram()/1024, ESP.getPsramSize()/1024);
    lv_snprintf(Text + strlen(Text), 150, "+ LV Heap %d kB used (%d %%) %d%% frag.\n", used_size / 1024, mon.used_pct, mon.frag_pct);
    //lv_snprintf(Text + strlen(Text), 150, "Spiram size (Kb) %d , himem free %d\n", esp_spiram_get_size()/1000, esp_himem_get_free_size()/1000); // Not used, CRASH
    lv_snprintf(Text + strlen(Text), 150, "+ Application Version : %d", 1);

    label = lv_label_create(cont2);
    lv_label_set_long_mode(label, LV_LABEL_LONG_WRAP);
    lv_label_set_text(label, Text);
    lv_obj_set_size(label, LV_PCT(100), LV_PCT(100));
    lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_LEFT, 0);
Can try to disable this code in tools-panel.cpp, and re-enable it line by line.

About custom font, where are you front ? (Wich one font you need)
ElMyggo
Posts: 10
Joined: Sunday 01 November 2020 20:48
Target OS: Windows
Domoticz version: 2024.4
Location: Sweden
Contact:

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

Post by ElMyggo »

The crash happens when try to get Psram info
if i disable the Psram line it works, maybe some config/bug for the ESP32S3 / Psram

Code: Select all

char Text[151];
    lv_snprintf(Text, 150, "+ HEAP Memory Usable (Kb) %d, Max %d, Total %d\n", ESP.getMaxAllocHeap()/1024, ESP.getFreeHeap()/1024, ESP.getHeapSize()/1024);
    //lv_snprintf(Text + strlen(Text), 150, "+ PSRAM Memory Free (Kb) %d, Total %d\n", ESP.getFreePsram()/1024, ESP.getPsramSize()/1024);
    lv_snprintf(Text + strlen(Text), 150, "+ LV Heap %d kB used (%d %%) %d%% frag.\n", used_size / 1024, mon.used_pct, mon.frag_pct);
    //lv_snprintf(Text + strlen(Text), 150, "Spiram size (Kb) %d , himem free %d\n", esp_spiram_get_size()/1000, esp_himem_get_free_size()/1000); // Not used, CRASH
    lv_snprintf(Text + strlen(Text), 150, "+ Application Version : %d", 1);
tools.jpg
tools.jpg (60.27 KiB) Viewed 1232 times
ElMyggo
Posts: 10
Joined: Sunday 01 November 2020 20:48
Target OS: Windows
Domoticz version: 2024.4
Location: Sweden
Contact:

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

Post by ElMyggo »

About custom font, im from Sweden so i use åäö but we solved this erlier on Github ;) and i think i can modify that now.
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 »

Yep @ElMyggo have share his police on the github https://github.com/Smanar/CYD-Domoticz- ... 2100620260

About the issue, have made some search but I can't say if the issue is from the config or the hardware. But there is others users with the same issue.
According the jarvis project can try to replace in the platoformio.ini file

Code: Select all

board = esp32-s3-devkitc-1
board_build.partitions = min_spiffs.csv  ; Use partitions that allocate 512KB for SPIRAM
by

Code: Select all

board_build.partitions = app3M_fat9M_16MB.csv
board = esp32s3box
In build_flags

Code: Select all

 -mfix-esp32-psram-cache-issue
Perhaps your device don't have psram, but from the ALI express link it have 8M, there is different version ?

If you can't avoid the crash I will disable it for all board, but it can be usefull later ...
ElMyggo
Posts: 10
Joined: Sunday 01 November 2020 20:48
Target OS: Windows
Domoticz version: 2024.4
Location: Sweden
Contact:

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

Post by ElMyggo »

Have now tested many different settings whitout any luck so i continue to have psram disabled.
I should have 8M memory but i can get a faulty board or something else.
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 »

Don't worry, I will disable it by defaut for all OS.
For the moment it's just an information, the code don't use them, so not usefull.
I will re-enable it later when needed.

Code is updated (just disabled the psram debug output)
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 thoses one that use the "stand by" mode, or don't use intensely the device, gizmocuz have added a new feature on recent domoticz version.
It's possible now to subscribe on websocket notification only for needed devices.

To enable it, on "test" branch, just enable

Code: Select all

-DLIGHTWS
(For the moment only possible if you don't use "Bonus Home page panel")

On the "tool panel" I have added the Running time, and the total data received by the device by Websocket. the difference is just incredible, at start you will have a enormous JSON, but after it something like 20 time lighter without problem on hudge installation.
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

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

Post by gizmocuz »

Perhaps if you put all used devices in a roomplan, and use this in your initial query, you have a lot less data at startup.
(See the example www/templates/custom.example)
Quality outlives Quantity!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest