Reorg repo

This commit is contained in:
Edward Firmo
2024-02-25 17:27:11 +01:00
parent ec7e97650e
commit d66aa59b35
83 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
# Creating additional TFT files
## Creating `nspanel_us_land.HMI` from `nspanel_eu.HMI`
- **Program.s:**
- Change to `display_mode=3`
- **Page `home`:**
1. Change left_bt_pic (x,y,w,h) from ( 47,307,120,3) to (467,173,3,120)
2. Change right_bt_pic(x,y,w,h) from (288,307,120,3) to (467, 27,3,120)
3. Rotate pictures 30 & 31 by 90degrees - You will find the rotated pics under `\dev\ui\us_land\pics` folder.
## Creating `nspanel_CJK_xxx.HMI` from `nspanel_xxx.HMI`
- **Program.s:**
- Change to `charset=2`
- **Fonts:**
- Replace `ubuntuXX` fonts by the ones available under `\dev\ui\fonts\CJK` folder.

View File

@@ -0,0 +1,106 @@
# ESPHome
## Logging
Avoid excessive log, or at least avoid excessive log at DEBUG level,
but if you look around this project, many of the functionalities will log like this:
```yaml
sensor:
- id: my_sensor
...
on_change:
- lambda: |-
static const char *const TAG = "sensor.my_sensor";
ESP_LOGD(TAG, "New value: %f", x); // No need to log this, use only when needed
if (id(is_uploading_tft)) {
ESP_LOGD(TAG, "Skipping any action as a TFT upload is in progress"); // No need to log this, use only when needed
} else {
// Your code here
}
```
## Page opened
When a new page is opened, a script name `page_changed` (whith a parameter `page` containing a
string with the page name) is called and that one will call a page specific script named `page_<page_name>`.
In addition, pages with multiple pages (entitypageXX, buttonpageXX and weatherXX) will also call
a generic page named `page_entitypage`, `page_buttonpage` or `page_weather` with a parameter
`page_number` containing the number of the page called.
If you want to execute expecific code when a page is opened, you can extend the functionality of that specific page:
```yaml
script:
- id: !extend page_changed
then:
# Code to run when any page is opened
- lambda: |-
static const char *const TAG = "script.page_changed (custom)";
ESP_LOGD(TAG, "Custom code for page changed");
ESP_LOGD(TAG, "This is the new page: %s", page.c_str());
- id: !extend page_buttonpage
then:
# Code to run when any buttonpage is openend
- id: !extend page_buttonpage02
then:
# Code to run when buttonpage02 is opened
```
## Managing conflicts with Upload TFT
The TFT upload is the most resource conmsuming task in this project and should have all the resources available,
so when creating something, please take in account:
### Stop your scripts before the upload starts
If you create a new script that should be stopped previous a Upload TFT starts,
please add your script to the `stop_all` script like this:
```yaml
script:
- id: !extend stop_all
then:
- script.stop: my_new_script_id
```
### Check for upload status before starting any action
There is a global `is_uploading_tft` which will be true when the upload TFT process starts,
so you can use this in your code like this:
```yaml
sensor:
- id: my_sensor
...
on_change:
- if:
condition:
- lambda: !lambda return (!id(is_uploading_tft))
then:
# your code here
```
or:
```yaml
sensor:
- id: my_sensor
...
on_change:
- lambda: |-
static const char *const TAG = "sensor.my_sensor";
ESP_LOGD(TAG, "New value: %f", x); // No need to log this, use only when needed
if (id(is_uploading_tft)) {
ESP_LOGD(TAG, "Skipping any action as a TFT upload is in progress"); // No need to log this, use only when needed
} else {
// Your code here
}
```
or if you are setting up a script (largely used in this project) it can just kill itself if `is_uploading_tft`:
```yaml
scripts:
- id: my_new_script_id
...
then:
- lambda: |-
if (id(is_uploading_tft)) my_new_script_id->stop();
// Your code here
```

View File

@@ -0,0 +1,221 @@
# Nextion instructions used for screenshots
Please select "Instruction codes: utf-8" in the Nextion simulator
## Boot page
```nextion
page boot
baud_rate.txt="115200 bps"
esph_version.txt="4.2"
bluep_version.txt="4.2"
tft_version.txt="4.2"
vis bt_reboot,1
framework.txt="esp-idf"
ip_addr.txt="192.168.0.123"
```
![Boot EU](../docs/pics/eu_boot.png)
![Boot US](../docs/pics/us_boot.png)
## Home page
**EU version:**
```nextion
page home
date.txt="Sunday, 29/11"
outdoor_temp.txt="8.9°"
time.txt="12:34"
vis wifi_icon,1
wifi_icon.txt=""
weather.pic=11
left_bt_text.txt="Ceiling lights"
left_bt_pic.pic=32
icon_top_01.txt=""
right_bt_text.txt="Desk lights"
icon_top_03.txt=""
icon_top_03.pco=64164
icon_top_06.txt=""
icon_top_08.txt="侀"
current_temp.txt="21.6 °C"
indoortempicon.txt=""
value01_state.txt="47%"
value01_icon.txt=""
bt_notific.txt=""
vis bt_notific,1
bt_qrcode.txt=""
vis bt_qrcode,1
bt_entities.txt=""
vis bt_entities,1
bt_alarm.txt=""
bt_alarm.pco=19818
vis bt_alarm,1
button01.txt=""
button02.txt=""
button03.txt=""
value03_state.txt="715 W"
value03_icon.txt=""
```
![Home EU](../docs/pics/eu_home.png)
**US version:**
```nextion
page home
meridiem.txt="PM"
date.txt="Sunday, 11/29"
outdoor_temp.txt="48°"
time.txt="12:34"
vis wifi_icon,1
wifi_icon.txt=""
weather.pic=11
left_bt_text.txt="Ceiling lights"
left_bt_pic.pic=32
icon_top_01.txt=""
right_bt_text.txt="Desk lights"
icon_top_03.txt=""
icon_top_03.pco=64164
icon_top_06.txt=""
icon_top_08.txt="侀"
current_temp.txt="71 °F"
indoortempicon.txt=""
value01_state.txt="47%"
value01_icon.txt=""
bt_notific.txt=""
vis bt_notific,1
bt_qrcode.txt=""
vis bt_qrcode,1
bt_entities.txt=""
vis bt_entities,1
bt_alarm.txt=""
bt_alarm.pco=19818
vis bt_alarm,1
button01.txt=""
button02.txt=""
button03.txt=""
value03_state.txt="715 W"
value03_icon.txt=""
```
![Home US](../docs/pics/us_home.png)
## Settings page
```nextion
page settings
```
![Settings EU](../docs/pics/eu_settings.png)
![Settings US](../docs/pics/us_settings.png)
## Buttons pages (DRAFT)
```nextion
api=1
page buttonpage01
page_label.txt="Bedroom"
vis 255,1
button01pic.picc=47
button01text.picc=47
button01icon.picc=47
button01bri.picc=47
button01text.txt="Ceiling\rlights"
button01text.pco=10597
button01icon.txt=""
button01icon.pco=64704
button01icon.font=10
button01bri.txt="100%"
button01bri.pco=10597
button02pic.picc=46
button02text.picc=46
button02icon.picc=46
button02bri.picc=46
button05pic.picc=47
button05text.picc=47
button05icon.picc=47
button05bri.picc=47
button05text.txt="Windows\rlights"
button05text.pco=10597
button05icon.txt=""
button05icon.pco=64704
button05icon.font=8
button05bri.txt="100%"
button05bri.pco=10597
button06pic.picc=46
button06text.picc=46
button06icon.picc=46
button06bri.picc=46
```
## Entities pages
**EU version:**
```nextion
api=1
page entitypage01
entity01_label.txt="Power monitoring"
value01_pic.txt=""
value01_label.txt="Kitchen"
value01.txt="1123.1 W"
value01.xcen=2
value02_pic.txt=""
value02_label.txt="Living room"
value02.txt="233.1 W"
value02.xcen=2
value03_pic.txt=""
value03_label.txt="Total (entire home)"
value03.txt="2345.6 W"
value03.xcen=2
value05_pic.txt=""
value05_label.txt="Electricity price"
value05.txt="1.21 €/kWh"
value05.xcen=2
value07_pic.txt=""
value07_label.txt="Electricity cost rate"
value07.txt="1.84 €/h"
value07.xcen=2
```
**US version:**
```nextion
api=1
page entitypage01
entity01_label.txt="Power monitoring"
value01_pic.txt=""
value01_label.txt="Kitchen"
value01.txt="1123.1 W"
value01.xcen=2
value02_pic.txt=""
value02_label.txt="Living room"
value02.txt="233.1 W"
value02.xcen=2
value03_pic.txt=""
value03_label.txt="Total (home)"
value03.txt="2345.6 W"
value03.xcen=2
value05_pic.txt=""
value05_label.txt="Price"
value05.txt="1.21 $/kWh"
value05.xcen=2
value07_pic.txt=""
value07_label.txt="Cost rate"
value07.txt="1.84 $/h"
value07.xcen=2
```
## Sensor page (mockup)
```nextion
api=1
page notification
vis bt_accept,0
vis bt_clear,0
notifi_label.txt="My sensor name"
notifi_text01.txt="1115.4 kWh"
notifi_text01.font=6
```

Binary file not shown.

Binary file not shown.

BIN
hmi/dev/ui/eu/pics/0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
hmi/dev/ui/eu/pics/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1000 B

BIN
hmi/dev/ui/eu/pics/10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

BIN
hmi/dev/ui/eu/pics/11.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
hmi/dev/ui/eu/pics/12.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
hmi/dev/ui/eu/pics/13.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

BIN
hmi/dev/ui/eu/pics/14.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
hmi/dev/ui/eu/pics/15.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
hmi/dev/ui/eu/pics/16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

BIN
hmi/dev/ui/eu/pics/17.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
hmi/dev/ui/eu/pics/18.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

BIN
hmi/dev/ui/eu/pics/19.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
hmi/dev/ui/eu/pics/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
hmi/dev/ui/eu/pics/20.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
hmi/dev/ui/eu/pics/21.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
hmi/dev/ui/eu/pics/22.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
hmi/dev/ui/eu/pics/23.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
hmi/dev/ui/eu/pics/24.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
hmi/dev/ui/eu/pics/25.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
hmi/dev/ui/eu/pics/26.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
hmi/dev/ui/eu/pics/27.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

BIN
hmi/dev/ui/eu/pics/28.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
hmi/dev/ui/eu/pics/29.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
hmi/dev/ui/eu/pics/3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
hmi/dev/ui/eu/pics/30.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

BIN
hmi/dev/ui/eu/pics/31.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

BIN
hmi/dev/ui/eu/pics/32.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

BIN
hmi/dev/ui/eu/pics/33.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
hmi/dev/ui/eu/pics/34.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

BIN
hmi/dev/ui/eu/pics/35.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
hmi/dev/ui/eu/pics/36.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
hmi/dev/ui/eu/pics/37.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
hmi/dev/ui/eu/pics/38.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

BIN
hmi/dev/ui/eu/pics/39.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
hmi/dev/ui/eu/pics/4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
hmi/dev/ui/eu/pics/40.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
hmi/dev/ui/eu/pics/41.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
hmi/dev/ui/eu/pics/42.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1020 B

BIN
hmi/dev/ui/eu/pics/43.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
hmi/dev/ui/eu/pics/44.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
hmi/dev/ui/eu/pics/45.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

BIN
hmi/dev/ui/eu/pics/46.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
hmi/dev/ui/eu/pics/47.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
hmi/dev/ui/eu/pics/5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

BIN
hmi/dev/ui/eu/pics/6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

BIN
hmi/dev/ui/eu/pics/7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

BIN
hmi/dev/ui/eu/pics/8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
hmi/dev/ui/eu/pics/9.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
<EFBFBD><EFBFBD>\N<>NObO<62>O<EFBFBD>Q<EFBFBD>R<EFBFBD>S<EFBFBD>S*T<T@TCTTTbTqT<71>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>T<EFBFBD>TUUEUjUuU<75>U<EFBFBD>U<EFBFBD>U<EFBFBD>U<EFBFBD>U<EFBFBD>U

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑをんゔゕゖ ゙ ゚゛゜ゝゞゟ゠ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱヲンヴヵヶヷヸヹヺ・ーヽヾヿ・ヲァィゥェォャュョッーアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン ゙ ゚㋐㋑㋒㋓㋔㋕㋖㋗㋘㋙㋚㋛㋜㋝㋞㋟㋠㋡㋢㋣㋤㋥㋦㋧㋨㋩㋪㋫㋬㋭㋮㋯㋰㋱㋲㋳㋴㋵㋶㋷㋸㋹㋺㋻㋼㋽㋾㋿ㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ

Binary file not shown.

View File

@@ -0,0 +1,96 @@
-------------------------------
UBUNTU FONT LICENCE Version 1.0
-------------------------------
PREAMBLE
This licence allows the licensed fonts to be used, studied, modified and
redistributed freely. The fonts, including any derivative works, can be
bundled, embedded, and redistributed provided the terms of this licence
are met. The fonts and derivatives, however, cannot be released under
any other licence. The requirement for fonts to remain under this
licence does not require any document created using the fonts or their
derivatives to be published under this licence, as long as the primary
purpose of the document is not to be a vehicle for the distribution of
the fonts.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this licence and clearly marked as such. This may
include source files, build scripts and documentation.
"Original Version" refers to the collection of Font Software components
as received under this licence.
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to
a new environment.
"Copyright Holder(s)" refers to all individuals and companies who have a
copyright ownership of the Font Software.
"Substantially Changed" refers to Modified Versions which can be easily
identified as dissimilar to the Font Software by users of the Font
Software comparing the Original Version with the Modified Version.
To "Propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification and with or without charging
a redistribution fee), making available to the public, and in some
countries other activities as well.
PERMISSION & CONDITIONS
This licence does not grant any rights under trademark law and all such
rights are reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of the Font Software, to propagate the Font Software, subject to
the below conditions:
1) Each copy of the Font Software must contain the above copyright
notice and this licence. These can be included either as stand-alone
text files, human-readable headers or in the appropriate machine-
readable metadata fields within text or binary files as long as those
fields can be easily viewed by the user.
2) The font name complies with the following:
(a) The Original Version must retain its name, unmodified.
(b) Modified Versions which are Substantially Changed must be renamed to
avoid use of the name of the Original Version or similar names entirely.
(c) Modified Versions which are not Substantially Changed must be
renamed to both (i) retain the name of the Original Version and (ii) add
additional naming elements to distinguish the Modified Version from the
Original Version. The name of such Modified Versions must be the name of
the Original Version, with "derivative X" where X represents the name of
the new work, appended to that name.
3) The name(s) of the Copyright Holder(s) and any contributor to the
Font Software shall not be used to promote, endorse or advertise any
Modified Version, except (i) as required by this licence, (ii) to
acknowledge the contribution(s) of the Copyright Holder(s) or (iii) with
their explicit written permission.
4) The Font Software, modified or unmodified, in part or in whole, must
be distributed entirely under this licence, and must not be distributed
under any other licence. The requirement for fonts to remain under this
licence does not affect any document created using the Font Software,
except any version of the Font Software extracted from a document
created using the Font Software may only be distributed under this
licence.
TERMINATION
This licence becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER
DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
hmi/dev/ui/us/pics/0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
hmi/dev/ui/us/pics/35.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
hmi/dev/ui/us/pics/36.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
hmi/dev/ui/us/pics/46.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
hmi/dev/ui/us/pics/47.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 B