mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2026-02-22 05:58:39 +01:00
Compare commits
407 Commits
b414c67864
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d745d63def | ||
|
|
101e69bbde | ||
|
|
d55a63b07c | ||
|
|
52a041521d | ||
|
|
f7fa1653c6 | ||
|
|
b925ea8a2d | ||
|
|
da095b1591 | ||
|
|
ca6e271a54 | ||
|
|
698ad7c771 | ||
|
|
b0f40a1a87 | ||
|
|
2cf7bcb63e | ||
|
|
05d9ff52ca | ||
|
|
bb79cd8f85 | ||
|
|
00f7119cd2 | ||
|
|
8e6f923839 | ||
|
|
cf396b0259 | ||
|
|
42c27a3794 | ||
|
|
c65f1935e5 | ||
|
|
17284d83ca | ||
|
|
2853073a59 | ||
|
|
8de034adf9 | ||
|
|
330fa9bfd4 | ||
|
|
ec971f5f3e | ||
|
|
41f4062ab8 | ||
|
|
f3fffe7b70 | ||
|
|
c4b6a8bd8a | ||
|
|
81d876b53b | ||
|
|
d15cb218ce | ||
|
|
114f630b8a | ||
|
|
53b627be88 | ||
|
|
f2e1a7263d | ||
|
|
1e2f89ed1d | ||
|
|
b6f36d4eac | ||
|
|
fa239f8bf0 | ||
|
|
2d1719673c | ||
|
|
e9c275216c | ||
|
|
b226b61281 | ||
|
|
056d8f95c2 | ||
|
|
52c695cf1c | ||
|
|
8805e2189c | ||
|
|
341cdb47ab | ||
|
|
3b25d47bc7 | ||
|
|
a721d4ccd7 | ||
|
|
044abda65b | ||
|
|
155b08d6d5 | ||
|
|
c038745d1b | ||
|
|
154c9aced1 | ||
|
|
f5119f86ac | ||
|
|
77b7400b04 | ||
|
|
995e7eebd2 | ||
|
|
c91ca0912a | ||
|
|
a6742f88c8 | ||
|
|
9f146ec8b3 | ||
|
|
0cccfac4a6 | ||
|
|
fbe5f9658e | ||
|
|
603d207e12 | ||
|
|
338c3af940 | ||
|
|
ce6ff734d1 | ||
|
|
4308c12508 | ||
|
|
ea0f3cc411 | ||
|
|
2b4c8d3b94 | ||
|
|
ff25f07b8f | ||
|
|
59efd21251 | ||
|
|
20ae492cf3 | ||
|
|
512a89b7d6 | ||
|
|
a6c366ed41 | ||
|
|
e13d1aaecb | ||
|
|
3b6d53c78c | ||
|
|
f789e33fe5 | ||
|
|
22455546f6 | ||
|
|
e0e9815911 | ||
|
|
3e0d0e8854 | ||
|
|
98f70b20f0 | ||
|
|
4c02b5bc26 | ||
|
|
fb841abf45 | ||
|
|
bff89f0364 | ||
|
|
27ccc0cfe7 | ||
|
|
22a54c88c8 | ||
|
|
87c58cc62d | ||
|
|
1ee19213bd | ||
|
|
0c3d173f40 | ||
|
|
cc201fb7fe | ||
|
|
44d2c6fbfc | ||
|
|
9cd2f6a464 | ||
|
|
7473d13762 | ||
|
|
f57b3fe8e4 | ||
|
|
9b1558c9a6 | ||
|
|
6181dec958 | ||
|
|
a94cf0cef3 | ||
|
|
d01ccede57 | ||
|
|
65be5ffeb0 | ||
|
|
d53afb0b20 | ||
|
|
9822870fc9 | ||
|
|
8a54d1422c | ||
|
|
3f573557f0 | ||
|
|
c2ca3b26d1 | ||
|
|
476a252a92 | ||
|
|
0af779973b | ||
|
|
8e0609a781 | ||
|
|
5dab816259 | ||
|
|
5f8409f5f1 | ||
|
|
3d85e86a95 | ||
|
|
85de880cda | ||
|
|
98269b19aa | ||
|
|
d77382ee88 | ||
|
|
e925d133d2 | ||
|
|
5ef3e8132b | ||
|
|
662b79a389 | ||
|
|
c984ff53a3 | ||
|
|
f8b748a418 | ||
|
|
bc31670760 | ||
|
|
cbf6abf4dd | ||
|
|
5c85e4a6e1 | ||
|
|
cbede2412e | ||
|
|
82d22743cc | ||
|
|
640d0dfa14 | ||
|
|
ccc62d1e6a | ||
|
|
6cec0245a3 | ||
|
|
f3c98adf06 | ||
|
|
f4487e4285 | ||
|
|
8e2780b2cb | ||
|
|
0372221973 | ||
|
|
947ef2d592 | ||
|
|
a1f39236c4 | ||
|
|
4cdd1ed586 | ||
|
|
1836d29931 | ||
|
|
fca29cfbd8 | ||
|
|
b27910c1af | ||
|
|
f046ae6031 | ||
|
|
4475ab1277 | ||
|
|
9afdb71a7c | ||
|
|
c84d78551f | ||
|
|
5e2a4b17ae | ||
|
|
acdba468b3 | ||
|
|
5803a489f5 | ||
|
|
54c8d302a8 | ||
|
|
8059905579 | ||
|
|
4dc39c1b79 | ||
|
|
16909f7e7f | ||
|
|
397932a6bc | ||
|
|
04ac10b453 | ||
|
|
ff103927e8 | ||
|
|
c6e94f80de | ||
|
|
5d4ae6247d | ||
|
|
8b63322e50 | ||
|
|
7fd5b3967a | ||
|
|
1d719446c0 | ||
|
|
3913b86228 | ||
|
|
3fddbfe451 | ||
|
|
c7b492c276 | ||
|
|
2e0cff80c1 | ||
|
|
3943dee733 | ||
|
|
41e7f3c3e2 | ||
|
|
5e373ad856 | ||
|
|
0d3d40cca2 | ||
|
|
221063a5a6 | ||
|
|
8e9b8ab476 | ||
|
|
1c6be4681e | ||
|
|
7b4f4cd863 | ||
|
|
9b285efe2d | ||
|
|
22e96f2b3a | ||
|
|
23da51f662 | ||
|
|
b395a08b6e | ||
|
|
ac07dbb185 | ||
|
|
86ab806b6e | ||
|
|
89d08ea507 | ||
|
|
deacd17fc9 | ||
|
|
4372e4193e | ||
|
|
d4cb8b548d | ||
|
|
faa2880e8d | ||
|
|
eeeccc786d | ||
|
|
3bcf2372b0 | ||
|
|
9612f882a5 | ||
|
|
aa29552a90 | ||
|
|
a38393338a | ||
|
|
d2e953410c | ||
|
|
0ac345328b | ||
|
|
11bf450e4c | ||
|
|
e54faea639 | ||
|
|
25062483c9 | ||
|
|
f58be676bf | ||
|
|
cc147d29ab | ||
|
|
78d20f81d2 | ||
|
|
29a3c8123c | ||
|
|
7807651223 | ||
|
|
deb7f6788e | ||
|
|
9ca7a4e829 | ||
|
|
855ab2b28c | ||
|
|
b1b042a25f | ||
|
|
3a82af67b1 | ||
|
|
84e2105361 | ||
|
|
bae90b2b55 | ||
|
|
f6b605443d | ||
|
|
14d337891a | ||
|
|
a3df442a6a | ||
|
|
53af81f84d | ||
|
|
02332cc094 | ||
|
|
19964f4ea6 | ||
|
|
3e777246a0 | ||
|
|
737bb80af0 | ||
|
|
07155018ef | ||
|
|
b8c0939382 | ||
|
|
985d395ba3 | ||
|
|
9f8e899af7 | ||
|
|
5359ed5e4b | ||
|
|
081d176f24 | ||
|
|
0bfe72eec9 | ||
|
|
d417aa2fb9 | ||
|
|
d647fb3b4f | ||
|
|
ebf6300b06 | ||
|
|
3977f9aa53 | ||
|
|
8478194bb0 | ||
|
|
417c99cdb9 | ||
|
|
0e8849a382 | ||
|
|
dd9ccaf076 | ||
|
|
ff461d821c | ||
|
|
6d68165fb6 | ||
|
|
489fd23edb | ||
|
|
4b39d5b438 | ||
|
|
b5a5aa41c6 | ||
|
|
e878e08675 | ||
|
|
246a7f1922 | ||
|
|
c83921ca71 | ||
|
|
c9deae3d5c | ||
|
|
8184c10e93 | ||
|
|
98746cc8d1 | ||
|
|
79fe05eb9c | ||
|
|
b2dd46411a | ||
|
|
2c7dd23220 | ||
|
|
a873e3e29e | ||
|
|
6a3b984c6c | ||
|
|
ebbcf7c21e | ||
|
|
0526b26b4a | ||
|
|
c20dab43a6 | ||
|
|
918a859a74 | ||
|
|
b3d3902399 | ||
|
|
69e02b0886 | ||
|
|
74a602c34d | ||
|
|
710bb2d884 | ||
|
|
7396806fab | ||
|
|
a87044a2b9 | ||
|
|
0c54f747b9 | ||
|
|
d6955eaad7 | ||
|
|
5638720336 | ||
|
|
e33875e9f5 | ||
|
|
9532ca2442 | ||
|
|
47f59e1b63 | ||
|
|
b9195101da | ||
|
|
34a9424c29 | ||
|
|
54ce2a1c10 | ||
|
|
5166fb1f58 | ||
|
|
5e9434b7eb | ||
|
|
a7398e54e3 | ||
|
|
ac54e042ea | ||
|
|
4f17085a81 | ||
|
|
c864eb6e73 | ||
|
|
828aa8fd21 | ||
|
|
84615fad05 | ||
|
|
b90b50395c | ||
|
|
c27a23e5fe | ||
|
|
1b33ddb207 | ||
|
|
d68de45c3b | ||
|
|
5b46b39dac | ||
|
|
2d0201759d | ||
|
|
104788e2a4 | ||
|
|
4f1139a531 | ||
|
|
f673aad38e | ||
|
|
c8a8e1351c | ||
|
|
5d84b59bbd | ||
|
|
2a807702f4 | ||
|
|
448b9cb30c | ||
|
|
248dc3a1c9 | ||
|
|
cd76c0528e | ||
|
|
58e2febf64 | ||
|
|
0372b034f6 | ||
|
|
1d730a0ce5 | ||
|
|
1a629ee8d5 | ||
|
|
cd563ad1ce | ||
|
|
ec18b6349b | ||
|
|
4d7d87d62a | ||
|
|
15a021a58f | ||
|
|
63c85e6b96 | ||
|
|
6a94795a67 | ||
|
|
d302567369 | ||
|
|
f8d6a1543d | ||
|
|
6df5a68682 | ||
|
|
7e1cc36805 | ||
|
|
491ed21f98 | ||
|
|
e53cf5dab0 | ||
|
|
e853889247 | ||
|
|
19b0fe4052 | ||
|
|
d94d937d77 | ||
|
|
e5c1f0588a | ||
|
|
dd88ebe5da | ||
|
|
5536335ac9 | ||
|
|
df4fff6911 | ||
|
|
3dd83fde66 | ||
|
|
f50b1ececa | ||
|
|
ebee7b379e | ||
|
|
255db25f58 | ||
|
|
19050079d4 | ||
|
|
8d97f98a29 | ||
|
|
137ca5855e | ||
|
|
7707b48622 | ||
|
|
193546d1ed | ||
|
|
6703bca1d0 | ||
|
|
5739947586 | ||
|
|
5e1a7f2102 | ||
|
|
a0e574391b | ||
|
|
bd107d930a | ||
|
|
66f83732bb | ||
|
|
e796891d8e | ||
|
|
ba46bc9189 | ||
|
|
64ff369a90 | ||
|
|
92616429ba | ||
|
|
377383d672 | ||
|
|
52d405a6d6 | ||
|
|
2e1492c4fa | ||
|
|
16673df8cf | ||
|
|
cb4c26acfd | ||
|
|
fda7ca4574 | ||
|
|
8e2e8d1e82 | ||
|
|
4e36f47774 | ||
|
|
858dac73d0 | ||
|
|
3cccefb715 | ||
|
|
44640f33d2 | ||
|
|
2ae3b9bd8e | ||
|
|
2db991a371 | ||
|
|
2e52abd76c | ||
|
|
03c3acd214 | ||
|
|
c26b277c56 | ||
|
|
3f7fd40d17 | ||
|
|
0b01c0d236 | ||
|
|
3107b73430 | ||
|
|
5d421ae525 | ||
|
|
56a8495787 | ||
|
|
a12bc03dd7 | ||
|
|
6b1a65f8f4 | ||
|
|
9d94155480 | ||
|
|
3b46759134 | ||
|
|
8d21c653ae | ||
|
|
d983c44db7 | ||
|
|
467a1d92bb | ||
|
|
157d3e3e66 | ||
|
|
51bb320dce | ||
|
|
12c99c6857 | ||
|
|
62e905f336 | ||
|
|
9b5964a758 | ||
|
|
9c49a9c67d | ||
|
|
0a2461f4a5 | ||
|
|
49577ddbb6 | ||
|
|
6172b0c35f | ||
|
|
e7cc10692b | ||
|
|
221d2c717d | ||
|
|
2b54f742c5 | ||
|
|
f02eddcebe | ||
|
|
c25a5cef67 | ||
|
|
0f69ee951c | ||
|
|
fd6650db50 | ||
|
|
f2ad80665a | ||
|
|
cff9c94c27 | ||
|
|
b6fdc12820 | ||
|
|
01265faef9 | ||
|
|
a2feae891e | ||
|
|
bd24d4bcd1 | ||
|
|
0efbd9e23c | ||
|
|
4aab72fb10 | ||
|
|
aa266da5ac | ||
|
|
49987d55ce | ||
|
|
c6939efd70 | ||
|
|
f7f853f05e | ||
|
|
1faa540a70 | ||
|
|
1746c876bd | ||
|
|
cd0c015fea | ||
|
|
760b25b7a2 | ||
|
|
eccfad5615 | ||
|
|
27034e4bae | ||
|
|
99376c8fc2 | ||
|
|
17e7ba1ef2 | ||
|
|
38526890cc | ||
|
|
ae9b33d5f0 | ||
|
|
ff96812d26 | ||
|
|
0359a4b3dc | ||
|
|
f75dd3a800 | ||
|
|
a992dc56c5 | ||
|
|
576176e1cc | ||
|
|
1d3914ce86 | ||
|
|
b2f338cad8 | ||
|
|
74a329ca29 | ||
|
|
29ae1b4034 | ||
|
|
ae5cab9830 | ||
|
|
a986e588b5 | ||
|
|
8c84c1050f | ||
|
|
c3ded4d817 | ||
|
|
db32de68e3 | ||
|
|
f76f2ca393 | ||
|
|
8449257628 | ||
|
|
2bd3d0d290 | ||
|
|
117798a3f5 | ||
|
|
01392bcbf8 | ||
|
|
5a3478d916 | ||
|
|
f3b545fd90 | ||
|
|
e7a6a05a1b | ||
|
|
f65ff57a95 | ||
|
|
9a8f53e890 | ||
|
|
b7fd06413d | ||
|
|
a2b805f4e1 |
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -58,5 +58,5 @@ _If applicable, add screenshots/pictures to help explain your problem._
|
|||||||
_Add any other context about the problem here._
|
_Add any other context about the problem here._
|
||||||
_Please note here in case you are using ioBroker_
|
_Please note here in case you are using ioBroker_
|
||||||
|
|
||||||
### PANEL / FIRMWARE VERION
|
### PANEL / FIRMWARE VERSION
|
||||||
_Please add the Panel/Firmware Version you are using (EU, US-L or US-P)_
|
_Please add the Panel/Firmware Version you are using (EU, US-L or US-P)_
|
||||||
|
|||||||
2
.github/ISSUE_TEMPLATE/feature-request.md
vendored
2
.github/ISSUE_TEMPLATE/feature-request.md
vendored
@@ -24,5 +24,5 @@ _A clear and concise description of what the feature should do._
|
|||||||
### ADDITIONAL CONTEXT
|
### ADDITIONAL CONTEXT
|
||||||
_Add any other context about the problem here._
|
_Add any other context about the problem here._
|
||||||
|
|
||||||
### PANEL / FIRMWARE VERION
|
### PANEL / FIRMWARE VERSION
|
||||||
_Please add the Panel/Firmware Version you are using (EU, US-L or US-P)_
|
_Please add the Panel/Firmware Version you are using (EU, US-L or US-P)_
|
||||||
|
|||||||
8
.github/workflows/builder.yaml
vendored
8
.github/workflows/builder.yaml
vendored
@@ -21,7 +21,7 @@ jobs:
|
|||||||
changed: ${{ steps.changed_addons.outputs.changed }}
|
changed: ${{ steps.changed_addons.outputs.changed }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out the repository
|
- name: Check out the repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Get changed files
|
- name: Get changed files
|
||||||
id: changed_files
|
id: changed_files
|
||||||
@@ -68,7 +68,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Get information
|
- name: Get information
|
||||||
id: info
|
id: info
|
||||||
@@ -92,7 +92,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
if: env.BUILD_ARGS != '--test'
|
if: env.BUILD_ARGS != '--test'
|
||||||
uses: docker/login-action@v3.0.0
|
uses: docker/login-action@v3.7.0
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
@@ -100,7 +100,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Build ${{ matrix.addon }} add-on
|
- name: Build ${{ matrix.addon }} add-on
|
||||||
if: steps.check.outputs.build_arch == 'true'
|
if: steps.check.outputs.build_arch == 'true'
|
||||||
uses: home-assistant/builder@2024.01.0
|
uses: home-assistant/builder@2025.09.0
|
||||||
with:
|
with:
|
||||||
args: |
|
args: |
|
||||||
${{ env.BUILD_ARGS }} \
|
${{ env.BUILD_ARGS }} \
|
||||||
|
|||||||
8
.github/workflows/codeql-analysis.yml
vendored
8
.github/workflows/codeql-analysis.yml
vendored
@@ -43,11 +43,11 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v3
|
uses: github/codeql-action/init@v4
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
@@ -58,7 +58,7 @@ jobs:
|
|||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
# If this step fails, then you should remove it and run the build manually (see below)
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@v3
|
uses: github/codeql-action/autobuild@v4
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
# 📚 https://git.io/JvXDl
|
# 📚 https://git.io/JvXDl
|
||||||
@@ -72,4 +72,4 @@ jobs:
|
|||||||
# make release
|
# make release
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v3
|
uses: github/codeql-action/analyze@v4
|
||||||
|
|||||||
28
.github/workflows/docs-dev.yml
vendored
28
.github/workflows/docs-dev.yml
vendored
@@ -1,28 +0,0 @@
|
|||||||
name: docs-ci
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- dev
|
|
||||||
paths:
|
|
||||||
- docs/*
|
|
||||||
- .github/workflows/docs.yml
|
|
||||||
- mkdocs.yml
|
|
||||||
- HMI/README.md
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
deploy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: 3.x
|
|
||||||
- run: pip install mkdocs-material mkdocs-video markdown-include mike
|
|
||||||
- run: cp HMI/README.md docs/hmi-serial-protocol.md
|
|
||||||
- run: git config --global user.name Docs deploy
|
|
||||||
- run: git config --global user.email docs@dummy.bot.com
|
|
||||||
- run: mike deploy --push --update-aliases dev
|
|
||||||
43
.github/workflows/docs-release.yml
vendored
43
.github/workflows/docs-release.yml
vendored
@@ -6,24 +6,51 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths:
|
paths:
|
||||||
- docs/*
|
- docs/**
|
||||||
|
- docs-standalone/**
|
||||||
- .github/workflows/docs-release.yml
|
- .github/workflows/docs-release.yml
|
||||||
- mkdocs.yml
|
- mkdocs.yml
|
||||||
|
- docs-standalone/mkdocs.yml
|
||||||
- HMI/README.md
|
- HMI/README.md
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v6
|
||||||
with:
|
with:
|
||||||
python-version: 3.x
|
python-version: 3.x
|
||||||
- run: pip install mkdocs-material mkdocs-video markdown-include mike
|
- run: pip install zensical
|
||||||
- run: cp HMI/README.md docs/hmi-serial-protocol.md
|
- run: cp HMI/README.md docs/hmi-serial-protocol.md
|
||||||
- run: git config --global user.name Docs deploy
|
- run: zensical build --config-file mkdocs.yml
|
||||||
- run: git config --global user.email docs@dummy.bot.com
|
- run: mv site _site_main
|
||||||
- run: mike set-default stable
|
- run: zensical build --config-file docs-standalone/mkdocs.yml
|
||||||
- run: mike deploy --push --update-aliases stable
|
- run: mkdir -p _site/standalone _site/stable
|
||||||
|
- run: cp -a _site_main/. _site/
|
||||||
|
- run: cp -a _site_main/. _site/stable/
|
||||||
|
- run: |
|
||||||
|
if [ -d site-standalone ]; then
|
||||||
|
cp -a site-standalone/. _site/standalone/
|
||||||
|
elif [ -d docs-standalone/site ]; then
|
||||||
|
cp -a docs-standalone/site/. _site/standalone/
|
||||||
|
elif [ -d site ]; then
|
||||||
|
cp -a site/. _site/standalone/
|
||||||
|
elif [ -d docs-standalone/build ]; then
|
||||||
|
cp -a docs-standalone/build/. _site/standalone/
|
||||||
|
elif [ -d build ]; then
|
||||||
|
cp -a build/. _site/standalone/
|
||||||
|
else
|
||||||
|
echo "Standalone docs output not found (tried site-standalone, docs-standalone/site, site, docs-standalone/build, build)."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
- uses: peaceiris/actions-gh-pages@v4
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
publish_branch: gh-pages
|
||||||
|
publish_dir: _site
|
||||||
|
force_orphan: true
|
||||||
|
|||||||
2
.github/workflows/hacs-validation.yaml
vendored
2
.github/workflows/hacs-validation.yaml
vendored
@@ -11,7 +11,7 @@ jobs:
|
|||||||
name: HACS Action
|
name: HACS Action
|
||||||
runs-on: "ubuntu-latest"
|
runs-on: "ubuntu-latest"
|
||||||
steps:
|
steps:
|
||||||
- uses: "actions/checkout@v4"
|
- uses: "actions/checkout@v6"
|
||||||
- name: HACS Action
|
- name: HACS Action
|
||||||
uses: "hacs/action@main"
|
uses: "hacs/action@main"
|
||||||
with:
|
with:
|
||||||
|
|||||||
4
.github/workflows/iobroker-localization.yml
vendored
4
.github/workflows/iobroker-localization.yml
vendored
@@ -18,7 +18,7 @@ jobs:
|
|||||||
gen-ioBroker-localization:
|
gen-ioBroker-localization:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.head_ref }}
|
ref: ${{ github.head_ref }}
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ jobs:
|
|||||||
python HMI/code_gen/localization/iobroker.py
|
python HMI/code_gen/localization/iobroker.py
|
||||||
mv ioBroker_NSPanel_locales.json ioBroker/ioBroker_NSPanel_locales.json
|
mv ioBroker_NSPanel_locales.json ioBroker/ioBroker_NSPanel_locales.json
|
||||||
|
|
||||||
- uses: stefanzweifel/git-auto-commit-action@v5
|
- uses: stefanzweifel/git-auto-commit-action@v7
|
||||||
with:
|
with:
|
||||||
commit_message: Update iobroker localization file
|
commit_message: Update iobroker localization file
|
||||||
#file_pattern: "**.txt"
|
#file_pattern: "**.txt"
|
||||||
|
|||||||
6
.github/workflows/lint.yaml
vendored
6
.github/workflows/lint.yaml
vendored
@@ -18,7 +18,7 @@ jobs:
|
|||||||
addons: ${{ steps.addons.outputs.addons_list }}
|
addons: ${{ steps.addons.outputs.addons_list }}
|
||||||
steps:
|
steps:
|
||||||
- name: ⤵️ Check out code from GitHub
|
- name: ⤵️ Check out code from GitHub
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: 🔍 Find add-on directories
|
- name: 🔍 Find add-on directories
|
||||||
id: addons
|
id: addons
|
||||||
@@ -33,9 +33,9 @@ jobs:
|
|||||||
path: ${{ fromJson(needs.find.outputs.addons) }}
|
path: ${{ fromJson(needs.find.outputs.addons) }}
|
||||||
steps:
|
steps:
|
||||||
- name: ⤵️ Check out code from GitHub
|
- name: ⤵️ Check out code from GitHub
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: 🚀 Run Home Assistant Add-on Lint
|
- name: 🚀 Run Home Assistant Add-on Lint
|
||||||
uses: frenck/action-addon-linter@v2.15
|
uses: frenck/action-addon-linter@v2.21
|
||||||
with:
|
with:
|
||||||
path: "./${{ matrix.path }}"
|
path: "./${{ matrix.path }}"
|
||||||
|
|||||||
4
.github/workflows/nextion2text.yml
vendored
4
.github/workflows/nextion2text.yml
vendored
@@ -24,7 +24,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.head_ref }}
|
ref: ${{ github.head_ref }}
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ jobs:
|
|||||||
find -name "**.txt"
|
find -name "**.txt"
|
||||||
rm Nextion2Text.py* ignore-id.py out.txt
|
rm Nextion2Text.py* ignore-id.py out.txt
|
||||||
|
|
||||||
- uses: stefanzweifel/git-auto-commit-action@v5
|
- uses: stefanzweifel/git-auto-commit-action@v7
|
||||||
with:
|
with:
|
||||||
commit_message: ${{ steps.last-commit-message.outputs.msg }} (add nextion2text)
|
commit_message: ${{ steps.last-commit-message.outputs.msg }} (add nextion2text)
|
||||||
#file_pattern: "**.txt"
|
#file_pattern: "**.txt"
|
||||||
|
|||||||
29
.gitignore
vendored
29
.gitignore
vendored
@@ -6,4 +6,31 @@ HMI/Nextion2Text.py
|
|||||||
panels.yaml
|
panels.yaml
|
||||||
|
|
||||||
# don't add Webstorm project stuff
|
# don't add Webstorm project stuff
|
||||||
.idea
|
.idea
|
||||||
|
|
||||||
|
# General
|
||||||
|
.DS_Store
|
||||||
|
__MACOSX/
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
Icon[
|
||||||
|
]
|
||||||
|
|
||||||
|
# Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Files that might appear in the root of a volume
|
||||||
|
.DocumentRevisions-V100
|
||||||
|
.fseventsd
|
||||||
|
.Spotlight-V100
|
||||||
|
.TemporaryItems
|
||||||
|
.Trashes
|
||||||
|
.VolumeIcon.icns
|
||||||
|
.com.apple.timemachine.donotpresent
|
||||||
|
|
||||||
|
# Directories potentially created on remote AFP share
|
||||||
|
.AppleDB
|
||||||
|
.AppleDesktop
|
||||||
|
Network Trash Folder
|
||||||
|
Temporary Items
|
||||||
|
.apdisk
|
||||||
|
|||||||
@@ -1,17 +1,5 @@
|
|||||||
--- HMI/n2t-out
|
--- HMI/n2t-out
|
||||||
+++ HMI/US/landscape/n2t-out
|
+++ HMI/US/landscape/n2t-out
|
||||||
├── file list
|
|
||||||
│ @@ -1,10 +1,9 @@
|
|
||||||
│ Program.s.txt
|
|
||||||
│ cardAlarm.txt
|
|
||||||
│ -cardBurnRec.txt
|
|
||||||
│ cardChart.txt
|
|
||||||
│ cardEntities.txt
|
|
||||||
│ cardGrid.txt
|
|
||||||
│ cardGrid2.txt
|
|
||||||
│ cardLChart.txt
|
|
||||||
│ cardMedia.txt
|
|
||||||
│ cardPower.txt
|
|
||||||
│ --- HMI/n2t-out/Program.s.txt
|
│ --- HMI/n2t-out/Program.s.txt
|
||||||
├── +++ HMI/US/landscape/n2t-out/Program.s.txt
|
├── +++ HMI/US/landscape/n2t-out/Program.s.txt
|
||||||
│ @@ -13,10 +13,10 @@
|
│ @@ -13,10 +13,10 @@
|
||||||
@@ -114,6 +102,49 @@
|
|||||||
│ crcputs sys0,2
|
│ crcputs sys0,2
|
||||||
│ crcputs tSend.txt,0
|
│ crcputs tSend.txt,0
|
||||||
│ //send cmd
|
│ //send cmd
|
||||||
|
│ --- HMI/n2t-out/popupLight.txt
|
||||||
|
├── +++ HMI/US/landscape/n2t-out/popupLight.txt
|
||||||
|
│ @@ -453,19 +453,14 @@
|
||||||
|
│ ucopy strCommand.txt,4,payloadLength-5,0
|
||||||
|
│ // write instruction to tInstuction (debug output, but used as variable here, ui elements will be disabled by default)
|
||||||
|
│ spstr strCommand.txt,tInstruction.txt,"~",0
|
||||||
|
│ spstr strCommand.txt,tTmp.txt,"~",1
|
||||||
|
│ if(tInstruction.txt=="entityUpdateDetail"&&entn.txt==tTmp.txt)
|
||||||
|
│ {
|
||||||
|
│ // change icon
|
||||||
|
│ - spstr strCommand.txt,tTmp.txt,"~",2
|
||||||
|
│ - if(tTmp.txt!="")
|
||||||
|
│ - {
|
||||||
|
│ - tIcon1.txt=tTmp.txt
|
||||||
|
│ - }
|
||||||
|
│ //spstr strCommand.txt,tIcon1.txt,"~",2
|
||||||
|
│ vis tIcon1,1
|
||||||
|
│ // change icon color
|
||||||
|
│ spstr strCommand.txt,tTmp.txt,"~",3
|
||||||
|
│ covx tTmp.txt,sys0,0,0
|
||||||
|
│ tIcon1.pco=sys0
|
||||||
|
│ // get Button State
|
||||||
|
│ --- HMI/n2t-out/popupNotify.txt
|
||||||
|
├── +++ HMI/US/landscape/n2t-out/popupNotify.txt
|
||||||
|
│ @@ -439,18 +439,14 @@
|
||||||
|
│ {
|
||||||
|
│ page cardPower
|
||||||
|
│ }
|
||||||
|
│ if(tId.txt=="cardChart")
|
||||||
|
│ {
|
||||||
|
│ page cardChart
|
||||||
|
│ }
|
||||||
|
│ - if(tId.txt=="cardLChart")
|
||||||
|
│ - {
|
||||||
|
│ - page cardLChart
|
||||||
|
│ - }
|
||||||
|
│ }
|
||||||
|
│ // end of user code
|
||||||
|
│ udelete payloadLength-1
|
||||||
|
│ bufferPos=0
|
||||||
|
│ }
|
||||||
|
│ }
|
||||||
|
│ }
|
||||||
│ --- HMI/n2t-out/screensaver.txt
|
│ --- HMI/n2t-out/screensaver.txt
|
||||||
├── +++ HMI/US/landscape/n2t-out/screensaver.txt
|
├── +++ HMI/US/landscape/n2t-out/screensaver.txt
|
||||||
│ @@ -19,15 +19,14 @@
|
│ @@ -19,15 +19,14 @@
|
||||||
@@ -221,7 +252,7 @@
|
|||||||
│ vis p0,0
|
│ vis p0,0
|
||||||
│ vis tNotifyHead,0
|
│ vis tNotifyHead,0
|
||||||
│ vis tNotifyText,0
|
│ vis tNotifyText,0
|
||||||
│ @@ -41,17 +40,14 @@
|
│ @@ -41,52 +40,19 @@
|
||||||
│ }
|
│ }
|
||||||
│ tDate.txt=pageIcons.vaDate.txt
|
│ tDate.txt=pageIcons.vaDate.txt
|
||||||
│ dim=dimValue
|
│ dim=dimValue
|
||||||
@@ -232,14 +263,80 @@
|
|||||||
│ - Postinitialize Event
|
│ - Postinitialize Event
|
||||||
│ - click m0,1
|
│ - click m0,1
|
||||||
│ -
|
│ -
|
||||||
|
│ -Variable (string) entn1
|
||||||
|
│ - Attributes
|
||||||
|
│ - Scope : local
|
||||||
|
│ - Text :
|
||||||
|
│ - Max. Text Size: 14
|
||||||
|
│ -
|
||||||
|
│ -Variable (string) entn2
|
||||||
|
│ - Attributes
|
||||||
|
│ - Scope : local
|
||||||
|
│ - Text :
|
||||||
|
│ - Max. Text Size: 14
|
||||||
|
│ -
|
||||||
|
│ -Variable (string) entn3
|
||||||
|
│ - Attributes
|
||||||
|
│ - Scope : local
|
||||||
|
│ - Text :
|
||||||
|
│ - Max. Text Size: 14
|
||||||
|
│ -
|
||||||
|
│ -Variable (string) entn4
|
||||||
|
│ - Attributes
|
||||||
|
│ - Scope : local
|
||||||
|
│ - Text :
|
||||||
|
│ - Max. Text Size: 14
|
||||||
|
│ -
|
||||||
|
│ -Variable (string) entn5
|
||||||
|
│ - Attributes
|
||||||
|
│ - Scope : local
|
||||||
|
│ - Text :
|
||||||
|
│ - Max. Text Size: 14
|
||||||
|
│ -
|
||||||
│ Variable (string) strCommand
|
│ Variable (string) strCommand
|
||||||
│ Attributes
|
│ Attributes
|
||||||
│ Scope : local
|
│ Scope : local
|
||||||
│ Text :
|
│ Text :
|
||||||
│ Max. Text Size: 1979
|
│ - Max. Text Size: 1935
|
||||||
|
│ + Max. Text Size: 1979
|
||||||
│
|
│
|
||||||
│ Variable (string) strTmp
|
│ Variable (string) strTmp
|
||||||
│ @@ -376,34 +372,14 @@
|
│ Attributes
|
||||||
|
│ Scope : local
|
||||||
|
│ Text :
|
||||||
|
│ Max. Text Size: 2
|
||||||
|
│
|
||||||
|
│ @@ -96,27 +62,27 @@
|
||||||
|
│ Text :
|
||||||
|
│ Max. Text Size: 25
|
||||||
|
│
|
||||||
|
│ Variable (string) tInstruction
|
||||||
|
│ Attributes
|
||||||
|
│ Scope : local
|
||||||
|
│ Text :
|
||||||
|
│ - Max. Text Size: 15
|
||||||
|
│ + Max. Text Size: 50
|
||||||
|
│
|
||||||
|
│ Variable (string) tSend
|
||||||
|
│ Attributes
|
||||||
|
│ Scope : local
|
||||||
|
│ Text :
|
||||||
|
│ Max. Text Size: 50
|
||||||
|
│
|
||||||
|
│ Variable (string) tTmp
|
||||||
|
│ Attributes
|
||||||
|
│ Scope : local
|
||||||
|
│ Text :
|
||||||
|
│ - Max. Text Size: 30
|
||||||
|
│ + Max. Text Size: 50
|
||||||
|
│
|
||||||
|
│ Variable (int32) vaTap
|
||||||
|
│ Attributes
|
||||||
|
│ Scope: local
|
||||||
|
│ Value: 0
|
||||||
|
│
|
||||||
|
│ Variable (int32) xc1
|
||||||
|
│ @@ -370,165 +336,50 @@
|
||||||
│ Scope : local
|
│ Scope : local
|
||||||
│ Dragging : 0
|
│ Dragging : 0
|
||||||
│ Send Component ID : disabled
|
│ Send Component ID : disabled
|
||||||
@@ -247,6 +344,137 @@
|
|||||||
│ Text :
|
│ Text :
|
||||||
│ Max. Text Size : 4
|
│ Max. Text Size : 4
|
||||||
│
|
│
|
||||||
|
│ - Events
|
||||||
|
│ - Touch Press Event
|
||||||
|
│ - tSend.txt="event,buttonPress2,"+entn1.txt+",button"
|
||||||
|
│ - if(entn1.txt=="")
|
||||||
|
│ - {
|
||||||
|
│ - tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
│ - }
|
||||||
|
│ - //send calc crc
|
||||||
|
│ - btlen tSend.txt,sys0
|
||||||
|
│ - crcrest 1,0xffff // reset CRC
|
||||||
|
│ - crcputh 55 bb
|
||||||
|
│ - crcputs sys0,2
|
||||||
|
│ - crcputs tSend.txt,0
|
||||||
|
│ - //send cmd
|
||||||
|
│ - printh 55 bb
|
||||||
|
│ - prints sys0,2
|
||||||
|
│ - prints tSend.txt,0
|
||||||
|
│ - prints crcval,2
|
||||||
|
│ -
|
||||||
|
│ Text f2Icon
|
||||||
|
│ Attributes
|
||||||
|
│ Scope : local
|
||||||
|
│ Dragging : 0
|
||||||
|
│ Send Component ID : disabled
|
||||||
|
│ Associated Keyboard: none
|
||||||
|
│ Text :
|
||||||
|
│ Max. Text Size : 4
|
||||||
|
│
|
||||||
|
│ - Events
|
||||||
|
│ - Touch Press Event
|
||||||
|
│ - tSend.txt="event,buttonPress2,"+entn2.txt+",button"
|
||||||
|
│ - if(entn2.txt=="")
|
||||||
|
│ - {
|
||||||
|
│ - tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
│ - }
|
||||||
|
│ - //send calc crc
|
||||||
|
│ - btlen tSend.txt,sys0
|
||||||
|
│ - crcrest 1,0xffff // reset CRC
|
||||||
|
│ - crcputh 55 bb
|
||||||
|
│ - crcputs sys0,2
|
||||||
|
│ - crcputs tSend.txt,0
|
||||||
|
│ - //send cmd
|
||||||
|
│ - printh 55 bb
|
||||||
|
│ - prints sys0,2
|
||||||
|
│ - prints tSend.txt,0
|
||||||
|
│ - prints crcval,2
|
||||||
|
│ -
|
||||||
|
│ Text f3Icon
|
||||||
|
│ Attributes
|
||||||
|
│ Scope : local
|
||||||
|
│ Dragging : 0
|
||||||
|
│ Send Component ID : disabled
|
||||||
|
│ Associated Keyboard: none
|
||||||
|
│ Text :
|
||||||
|
│ Max. Text Size : 4
|
||||||
|
│
|
||||||
|
│ - Events
|
||||||
|
│ - Touch Press Event
|
||||||
|
│ - tSend.txt="event,buttonPress2,"+entn3.txt+",button"
|
||||||
|
│ - if(entn3.txt=="")
|
||||||
|
│ - {
|
||||||
|
│ - tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
│ - }
|
||||||
|
│ - //send calc crc
|
||||||
|
│ - btlen tSend.txt,sys0
|
||||||
|
│ - crcrest 1,0xffff // reset CRC
|
||||||
|
│ - crcputh 55 bb
|
||||||
|
│ - crcputs sys0,2
|
||||||
|
│ - crcputs tSend.txt,0
|
||||||
|
│ - //send cmd
|
||||||
|
│ - printh 55 bb
|
||||||
|
│ - prints sys0,2
|
||||||
|
│ - prints tSend.txt,0
|
||||||
|
│ - prints crcval,2
|
||||||
|
│ -
|
||||||
|
│ Text f4Icon
|
||||||
|
│ Attributes
|
||||||
|
│ Scope : local
|
||||||
|
│ Dragging : 0
|
||||||
|
│ Send Component ID : disabled
|
||||||
|
│ Associated Keyboard: none
|
||||||
|
│ Text :
|
||||||
|
│ Max. Text Size : 4
|
||||||
|
│
|
||||||
|
│ - Events
|
||||||
|
│ - Touch Press Event
|
||||||
|
│ - tSend.txt="event,buttonPress2,"+entn4.txt+",button"
|
||||||
|
│ - if(entn4.txt=="")
|
||||||
|
│ - {
|
||||||
|
│ - tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
│ - }
|
||||||
|
│ - //send calc crc
|
||||||
|
│ - btlen tSend.txt,sys0
|
||||||
|
│ - crcrest 1,0xffff // reset CRC
|
||||||
|
│ - crcputh 55 bb
|
||||||
|
│ - crcputs sys0,2
|
||||||
|
│ - crcputs tSend.txt,0
|
||||||
|
│ - //send cmd
|
||||||
|
│ - printh 55 bb
|
||||||
|
│ - prints sys0,2
|
||||||
|
│ - prints tSend.txt,0
|
||||||
|
│ - prints crcval,2
|
||||||
|
│ -
|
||||||
|
│ Text f5Icon
|
||||||
|
│ Attributes
|
||||||
|
│ Scope : local
|
||||||
|
│ Dragging : 0
|
||||||
|
│ Send Component ID : disabled
|
||||||
|
│ Associated Keyboard: none
|
||||||
|
│ Text :
|
||||||
|
│ Max. Text Size : 4
|
||||||
|
│
|
||||||
|
│ - Events
|
||||||
|
│ - Touch Press Event
|
||||||
|
│ - tSend.txt="event,buttonPress2,"+entn5.txt+",button"
|
||||||
|
│ - if(entn5.txt=="")
|
||||||
|
│ - {
|
||||||
|
│ - tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
│ - }
|
||||||
|
│ - //send calc crc
|
||||||
|
│ - btlen tSend.txt,sys0
|
||||||
|
│ - crcrest 1,0xffff // reset CRC
|
||||||
|
│ - crcputh 55 bb
|
||||||
|
│ - crcputs sys0,2
|
||||||
|
│ - crcputs tSend.txt,0
|
||||||
|
│ - //send cmd
|
||||||
|
│ - printh 55 bb
|
||||||
|
│ - prints sys0,2
|
||||||
|
│ - prints tSend.txt,0
|
||||||
|
│ - prints crcval,2
|
||||||
|
│ -
|
||||||
│ -Text m0
|
│ -Text m0
|
||||||
│ - Attributes
|
│ - Attributes
|
||||||
│ - Scope : local
|
│ - Scope : local
|
||||||
@@ -274,7 +502,7 @@
|
|||||||
│ Send Component ID : disabled
|
│ Send Component ID : disabled
|
||||||
│ Associated Keyboard: none
|
│ Associated Keyboard: none
|
||||||
│ Text : PM
|
│ Text : PM
|
||||||
│ @@ -585,15 +561,14 @@
|
│ @@ -710,15 +561,14 @@
|
||||||
│ if(tTmp.txt!="")
|
│ if(tTmp.txt!="")
|
||||||
│ {
|
│ {
|
||||||
│ covx tTmp.txt,defaultFontColor,0,0
|
│ covx tTmp.txt,defaultFontColor,0,0
|
||||||
@@ -290,3 +518,48 @@
|
|||||||
│ if(tAMPM.txt=="")
|
│ if(tAMPM.txt=="")
|
||||||
│ {
|
│ {
|
||||||
│ vis tAMPM,0
|
│ vis tAMPM,0
|
||||||
|
│ @@ -839,44 +689,34 @@
|
||||||
|
│ //e6Val
|
||||||
|
│ spstr strCommand.txt,e6Val.txt,"~",60
|
||||||
|
│ //f1Icon
|
||||||
|
│ spstr strCommand.txt,f1Icon.txt,"~",63
|
||||||
|
│ //f1Icon Color
|
||||||
|
│ spstr strCommand.txt,tTmp.txt,"~",64
|
||||||
|
│ covx tTmp.txt,f1Icon.pco,0,0
|
||||||
|
│ - //f1Icon intNameEntity
|
||||||
|
│ - spstr strCommand.txt,entn1.txt,"~",62
|
||||||
|
│ //f2Icon
|
||||||
|
│ spstr strCommand.txt,f2Icon.txt,"~",69
|
||||||
|
│ //f2Icon Color
|
||||||
|
│ spstr strCommand.txt,tTmp.txt,"~",70
|
||||||
|
│ covx tTmp.txt,f2Icon.pco,0,0
|
||||||
|
│ - //f2Icon intNameEntity
|
||||||
|
│ - spstr strCommand.txt,entn2.txt,"~",68
|
||||||
|
│ //f3Icon
|
||||||
|
│ spstr strCommand.txt,f3Icon.txt,"~",75
|
||||||
|
│ //f3Icon Color
|
||||||
|
│ spstr strCommand.txt,tTmp.txt,"~",76
|
||||||
|
│ covx tTmp.txt,f3Icon.pco,0,0
|
||||||
|
│ - //f3Icon intNameEntity
|
||||||
|
│ - spstr strCommand.txt,entn3.txt,"~",74
|
||||||
|
│ //f4Icon
|
||||||
|
│ spstr strCommand.txt,f4Icon.txt,"~",81
|
||||||
|
│ //f4Icon Color
|
||||||
|
│ spstr strCommand.txt,tTmp.txt,"~",82
|
||||||
|
│ covx tTmp.txt,f4Icon.pco,0,0
|
||||||
|
│ - //f4Icon intNameEntity
|
||||||
|
│ - spstr strCommand.txt,entn4.txt,"~",80
|
||||||
|
│ //f5Icon
|
||||||
|
│ spstr strCommand.txt,f5Icon.txt,"~",87
|
||||||
|
│ //f5Icon Color
|
||||||
|
│ spstr strCommand.txt,tTmp.txt,"~",88
|
||||||
|
│ covx tTmp.txt,f5Icon.pco,0,0
|
||||||
|
│ - //f5Icon intNameEntity
|
||||||
|
│ - spstr strCommand.txt,entn5.txt,"~",86
|
||||||
|
│ }
|
||||||
|
│ if(tInstruction.txt=="notify")
|
||||||
|
│ {
|
||||||
|
│ spstr strCommand.txt,tNotifyHead.txt,"~",1
|
||||||
|
│ spstr strCommand.txt,tNotifyText.txt,"~",2
|
||||||
|
│ if(tNotifyHead.txt!=""||tNotifyText.txt!="")
|
||||||
|
│ {
|
||||||
|
|||||||
@@ -1,17 +1,5 @@
|
|||||||
--- HMI/n2t-out
|
--- HMI/n2t-out
|
||||||
+++ HMI/US/portrait/n2t-out
|
+++ HMI/US/portrait/n2t-out
|
||||||
├── file list
|
|
||||||
│ @@ -1,10 +1,9 @@
|
|
||||||
│ Program.s.txt
|
|
||||||
│ cardAlarm.txt
|
|
||||||
│ -cardBurnRec.txt
|
|
||||||
│ cardChart.txt
|
|
||||||
│ cardEntities.txt
|
|
||||||
│ cardGrid.txt
|
|
||||||
│ cardGrid2.txt
|
|
||||||
│ cardLChart.txt
|
|
||||||
│ cardMedia.txt
|
|
||||||
│ cardPower.txt
|
|
||||||
│ --- HMI/n2t-out/Program.s.txt
|
│ --- HMI/n2t-out/Program.s.txt
|
||||||
├── +++ HMI/US/portrait/n2t-out/Program.s.txt
|
├── +++ HMI/US/portrait/n2t-out/Program.s.txt
|
||||||
│ @@ -12,11 +12,11 @@
|
│ @@ -12,11 +12,11 @@
|
||||||
@@ -1997,6 +1985,26 @@
|
|||||||
│ Variable (string) entn
|
│ Variable (string) entn
|
||||||
│ Attributes
|
│ Attributes
|
||||||
│ Scope : local
|
│ Scope : local
|
||||||
|
│ @@ -453,19 +453,14 @@
|
||||||
|
│ ucopy strCommand.txt,4,payloadLength-5,0
|
||||||
|
│ // write instruction to tInstuction (debug output, but used as variable here, ui elements will be disabled by default)
|
||||||
|
│ spstr strCommand.txt,tInstruction.txt,"~",0
|
||||||
|
│ spstr strCommand.txt,tTmp.txt,"~",1
|
||||||
|
│ if(tInstruction.txt=="entityUpdateDetail"&&entn.txt==tTmp.txt)
|
||||||
|
│ {
|
||||||
|
│ // change icon
|
||||||
|
│ - spstr strCommand.txt,tTmp.txt,"~",2
|
||||||
|
│ - if(tTmp.txt!="")
|
||||||
|
│ - {
|
||||||
|
│ - tIcon1.txt=tTmp.txt
|
||||||
|
│ - }
|
||||||
|
│ //spstr strCommand.txt,tIcon1.txt,"~",2
|
||||||
|
│ vis tIcon1,1
|
||||||
|
│ // change icon color
|
||||||
|
│ spstr strCommand.txt,tTmp.txt,"~",3
|
||||||
|
│ covx tTmp.txt,sys0,0,0
|
||||||
|
│ tIcon1.pco=sys0
|
||||||
|
│ // get Button State
|
||||||
│ --- HMI/n2t-out/popupNotify.txt
|
│ --- HMI/n2t-out/popupNotify.txt
|
||||||
├── +++ HMI/US/portrait/n2t-out/popupNotify.txt
|
├── +++ HMI/US/portrait/n2t-out/popupNotify.txt
|
||||||
│ @@ -348,15 +348,15 @@
|
│ @@ -348,15 +348,15 @@
|
||||||
@@ -2016,6 +2024,25 @@
|
|||||||
│ }
|
│ }
|
||||||
│ if(tInstruction.txt=="exitPopup")
|
│ if(tInstruction.txt=="exitPopup")
|
||||||
│ {
|
│ {
|
||||||
|
│ @@ -439,18 +439,14 @@
|
||||||
|
│ {
|
||||||
|
│ page cardPower
|
||||||
|
│ }
|
||||||
|
│ if(tId.txt=="cardChart")
|
||||||
|
│ {
|
||||||
|
│ page cardChart
|
||||||
|
│ }
|
||||||
|
│ - if(tId.txt=="cardLChart")
|
||||||
|
│ - {
|
||||||
|
│ - page cardLChart
|
||||||
|
│ - }
|
||||||
|
│ }
|
||||||
|
│ // end of user code
|
||||||
|
│ udelete payloadLength-1
|
||||||
|
│ bufferPos=0
|
||||||
|
│ }
|
||||||
|
│ }
|
||||||
|
│ }
|
||||||
│ --- HMI/n2t-out/screensaver.txt
|
│ --- HMI/n2t-out/screensaver.txt
|
||||||
├── +++ HMI/US/portrait/n2t-out/screensaver.txt
|
├── +++ HMI/US/portrait/n2t-out/screensaver.txt
|
||||||
│ @@ -7,27 +7,14 @@
|
│ @@ -7,27 +7,14 @@
|
||||||
@@ -2168,7 +2195,7 @@
|
|||||||
│ vis p0,0
|
│ vis p0,0
|
||||||
│ vis tNotifyHead,0
|
│ vis tNotifyHead,0
|
||||||
│ vis tNotifyText,0
|
│ vis tNotifyText,0
|
||||||
│ @@ -41,17 +28,14 @@
|
│ @@ -41,52 +28,19 @@
|
||||||
│ }
|
│ }
|
||||||
│ tDate.txt=pageIcons.vaDate.txt
|
│ tDate.txt=pageIcons.vaDate.txt
|
||||||
│ dim=dimValue
|
│ dim=dimValue
|
||||||
@@ -2179,14 +2206,80 @@
|
|||||||
│ - Postinitialize Event
|
│ - Postinitialize Event
|
||||||
│ - click m0,1
|
│ - click m0,1
|
||||||
│ -
|
│ -
|
||||||
|
│ -Variable (string) entn1
|
||||||
|
│ - Attributes
|
||||||
|
│ - Scope : local
|
||||||
|
│ - Text :
|
||||||
|
│ - Max. Text Size: 14
|
||||||
|
│ -
|
||||||
|
│ -Variable (string) entn2
|
||||||
|
│ - Attributes
|
||||||
|
│ - Scope : local
|
||||||
|
│ - Text :
|
||||||
|
│ - Max. Text Size: 14
|
||||||
|
│ -
|
||||||
|
│ -Variable (string) entn3
|
||||||
|
│ - Attributes
|
||||||
|
│ - Scope : local
|
||||||
|
│ - Text :
|
||||||
|
│ - Max. Text Size: 14
|
||||||
|
│ -
|
||||||
|
│ -Variable (string) entn4
|
||||||
|
│ - Attributes
|
||||||
|
│ - Scope : local
|
||||||
|
│ - Text :
|
||||||
|
│ - Max. Text Size: 14
|
||||||
|
│ -
|
||||||
|
│ -Variable (string) entn5
|
||||||
|
│ - Attributes
|
||||||
|
│ - Scope : local
|
||||||
|
│ - Text :
|
||||||
|
│ - Max. Text Size: 14
|
||||||
|
│ -
|
||||||
│ Variable (string) strCommand
|
│ Variable (string) strCommand
|
||||||
│ Attributes
|
│ Attributes
|
||||||
│ Scope : local
|
│ Scope : local
|
||||||
│ Text :
|
│ Text :
|
||||||
│ Max. Text Size: 1979
|
│ - Max. Text Size: 1935
|
||||||
|
│ + Max. Text Size: 1979
|
||||||
│
|
│
|
||||||
│ Variable (string) strTmp
|
│ Variable (string) strTmp
|
||||||
│ @@ -376,34 +360,14 @@
|
│ Attributes
|
||||||
|
│ Scope : local
|
||||||
|
│ Text :
|
||||||
|
│ Max. Text Size: 2
|
||||||
|
│
|
||||||
|
│ @@ -96,27 +50,27 @@
|
||||||
|
│ Text :
|
||||||
|
│ Max. Text Size: 25
|
||||||
|
│
|
||||||
|
│ Variable (string) tInstruction
|
||||||
|
│ Attributes
|
||||||
|
│ Scope : local
|
||||||
|
│ Text :
|
||||||
|
│ - Max. Text Size: 15
|
||||||
|
│ + Max. Text Size: 50
|
||||||
|
│
|
||||||
|
│ Variable (string) tSend
|
||||||
|
│ Attributes
|
||||||
|
│ Scope : local
|
||||||
|
│ Text :
|
||||||
|
│ Max. Text Size: 50
|
||||||
|
│
|
||||||
|
│ Variable (string) tTmp
|
||||||
|
│ Attributes
|
||||||
|
│ Scope : local
|
||||||
|
│ Text :
|
||||||
|
│ - Max. Text Size: 30
|
||||||
|
│ + Max. Text Size: 50
|
||||||
|
│
|
||||||
|
│ Variable (int32) vaTap
|
||||||
|
│ Attributes
|
||||||
|
│ Scope: local
|
||||||
|
│ Value: 0
|
||||||
|
│
|
||||||
|
│ Variable (int32) xc1
|
||||||
|
│ @@ -370,165 +324,50 @@
|
||||||
│ Scope : local
|
│ Scope : local
|
||||||
│ Dragging : 0
|
│ Dragging : 0
|
||||||
│ Send Component ID : disabled
|
│ Send Component ID : disabled
|
||||||
@@ -2194,6 +2287,137 @@
|
|||||||
│ Text :
|
│ Text :
|
||||||
│ Max. Text Size : 4
|
│ Max. Text Size : 4
|
||||||
│
|
│
|
||||||
|
│ - Events
|
||||||
|
│ - Touch Press Event
|
||||||
|
│ - tSend.txt="event,buttonPress2,"+entn1.txt+",button"
|
||||||
|
│ - if(entn1.txt=="")
|
||||||
|
│ - {
|
||||||
|
│ - tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
│ - }
|
||||||
|
│ - //send calc crc
|
||||||
|
│ - btlen tSend.txt,sys0
|
||||||
|
│ - crcrest 1,0xffff // reset CRC
|
||||||
|
│ - crcputh 55 bb
|
||||||
|
│ - crcputs sys0,2
|
||||||
|
│ - crcputs tSend.txt,0
|
||||||
|
│ - //send cmd
|
||||||
|
│ - printh 55 bb
|
||||||
|
│ - prints sys0,2
|
||||||
|
│ - prints tSend.txt,0
|
||||||
|
│ - prints crcval,2
|
||||||
|
│ -
|
||||||
|
│ Text f2Icon
|
||||||
|
│ Attributes
|
||||||
|
│ Scope : local
|
||||||
|
│ Dragging : 0
|
||||||
|
│ Send Component ID : disabled
|
||||||
|
│ Associated Keyboard: none
|
||||||
|
│ Text :
|
||||||
|
│ Max. Text Size : 4
|
||||||
|
│
|
||||||
|
│ - Events
|
||||||
|
│ - Touch Press Event
|
||||||
|
│ - tSend.txt="event,buttonPress2,"+entn2.txt+",button"
|
||||||
|
│ - if(entn2.txt=="")
|
||||||
|
│ - {
|
||||||
|
│ - tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
│ - }
|
||||||
|
│ - //send calc crc
|
||||||
|
│ - btlen tSend.txt,sys0
|
||||||
|
│ - crcrest 1,0xffff // reset CRC
|
||||||
|
│ - crcputh 55 bb
|
||||||
|
│ - crcputs sys0,2
|
||||||
|
│ - crcputs tSend.txt,0
|
||||||
|
│ - //send cmd
|
||||||
|
│ - printh 55 bb
|
||||||
|
│ - prints sys0,2
|
||||||
|
│ - prints tSend.txt,0
|
||||||
|
│ - prints crcval,2
|
||||||
|
│ -
|
||||||
|
│ Text f3Icon
|
||||||
|
│ Attributes
|
||||||
|
│ Scope : local
|
||||||
|
│ Dragging : 0
|
||||||
|
│ Send Component ID : disabled
|
||||||
|
│ Associated Keyboard: none
|
||||||
|
│ Text :
|
||||||
|
│ Max. Text Size : 4
|
||||||
|
│
|
||||||
|
│ - Events
|
||||||
|
│ - Touch Press Event
|
||||||
|
│ - tSend.txt="event,buttonPress2,"+entn3.txt+",button"
|
||||||
|
│ - if(entn3.txt=="")
|
||||||
|
│ - {
|
||||||
|
│ - tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
│ - }
|
||||||
|
│ - //send calc crc
|
||||||
|
│ - btlen tSend.txt,sys0
|
||||||
|
│ - crcrest 1,0xffff // reset CRC
|
||||||
|
│ - crcputh 55 bb
|
||||||
|
│ - crcputs sys0,2
|
||||||
|
│ - crcputs tSend.txt,0
|
||||||
|
│ - //send cmd
|
||||||
|
│ - printh 55 bb
|
||||||
|
│ - prints sys0,2
|
||||||
|
│ - prints tSend.txt,0
|
||||||
|
│ - prints crcval,2
|
||||||
|
│ -
|
||||||
|
│ Text f4Icon
|
||||||
|
│ Attributes
|
||||||
|
│ Scope : local
|
||||||
|
│ Dragging : 0
|
||||||
|
│ Send Component ID : disabled
|
||||||
|
│ Associated Keyboard: none
|
||||||
|
│ Text :
|
||||||
|
│ Max. Text Size : 4
|
||||||
|
│
|
||||||
|
│ - Events
|
||||||
|
│ - Touch Press Event
|
||||||
|
│ - tSend.txt="event,buttonPress2,"+entn4.txt+",button"
|
||||||
|
│ - if(entn4.txt=="")
|
||||||
|
│ - {
|
||||||
|
│ - tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
│ - }
|
||||||
|
│ - //send calc crc
|
||||||
|
│ - btlen tSend.txt,sys0
|
||||||
|
│ - crcrest 1,0xffff // reset CRC
|
||||||
|
│ - crcputh 55 bb
|
||||||
|
│ - crcputs sys0,2
|
||||||
|
│ - crcputs tSend.txt,0
|
||||||
|
│ - //send cmd
|
||||||
|
│ - printh 55 bb
|
||||||
|
│ - prints sys0,2
|
||||||
|
│ - prints tSend.txt,0
|
||||||
|
│ - prints crcval,2
|
||||||
|
│ -
|
||||||
|
│ Text f5Icon
|
||||||
|
│ Attributes
|
||||||
|
│ Scope : local
|
||||||
|
│ Dragging : 0
|
||||||
|
│ Send Component ID : disabled
|
||||||
|
│ Associated Keyboard: none
|
||||||
|
│ Text :
|
||||||
|
│ Max. Text Size : 4
|
||||||
|
│
|
||||||
|
│ - Events
|
||||||
|
│ - Touch Press Event
|
||||||
|
│ - tSend.txt="event,buttonPress2,"+entn5.txt+",button"
|
||||||
|
│ - if(entn5.txt=="")
|
||||||
|
│ - {
|
||||||
|
│ - tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
│ - }
|
||||||
|
│ - //send calc crc
|
||||||
|
│ - btlen tSend.txt,sys0
|
||||||
|
│ - crcrest 1,0xffff // reset CRC
|
||||||
|
│ - crcputh 55 bb
|
||||||
|
│ - crcputs sys0,2
|
||||||
|
│ - crcputs tSend.txt,0
|
||||||
|
│ - //send cmd
|
||||||
|
│ - printh 55 bb
|
||||||
|
│ - prints sys0,2
|
||||||
|
│ - prints tSend.txt,0
|
||||||
|
│ - prints crcval,2
|
||||||
|
│ -
|
||||||
│ -Text m0
|
│ -Text m0
|
||||||
│ - Attributes
|
│ - Attributes
|
||||||
│ - Scope : local
|
│ - Scope : local
|
||||||
@@ -2221,7 +2445,7 @@
|
|||||||
│ Send Component ID : disabled
|
│ Send Component ID : disabled
|
||||||
│ Associated Keyboard: none
|
│ Associated Keyboard: none
|
||||||
│ Text : PM
|
│ Text : PM
|
||||||
│ @@ -585,15 +549,14 @@
|
│ @@ -710,15 +549,14 @@
|
||||||
│ if(tTmp.txt!="")
|
│ if(tTmp.txt!="")
|
||||||
│ {
|
│ {
|
||||||
│ covx tTmp.txt,defaultFontColor,0,0
|
│ covx tTmp.txt,defaultFontColor,0,0
|
||||||
@@ -2237,3 +2461,48 @@
|
|||||||
│ if(tAMPM.txt=="")
|
│ if(tAMPM.txt=="")
|
||||||
│ {
|
│ {
|
||||||
│ vis tAMPM,0
|
│ vis tAMPM,0
|
||||||
|
│ @@ -839,44 +677,34 @@
|
||||||
|
│ //e6Val
|
||||||
|
│ spstr strCommand.txt,e6Val.txt,"~",60
|
||||||
|
│ //f1Icon
|
||||||
|
│ spstr strCommand.txt,f1Icon.txt,"~",63
|
||||||
|
│ //f1Icon Color
|
||||||
|
│ spstr strCommand.txt,tTmp.txt,"~",64
|
||||||
|
│ covx tTmp.txt,f1Icon.pco,0,0
|
||||||
|
│ - //f1Icon intNameEntity
|
||||||
|
│ - spstr strCommand.txt,entn1.txt,"~",62
|
||||||
|
│ //f2Icon
|
||||||
|
│ spstr strCommand.txt,f2Icon.txt,"~",69
|
||||||
|
│ //f2Icon Color
|
||||||
|
│ spstr strCommand.txt,tTmp.txt,"~",70
|
||||||
|
│ covx tTmp.txt,f2Icon.pco,0,0
|
||||||
|
│ - //f2Icon intNameEntity
|
||||||
|
│ - spstr strCommand.txt,entn2.txt,"~",68
|
||||||
|
│ //f3Icon
|
||||||
|
│ spstr strCommand.txt,f3Icon.txt,"~",75
|
||||||
|
│ //f3Icon Color
|
||||||
|
│ spstr strCommand.txt,tTmp.txt,"~",76
|
||||||
|
│ covx tTmp.txt,f3Icon.pco,0,0
|
||||||
|
│ - //f3Icon intNameEntity
|
||||||
|
│ - spstr strCommand.txt,entn3.txt,"~",74
|
||||||
|
│ //f4Icon
|
||||||
|
│ spstr strCommand.txt,f4Icon.txt,"~",81
|
||||||
|
│ //f4Icon Color
|
||||||
|
│ spstr strCommand.txt,tTmp.txt,"~",82
|
||||||
|
│ covx tTmp.txt,f4Icon.pco,0,0
|
||||||
|
│ - //f4Icon intNameEntity
|
||||||
|
│ - spstr strCommand.txt,entn4.txt,"~",80
|
||||||
|
│ //f5Icon
|
||||||
|
│ spstr strCommand.txt,f5Icon.txt,"~",87
|
||||||
|
│ //f5Icon Color
|
||||||
|
│ spstr strCommand.txt,tTmp.txt,"~",88
|
||||||
|
│ covx tTmp.txt,f5Icon.pco,0,0
|
||||||
|
│ - //f5Icon intNameEntity
|
||||||
|
│ - spstr strCommand.txt,entn5.txt,"~",86
|
||||||
|
│ }
|
||||||
|
│ if(tInstruction.txt=="notify")
|
||||||
|
│ {
|
||||||
|
│ spstr strCommand.txt,tNotifyHead.txt,"~",1
|
||||||
|
│ spstr strCommand.txt,tNotifyText.txt,"~",2
|
||||||
|
│ if(tNotifyHead.txt!=""||tNotifyText.txt!="")
|
||||||
|
│ {
|
||||||
|
|||||||
@@ -1,16 +1,4 @@
|
|||||||
+++ /dev/fd/62 2023-11-27 23:28:52.512823638 +0000
|
+++ /dev/fd/62 2025-12-26 19:43:25.803166597 +0000
|
||||||
+le list
|
|
||||||
+ +1,9 @@
|
|
||||||
+.s.txt
|
|
||||||
+rm.txt
|
|
||||||
+nRec.txt
|
|
||||||
+rt.txt
|
|
||||||
+ities.txt
|
|
||||||
+d.txt
|
|
||||||
+d2.txt
|
|
||||||
+art.txt
|
|
||||||
+ia.txt
|
|
||||||
+er.txt
|
|
||||||
+I/n2t-out/Program.s.txt
|
+I/n2t-out/Program.s.txt
|
||||||
++ HMI/US/portrait/n2t-out/Program.s.txt
|
++ HMI/US/portrait/n2t-out/Program.s.txt
|
||||||
+1 +12,11 @@
|
+1 +12,11 @@
|
||||||
@@ -1539,6 +1527,26 @@
|
|||||||
+e (string) entn
|
+e (string) entn
|
||||||
+ributes
|
+ributes
|
||||||
+ Scope : local
|
+ Scope : local
|
||||||
|
+19 +453,14 @@
|
||||||
|
+ ucopy strCommand.txt,4,payloadLength-5,0
|
||||||
|
+ // write instruction to tInstuction (debug output, but used as variable here, ui elements will be disabled by default)
|
||||||
|
+ spstr strCommand.txt,tInstruction.txt,"~",0
|
||||||
|
+ spstr strCommand.txt,tTmp.txt,"~",1
|
||||||
|
+ if(tInstruction.txt=="entityUpdateDetail"&&entn.txt==tTmp.txt)
|
||||||
|
+ {
|
||||||
|
+ // change icon
|
||||||
|
+ spstr strCommand.txt,tTmp.txt,"~",2
|
||||||
|
+ if(tTmp.txt!="")
|
||||||
|
+ {
|
||||||
|
+ tIcon1.txt=tTmp.txt
|
||||||
|
+ }
|
||||||
|
+ //spstr strCommand.txt,tIcon1.txt,"~",2
|
||||||
|
+ vis tIcon1,1
|
||||||
|
+ // change icon color
|
||||||
|
+ spstr strCommand.txt,tTmp.txt,"~",3
|
||||||
|
+ covx tTmp.txt,sys0,0,0
|
||||||
|
+ tIcon1.pco=sys0
|
||||||
|
+ // get Button State
|
||||||
+I/n2t-out/popupNotify.txt
|
+I/n2t-out/popupNotify.txt
|
||||||
++ HMI/US/portrait/n2t-out/popupNotify.txt
|
++ HMI/US/portrait/n2t-out/popupNotify.txt
|
||||||
+15 +348,15 @@
|
+15 +348,15 @@
|
||||||
@@ -1558,6 +1566,25 @@
|
|||||||
+ }
|
+ }
|
||||||
+ if(tInstruction.txt=="exitPopup")
|
+ if(tInstruction.txt=="exitPopup")
|
||||||
+ {
|
+ {
|
||||||
|
+18 +439,14 @@
|
||||||
|
+ {
|
||||||
|
+ page cardPower
|
||||||
|
+ }
|
||||||
|
+ if(tId.txt=="cardChart")
|
||||||
|
+ {
|
||||||
|
+ page cardChart
|
||||||
|
+ }
|
||||||
|
+ if(tId.txt=="cardLChart")
|
||||||
|
+ {
|
||||||
|
+ page cardLChart
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ // end of user code
|
||||||
|
+ udelete payloadLength-1
|
||||||
|
+ bufferPos=0
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
+I/n2t-out/screensaver.txt
|
+I/n2t-out/screensaver.txt
|
||||||
++ HMI/US/portrait/n2t-out/screensaver.txt
|
++ HMI/US/portrait/n2t-out/screensaver.txt
|
||||||
+ +7,14 @@
|
+ +7,14 @@
|
||||||
@@ -1710,7 +1737,7 @@
|
|||||||
+ vis p0,0
|
+ vis p0,0
|
||||||
+ vis tNotifyHead,0
|
+ vis tNotifyHead,0
|
||||||
+ vis tNotifyText,0
|
+ vis tNotifyText,0
|
||||||
+7 +28,14 @@
|
+2 +28,19 @@
|
||||||
+ }
|
+ }
|
||||||
+ tDate.txt=pageIcons.vaDate.txt
|
+ tDate.txt=pageIcons.vaDate.txt
|
||||||
+ dim=dimValue
|
+ dim=dimValue
|
||||||
@@ -1721,14 +1748,80 @@
|
|||||||
+ Postinitialize Event
|
+ Postinitialize Event
|
||||||
+ click m0,1
|
+ click m0,1
|
||||||
+
|
+
|
||||||
|
+e (string) entn1
|
||||||
|
+ributes
|
||||||
|
+ Scope : local
|
||||||
|
+ Text :
|
||||||
|
+ Max. Text Size: 14
|
||||||
|
+
|
||||||
|
+e (string) entn2
|
||||||
|
+ributes
|
||||||
|
+ Scope : local
|
||||||
|
+ Text :
|
||||||
|
+ Max. Text Size: 14
|
||||||
|
+
|
||||||
|
+e (string) entn3
|
||||||
|
+ributes
|
||||||
|
+ Scope : local
|
||||||
|
+ Text :
|
||||||
|
+ Max. Text Size: 14
|
||||||
|
+
|
||||||
|
+e (string) entn4
|
||||||
|
+ributes
|
||||||
|
+ Scope : local
|
||||||
|
+ Text :
|
||||||
|
+ Max. Text Size: 14
|
||||||
|
+
|
||||||
|
+e (string) entn5
|
||||||
|
+ributes
|
||||||
|
+ Scope : local
|
||||||
|
+ Text :
|
||||||
|
+ Max. Text Size: 14
|
||||||
|
+
|
||||||
+e (string) strCommand
|
+e (string) strCommand
|
||||||
+ributes
|
+ributes
|
||||||
+ Scope : local
|
+ Scope : local
|
||||||
+ Text :
|
+ Text :
|
||||||
|
+ Max. Text Size: 1935
|
||||||
+ Max. Text Size: 1979
|
+ Max. Text Size: 1979
|
||||||
+
|
+
|
||||||
+e (string) strTmp
|
+e (string) strTmp
|
||||||
+34 +360,14 @@
|
+ributes
|
||||||
|
+ Scope : local
|
||||||
|
+ Text :
|
||||||
|
+ Max. Text Size: 2
|
||||||
|
+
|
||||||
|
+7 +50,27 @@
|
||||||
|
+ Text :
|
||||||
|
+ Max. Text Size: 25
|
||||||
|
+
|
||||||
|
+e (string) tInstruction
|
||||||
|
+ributes
|
||||||
|
+ Scope : local
|
||||||
|
+ Text :
|
||||||
|
+ Max. Text Size: 15
|
||||||
|
+ Max. Text Size: 50
|
||||||
|
+
|
||||||
|
+e (string) tSend
|
||||||
|
+ributes
|
||||||
|
+ Scope : local
|
||||||
|
+ Text :
|
||||||
|
+ Max. Text Size: 50
|
||||||
|
+
|
||||||
|
+e (string) tTmp
|
||||||
|
+ributes
|
||||||
|
+ Scope : local
|
||||||
|
+ Text :
|
||||||
|
+ Max. Text Size: 30
|
||||||
|
+ Max. Text Size: 50
|
||||||
|
+
|
||||||
|
+e (int32) vaTap
|
||||||
|
+ributes
|
||||||
|
+ Scope: local
|
||||||
|
+ Value: 0
|
||||||
|
+
|
||||||
|
+e (int32) xc1
|
||||||
|
+165 +324,50 @@
|
||||||
+ Scope : local
|
+ Scope : local
|
||||||
+ Dragging : 0
|
+ Dragging : 0
|
||||||
+ Send Component ID : disabled
|
+ Send Component ID : disabled
|
||||||
@@ -1736,6 +1829,137 @@
|
|||||||
+ Text :
|
+ Text :
|
||||||
+ Max. Text Size : 4
|
+ Max. Text Size : 4
|
||||||
+
|
+
|
||||||
|
+nts
|
||||||
|
+ Touch Press Event
|
||||||
|
+ tSend.txt="event,buttonPress2,"+entn1.txt+",button"
|
||||||
|
+ if(entn1.txt=="")
|
||||||
|
+ {
|
||||||
|
+ tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
+ }
|
||||||
|
+ //send calc crc
|
||||||
|
+ btlen tSend.txt,sys0
|
||||||
|
+ crcrest 1,0xffff // reset CRC
|
||||||
|
+ crcputh 55 bb
|
||||||
|
+ crcputs sys0,2
|
||||||
|
+ crcputs tSend.txt,0
|
||||||
|
+ //send cmd
|
||||||
|
+ printh 55 bb
|
||||||
|
+ prints sys0,2
|
||||||
|
+ prints tSend.txt,0
|
||||||
|
+ prints crcval,2
|
||||||
|
+
|
||||||
|
+Icon
|
||||||
|
+ributes
|
||||||
|
+ Scope : local
|
||||||
|
+ Dragging : 0
|
||||||
|
+ Send Component ID : disabled
|
||||||
|
+ Associated Keyboard: none
|
||||||
|
+ Text :
|
||||||
|
+ Max. Text Size : 4
|
||||||
|
+
|
||||||
|
+nts
|
||||||
|
+ Touch Press Event
|
||||||
|
+ tSend.txt="event,buttonPress2,"+entn2.txt+",button"
|
||||||
|
+ if(entn2.txt=="")
|
||||||
|
+ {
|
||||||
|
+ tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
+ }
|
||||||
|
+ //send calc crc
|
||||||
|
+ btlen tSend.txt,sys0
|
||||||
|
+ crcrest 1,0xffff // reset CRC
|
||||||
|
+ crcputh 55 bb
|
||||||
|
+ crcputs sys0,2
|
||||||
|
+ crcputs tSend.txt,0
|
||||||
|
+ //send cmd
|
||||||
|
+ printh 55 bb
|
||||||
|
+ prints sys0,2
|
||||||
|
+ prints tSend.txt,0
|
||||||
|
+ prints crcval,2
|
||||||
|
+
|
||||||
|
+Icon
|
||||||
|
+ributes
|
||||||
|
+ Scope : local
|
||||||
|
+ Dragging : 0
|
||||||
|
+ Send Component ID : disabled
|
||||||
|
+ Associated Keyboard: none
|
||||||
|
+ Text :
|
||||||
|
+ Max. Text Size : 4
|
||||||
|
+
|
||||||
|
+nts
|
||||||
|
+ Touch Press Event
|
||||||
|
+ tSend.txt="event,buttonPress2,"+entn3.txt+",button"
|
||||||
|
+ if(entn3.txt=="")
|
||||||
|
+ {
|
||||||
|
+ tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
+ }
|
||||||
|
+ //send calc crc
|
||||||
|
+ btlen tSend.txt,sys0
|
||||||
|
+ crcrest 1,0xffff // reset CRC
|
||||||
|
+ crcputh 55 bb
|
||||||
|
+ crcputs sys0,2
|
||||||
|
+ crcputs tSend.txt,0
|
||||||
|
+ //send cmd
|
||||||
|
+ printh 55 bb
|
||||||
|
+ prints sys0,2
|
||||||
|
+ prints tSend.txt,0
|
||||||
|
+ prints crcval,2
|
||||||
|
+
|
||||||
|
+Icon
|
||||||
|
+ributes
|
||||||
|
+ Scope : local
|
||||||
|
+ Dragging : 0
|
||||||
|
+ Send Component ID : disabled
|
||||||
|
+ Associated Keyboard: none
|
||||||
|
+ Text :
|
||||||
|
+ Max. Text Size : 4
|
||||||
|
+
|
||||||
|
+nts
|
||||||
|
+ Touch Press Event
|
||||||
|
+ tSend.txt="event,buttonPress2,"+entn4.txt+",button"
|
||||||
|
+ if(entn4.txt=="")
|
||||||
|
+ {
|
||||||
|
+ tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
+ }
|
||||||
|
+ //send calc crc
|
||||||
|
+ btlen tSend.txt,sys0
|
||||||
|
+ crcrest 1,0xffff // reset CRC
|
||||||
|
+ crcputh 55 bb
|
||||||
|
+ crcputs sys0,2
|
||||||
|
+ crcputs tSend.txt,0
|
||||||
|
+ //send cmd
|
||||||
|
+ printh 55 bb
|
||||||
|
+ prints sys0,2
|
||||||
|
+ prints tSend.txt,0
|
||||||
|
+ prints crcval,2
|
||||||
|
+
|
||||||
|
+Icon
|
||||||
|
+ributes
|
||||||
|
+ Scope : local
|
||||||
|
+ Dragging : 0
|
||||||
|
+ Send Component ID : disabled
|
||||||
|
+ Associated Keyboard: none
|
||||||
|
+ Text :
|
||||||
|
+ Max. Text Size : 4
|
||||||
|
+
|
||||||
|
+nts
|
||||||
|
+ Touch Press Event
|
||||||
|
+ tSend.txt="event,buttonPress2,"+entn5.txt+",button"
|
||||||
|
+ if(entn5.txt=="")
|
||||||
|
+ {
|
||||||
|
+ tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
+ }
|
||||||
|
+ //send calc crc
|
||||||
|
+ btlen tSend.txt,sys0
|
||||||
|
+ crcrest 1,0xffff // reset CRC
|
||||||
|
+ crcputh 55 bb
|
||||||
|
+ crcputs sys0,2
|
||||||
|
+ crcputs tSend.txt,0
|
||||||
|
+ //send cmd
|
||||||
|
+ printh 55 bb
|
||||||
|
+ prints sys0,2
|
||||||
|
+ prints tSend.txt,0
|
||||||
|
+ prints crcval,2
|
||||||
|
+
|
||||||
+
|
+
|
||||||
+ributes
|
+ributes
|
||||||
+ Scope : local
|
+ Scope : local
|
||||||
@@ -1779,3 +2003,48 @@
|
|||||||
+ if(tAMPM.txt=="")
|
+ if(tAMPM.txt=="")
|
||||||
+ {
|
+ {
|
||||||
+ vis tAMPM,0
|
+ vis tAMPM,0
|
||||||
|
+44 +677,34 @@
|
||||||
|
+ //e6Val
|
||||||
|
+ spstr strCommand.txt,e6Val.txt,"~",60
|
||||||
|
+ //f1Icon
|
||||||
|
+ spstr strCommand.txt,f1Icon.txt,"~",63
|
||||||
|
+ //f1Icon Color
|
||||||
|
+ spstr strCommand.txt,tTmp.txt,"~",64
|
||||||
|
+ covx tTmp.txt,f1Icon.pco,0,0
|
||||||
|
+ //f1Icon intNameEntity
|
||||||
|
+ spstr strCommand.txt,entn1.txt,"~",62
|
||||||
|
+ //f2Icon
|
||||||
|
+ spstr strCommand.txt,f2Icon.txt,"~",69
|
||||||
|
+ //f2Icon Color
|
||||||
|
+ spstr strCommand.txt,tTmp.txt,"~",70
|
||||||
|
+ covx tTmp.txt,f2Icon.pco,0,0
|
||||||
|
+ //f2Icon intNameEntity
|
||||||
|
+ spstr strCommand.txt,entn2.txt,"~",68
|
||||||
|
+ //f3Icon
|
||||||
|
+ spstr strCommand.txt,f3Icon.txt,"~",75
|
||||||
|
+ //f3Icon Color
|
||||||
|
+ spstr strCommand.txt,tTmp.txt,"~",76
|
||||||
|
+ covx tTmp.txt,f3Icon.pco,0,0
|
||||||
|
+ //f3Icon intNameEntity
|
||||||
|
+ spstr strCommand.txt,entn3.txt,"~",74
|
||||||
|
+ //f4Icon
|
||||||
|
+ spstr strCommand.txt,f4Icon.txt,"~",81
|
||||||
|
+ //f4Icon Color
|
||||||
|
+ spstr strCommand.txt,tTmp.txt,"~",82
|
||||||
|
+ covx tTmp.txt,f4Icon.pco,0,0
|
||||||
|
+ //f4Icon intNameEntity
|
||||||
|
+ spstr strCommand.txt,entn4.txt,"~",80
|
||||||
|
+ //f5Icon
|
||||||
|
+ spstr strCommand.txt,f5Icon.txt,"~",87
|
||||||
|
+ //f5Icon Color
|
||||||
|
+ spstr strCommand.txt,tTmp.txt,"~",88
|
||||||
|
+ covx tTmp.txt,f5Icon.pco,0,0
|
||||||
|
+ //f5Icon intNameEntity
|
||||||
|
+ spstr strCommand.txt,entn5.txt,"~",86
|
||||||
|
+ }
|
||||||
|
+ if(tInstruction.txt=="notify")
|
||||||
|
+ {
|
||||||
|
+ spstr strCommand.txt,tNotifyHead.txt,"~",1
|
||||||
|
+ spstr strCommand.txt,tNotifyText.txt,"~",2
|
||||||
|
+ if(tNotifyHead.txt!=""||tNotifyText.txt!="")
|
||||||
|
+ {
|
||||||
|
|||||||
@@ -1,272 +1,274 @@
|
|||||||
from shared import *
|
from shared import *
|
||||||
head = sharedhead + """
|
head = sharedhead + """
|
||||||
if(tInstruction.txt=="wake")
|
if(tInstruction.txt=="wake")
|
||||||
{
|
{
|
||||||
click tc0,1
|
click tc0,1
|
||||||
}
|
}
|
||||||
if(tInstruction.txt=="dimmode")
|
if(tInstruction.txt=="dimmode")
|
||||||
{
|
{
|
||||||
// get value
|
// get value
|
||||||
spstr strCommand.txt,tTmp.txt,"~",1
|
spstr strCommand.txt,tTmp.txt,"~",1
|
||||||
covx tTmp.txt,dimValue,0,0
|
covx tTmp.txt,dimValue,0,0
|
||||||
dim=dimValue
|
dim=dimValue
|
||||||
// get value normal
|
// get value normal
|
||||||
spstr strCommand.txt,tTmp.txt,"~",2
|
spstr strCommand.txt,tTmp.txt,"~",2
|
||||||
covx tTmp.txt,dimValueNormal,0,0
|
covx tTmp.txt,dimValueNormal,0,0
|
||||||
// get background color
|
// get background color
|
||||||
spstr strCommand.txt,tTmp.txt,"~",3
|
spstr strCommand.txt,tTmp.txt,"~",3
|
||||||
if(tTmp.txt!="")
|
if(tTmp.txt!="")
|
||||||
{
|
{
|
||||||
covx tTmp.txt,defaultBcoColor,0,0
|
covx tTmp.txt,defaultBcoColor,0,0
|
||||||
}
|
}
|
||||||
// get font color
|
// get font color
|
||||||
spstr strCommand.txt,tTmp.txt,"~",4
|
spstr strCommand.txt,tTmp.txt,"~",4
|
||||||
if(tTmp.txt!="")
|
if(tTmp.txt!="")
|
||||||
{
|
{
|
||||||
covx tTmp.txt,defaultFontColor,0,0
|
covx tTmp.txt,defaultFontColor,0,0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(tInstruction.txt=="time")
|
if(tInstruction.txt=="time")
|
||||||
{
|
{
|
||||||
click m0,1
|
click m0,1
|
||||||
//get set time to global variable
|
//get set time to global variable
|
||||||
spstr strCommand.txt,pageIcons.vaTime.txt,"~",1
|
spstr strCommand.txt,pageIcons.vaTime.txt,"~",1
|
||||||
spstr pageIcons.vaTime.txt,tTime.txt,"?",0
|
spstr pageIcons.vaTime.txt,tTime.txt,"?",0
|
||||||
spstr pageIcons.vaTime.txt,tAMPM.txt,"?",1
|
spstr pageIcons.vaTime.txt,tAMPM.txt,"?",1
|
||||||
if(tAMPM.txt=="")
|
if(tAMPM.txt=="")
|
||||||
{
|
{
|
||||||
vis tAMPM,0
|
vis tAMPM,0
|
||||||
}
|
}
|
||||||
spstr strCommand.txt,tTimeAdd.txt,"~",2
|
spstr strCommand.txt,tTimeAdd.txt,"~",2
|
||||||
ref tIcon1
|
ref tIcon1
|
||||||
ref tIcon2
|
ref tIcon2
|
||||||
}
|
}
|
||||||
if(tInstruction.txt=="date")
|
if(tInstruction.txt=="date")
|
||||||
{
|
{
|
||||||
//get set date to global variable
|
//get set date to global variable
|
||||||
spstr strCommand.txt,pageIcons.vaDate.txt,"~",1
|
spstr strCommand.txt,pageIcons.vaDate.txt,"~",1
|
||||||
tDate.txt=pageIcons.vaDate.txt
|
tDate.txt=pageIcons.vaDate.txt
|
||||||
}
|
}
|
||||||
if(tInstruction.txt=="statusUpdate")
|
if(tInstruction.txt=="statusUpdate")
|
||||||
{
|
{
|
||||||
//statusIcon1
|
//statusIcon1
|
||||||
spstr strCommand.txt,tIcon1.txt,"~",1
|
spstr strCommand.txt,tIcon1.txt,"~",1
|
||||||
spstr strCommand.txt,tTmp.txt,"~",2
|
spstr strCommand.txt,tTmp.txt,"~",2
|
||||||
covx tTmp.txt,tIcon1.pco,0,0
|
covx tTmp.txt,tIcon1.pco,0,0
|
||||||
//statusIcon2
|
//statusIcon2
|
||||||
spstr strCommand.txt,tIcon2.txt,"~",3
|
spstr strCommand.txt,tIcon2.txt,"~",3
|
||||||
spstr strCommand.txt,tTmp.txt,"~",4
|
spstr strCommand.txt,tTmp.txt,"~",4
|
||||||
covx tTmp.txt,tIcon2.pco,0,0
|
covx tTmp.txt,tIcon2.pco,0,0
|
||||||
spstr strCommand.txt,tTmp.txt,"~",5
|
spstr strCommand.txt,tTmp.txt,"~",5
|
||||||
if(tTmp.txt!="")
|
if(tTmp.txt!="")
|
||||||
{
|
{
|
||||||
tIcon1.font=3
|
tIcon1.font=3
|
||||||
}
|
}
|
||||||
spstr strCommand.txt,tTmp.txt,"~",6
|
spstr strCommand.txt,tTmp.txt,"~",6
|
||||||
if(tTmp.txt!="")
|
if(tTmp.txt!="")
|
||||||
{
|
{
|
||||||
tIcon2.font=3
|
tIcon2.font=3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(tInstruction.txt=="weatherUpdate"&&tNotifyHead.txt==""&&tNotifyText.txt=="")
|
if(tInstruction.txt=="weatherUpdate"&&tNotifyHead.txt==""&&tNotifyText.txt=="")
|
||||||
{
|
{
|
||||||
|
|
||||||
//tMainIcon
|
//tMainIcon
|
||||||
spstr strCommand.txt,tMainIcon.txt,"~",3
|
spstr strCommand.txt,tMainIcon.txt,"~",3
|
||||||
//tMainIcon Color
|
//tMainIcon Color
|
||||||
spstr strCommand.txt,tTmp.txt,"~",4
|
spstr strCommand.txt,tTmp.txt,"~",4
|
||||||
covx tTmp.txt,tMainIcon.pco,0,0
|
covx tTmp.txt,tMainIcon.pco,0,0
|
||||||
//tMainText
|
//tMainText
|
||||||
spstr strCommand.txt,tMainText.txt,"~",6
|
spstr strCommand.txt,tMainText.txt,"~",6
|
||||||
"""
|
"""
|
||||||
|
|
||||||
start = 7
|
start = 7
|
||||||
for i in range(1,4):
|
for i in range(1,4):
|
||||||
idxstart = start + (i-1)*6
|
idxstart = start + (i-1)*6
|
||||||
item = f"""
|
item = f"""
|
||||||
//d{i}Icon
|
//d{i}Icon
|
||||||
spstr strCommand.txt,d{i}Icon.txt,"~",{idxstart+2}
|
spstr strCommand.txt,d{i}Icon.txt,"~",{idxstart+2}
|
||||||
//d{i}Icon Color
|
//d{i}Icon Color
|
||||||
spstr strCommand.txt,tTmp.txt,"~",{idxstart+3}
|
spstr strCommand.txt,tTmp.txt,"~",{idxstart+3}
|
||||||
covx tTmp.txt,d{i}Icon.pco,0,0
|
covx tTmp.txt,d{i}Icon.pco,0,0
|
||||||
//d{i}Val
|
//d{i}Val
|
||||||
spstr strCommand.txt,d{i}Val.txt,"~",{idxstart+5}
|
spstr strCommand.txt,d{i}Val.txt,"~",{idxstart+5}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
head = head + item
|
head = head + item
|
||||||
|
|
||||||
start = idxstart+6
|
start = idxstart+6
|
||||||
for i in range(1,7):
|
for i in range(1,7):
|
||||||
idxstart = start + (i-1)*6
|
idxstart = start + (i-1)*6
|
||||||
item = f"""
|
item = f"""
|
||||||
//e{i}Name
|
//e{i}Name
|
||||||
spstr strCommand.txt,e{i}Name.txt,"~",{idxstart+4}
|
spstr strCommand.txt,e{i}Name.txt,"~",{idxstart+4}
|
||||||
//e{i}Icon
|
//e{i}Icon
|
||||||
spstr strCommand.txt,e{i}Icon.txt,"~",{idxstart+2}
|
spstr strCommand.txt,e{i}Icon.txt,"~",{idxstart+2}
|
||||||
//e{i}Icon Color
|
//e{i}Icon Color
|
||||||
spstr strCommand.txt,tTmp.txt,"~",{idxstart+3}
|
spstr strCommand.txt,tTmp.txt,"~",{idxstart+3}
|
||||||
covx tTmp.txt,e{i}Icon.pco,0,0
|
covx tTmp.txt,e{i}Icon.pco,0,0
|
||||||
//e{i}Val
|
//e{i}Val
|
||||||
spstr strCommand.txt,e{i}Val.txt,"~",{idxstart+5}
|
spstr strCommand.txt,e{i}Val.txt,"~",{idxstart+5}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
head = head + item
|
head = head + item
|
||||||
|
|
||||||
start = idxstart+6
|
start = idxstart+6
|
||||||
for i in range(1,6):
|
for i in range(1,6):
|
||||||
idxstart = start + (i-1)*6
|
idxstart = start + (i-1)*6
|
||||||
item = f"""
|
item = f"""
|
||||||
//f{i}Icon
|
//f{i}Icon
|
||||||
spstr strCommand.txt,f{i}Icon.txt,"~",{idxstart+2}
|
spstr strCommand.txt,f{i}Icon.txt,"~",{idxstart+2}
|
||||||
//f{i}Icon Color
|
//f{i}Icon Color
|
||||||
spstr strCommand.txt,tTmp.txt,"~",{idxstart+3}
|
spstr strCommand.txt,tTmp.txt,"~",{idxstart+3}
|
||||||
covx tTmp.txt,f{i}Icon.pco,0,0
|
covx tTmp.txt,f{i}Icon.pco,0,0
|
||||||
"""
|
//f{i}Icon intNameEntity
|
||||||
head = head + item
|
spstr strCommand.txt,entn{i}.txt,"~",{idxstart+1}
|
||||||
|
"""
|
||||||
head = head + """
|
head = head + item
|
||||||
}
|
|
||||||
|
head = head + """
|
||||||
if(tInstruction.txt=="color"&&tNotifyHead.txt==""&&tNotifyText.txt=="")
|
}
|
||||||
{
|
|
||||||
spstr strCommand.txt,tTmp.txt,"~",1
|
if(tInstruction.txt=="color"&&tNotifyHead.txt==""&&tNotifyText.txt=="")
|
||||||
covx tTmp.txt,tTime.bco,0,0
|
{
|
||||||
if(tTime.bco!=screensaver.bco)
|
spstr strCommand.txt,tTmp.txt,"~",1
|
||||||
{
|
covx tTmp.txt,tTime.bco,0,0
|
||||||
for(sys0=0;sys0<60;sys0++)
|
if(tTime.bco!=screensaver.bco)
|
||||||
{
|
{
|
||||||
if(b[sys0].type==98||b[sys0].type==116||b[sys0].type==54)
|
for(sys0=0;sys0<60;sys0++)
|
||||||
{
|
{
|
||||||
b[sys0].bco=tTime.bco
|
if(b[sys0].type==98||b[sys0].type==116||b[sys0].type==54)
|
||||||
}
|
{
|
||||||
}
|
b[sys0].bco=tTime.bco
|
||||||
}
|
}
|
||||||
spstr strCommand.txt,tTmp.txt,"~",2
|
}
|
||||||
covx tTmp.txt,tTime.pco,0,0
|
}
|
||||||
spstr strCommand.txt,tTmp.txt,"~",3
|
spstr strCommand.txt,tTmp.txt,"~",2
|
||||||
covx tTmp.txt,tAMPM.pco,0,0
|
covx tTmp.txt,tTime.pco,0,0
|
||||||
spstr strCommand.txt,tTmp.txt,"~",4
|
spstr strCommand.txt,tTmp.txt,"~",3
|
||||||
covx tTmp.txt,tDate.pco,0,0
|
covx tTmp.txt,tAMPM.pco,0,0
|
||||||
spstr strCommand.txt,tTmp.txt,"~",5
|
spstr strCommand.txt,tTmp.txt,"~",4
|
||||||
covx tTmp.txt,tMainText.pco,0,0
|
covx tTmp.txt,tDate.pco,0,0
|
||||||
//spstr strCommand.txt,tTmp.txt,"~",6
|
spstr strCommand.txt,tTmp.txt,"~",5
|
||||||
//covx tTmp.txt,tForecast1.pco,0,0
|
covx tTmp.txt,tMainText.pco,0,0
|
||||||
//spstr strCommand.txt,tTmp.txt,"~",7
|
//spstr strCommand.txt,tTmp.txt,"~",6
|
||||||
//covx tTmp.txt,tForecast2.pco,0,0
|
//covx tTmp.txt,tForecast1.pco,0,0
|
||||||
//spstr strCommand.txt,tTmp.txt,"~",8
|
//spstr strCommand.txt,tTmp.txt,"~",7
|
||||||
//covx tTmp.txt,tForecast3.pco,0,0
|
//covx tTmp.txt,tForecast2.pco,0,0
|
||||||
//spstr strCommand.txt,tTmp.txt,"~",9
|
//spstr strCommand.txt,tTmp.txt,"~",8
|
||||||
//covx tTmp.txt,tForecast4.pco,0,0
|
//covx tTmp.txt,tForecast3.pco,0,0
|
||||||
//spstr strCommand.txt,tTmp.txt,"~",10
|
//spstr strCommand.txt,tTmp.txt,"~",9
|
||||||
//covx tTmp.txt,tForecast1Val.pco,0,0
|
//covx tTmp.txt,tForecast4.pco,0,0
|
||||||
//spstr strCommand.txt,tTmp.txt,"~",11
|
//spstr strCommand.txt,tTmp.txt,"~",10
|
||||||
//covx tTmp.txt,tForecast2Val.pco,0,0
|
//covx tTmp.txt,tForecast1Val.pco,0,0
|
||||||
//spstr strCommand.txt,tTmp.txt,"~",12
|
//spstr strCommand.txt,tTmp.txt,"~",11
|
||||||
//covx tTmp.txt,tForecast3Val.pco,0,0
|
//covx tTmp.txt,tForecast2Val.pco,0,0
|
||||||
//spstr strCommand.txt,tTmp.txt,"~",13
|
//spstr strCommand.txt,tTmp.txt,"~",12
|
||||||
//covx tTmp.txt,tForecast4Val.pco,0,0
|
//covx tTmp.txt,tForecast3Val.pco,0,0
|
||||||
//spstr strCommand.txt,tTmp.txt,"~",14
|
//spstr strCommand.txt,tTmp.txt,"~",13
|
||||||
//covx tTmp.txt,t10.bco,0,0
|
//covx tTmp.txt,tForecast4Val.pco,0,0
|
||||||
//spstr strCommand.txt,tTmp.txt,"~",15
|
//spstr strCommand.txt,tTmp.txt,"~",14
|
||||||
//covx tTmp.txt,tMainTextAlt2.pco,0,0
|
//covx tTmp.txt,t10.bco,0,0
|
||||||
//spstr strCommand.txt,tTmp.txt,"~",16
|
//spstr strCommand.txt,tTmp.txt,"~",15
|
||||||
//covx tTmp.txt,tTimeAdd.pco,0,0
|
//covx tTmp.txt,tMainTextAlt2.pco,0,0
|
||||||
}
|
//spstr strCommand.txt,tTmp.txt,"~",16
|
||||||
|
//covx tTmp.txt,tTimeAdd.pco,0,0
|
||||||
|
}
|
||||||
|
|
||||||
if(tInstruction.txt=="notify")
|
|
||||||
{
|
|
||||||
spstr strCommand.txt,tNotifyHead.txt,"~",1
|
if(tInstruction.txt=="notify")
|
||||||
spstr strCommand.txt,tNotifyText.txt,"~",2
|
{
|
||||||
if(tNotifyHead.txt!=""||tNotifyText.txt!="")
|
spstr strCommand.txt,tNotifyHead.txt,"~",1
|
||||||
{
|
spstr strCommand.txt,tNotifyText.txt,"~",2
|
||||||
vis tNotifyHead,1
|
if(tNotifyHead.txt!=""||tNotifyText.txt!="")
|
||||||
vis tNotifyText,1
|
{
|
||||||
}else
|
vis tNotifyHead,1
|
||||||
{
|
vis tNotifyText,1
|
||||||
vis tNotifyHead,0
|
}else
|
||||||
vis tNotifyText,0
|
{
|
||||||
}
|
vis tNotifyHead,0
|
||||||
tNotifyHead.bco=tTime.bco
|
vis tNotifyText,0
|
||||||
tNotifyText.bco=tTime.bco
|
}
|
||||||
spstr strCommand.txt,tTmp.txt,"~",3
|
tNotifyHead.bco=tTime.bco
|
||||||
if(tTmp.txt!="")
|
tNotifyText.bco=tTime.bco
|
||||||
{
|
spstr strCommand.txt,tTmp.txt,"~",3
|
||||||
covx tTmp.txt,tNotifyHead.pco,0,0
|
if(tTmp.txt!="")
|
||||||
}
|
{
|
||||||
spstr strCommand.txt,tTmp.txt,"~",4
|
covx tTmp.txt,tNotifyHead.pco,0,0
|
||||||
if(tTmp.txt!="")
|
}
|
||||||
{
|
spstr strCommand.txt,tTmp.txt,"~",4
|
||||||
covx tTmp.txt,tNotifyText.pco,0,0
|
if(tTmp.txt!="")
|
||||||
}
|
{
|
||||||
"""
|
covx tTmp.txt,tNotifyText.pco,0,0
|
||||||
|
}
|
||||||
print(head)
|
"""
|
||||||
|
|
||||||
|
print(head)
|
||||||
#start = 23
|
|
||||||
#for i in range(1,7):
|
|
||||||
# idxstart = start + (i-1)*6
|
#start = 23
|
||||||
# item = f"""
|
#for i in range(1,7):
|
||||||
# // get Type
|
# idxstart = start + (i-1)*6
|
||||||
# spstr strCommand.txt,type{i}.txt,"~",{idxstart}
|
# item = f"""
|
||||||
# // get internal name
|
# // get Type
|
||||||
# spstr strCommand.txt,entn{i}.txt,"~",{idxstart+1}
|
# spstr strCommand.txt,type{i}.txt,"~",{idxstart}
|
||||||
# if(type{i}.txt=="delete"||type{i}.txt=="")
|
# // get internal name
|
||||||
# {{
|
# spstr strCommand.txt,entn{i}.txt,"~",{idxstart+1}
|
||||||
# vis tEntity{i},0
|
# if(type{i}.txt=="delete"||type{i}.txt=="")
|
||||||
# vis bEntity{i},0
|
# {{
|
||||||
# }}else
|
# vis tEntity{i},0
|
||||||
# {{
|
# vis bEntity{i},0
|
||||||
# // change icon
|
# }}else
|
||||||
# spstr strCommand.txt,bEntity{i}.txt,"~",{idxstart+2}
|
# {{
|
||||||
# vis bEntity{i},1
|
# // change icon
|
||||||
# // change icon color
|
# spstr strCommand.txt,bEntity{i}.txt,"~",{idxstart+2}
|
||||||
# spstr strCommand.txt,tTmp.txt,"~",{idxstart+3}
|
# vis bEntity{i},1
|
||||||
# covx tTmp.txt,sys0,0,0
|
# // change icon color
|
||||||
# bEntity{i}.pco=sys0
|
# spstr strCommand.txt,tTmp.txt,"~",{idxstart+3}
|
||||||
# // set name
|
# covx tTmp.txt,sys0,0,0
|
||||||
# spstr strCommand.txt,tEntity{i}.txt,"~",{idxstart+4}
|
# bEntity{i}.pco=sys0
|
||||||
# vis tEntity{i},1
|
# // set name
|
||||||
# }}
|
# spstr strCommand.txt,tEntity{i}.txt,"~",{idxstart+4}
|
||||||
#"""
|
# vis tEntity{i},1
|
||||||
# print(item)
|
# }}
|
||||||
foot = """
|
#"""
|
||||||
}
|
# print(item)
|
||||||
""" + sharedfoot.replace("sleepValue=0", "dim=100").replace("""
|
foot = """
|
||||||
if(tInstruction.txt=="time")
|
}
|
||||||
{
|
""" + sharedfoot.replace("sleepValue=0", "dim=100").replace("""
|
||||||
// get set time to global variable
|
if(tInstruction.txt=="time")
|
||||||
spstr strCommand.txt,pageIcons.vaTime.txt,"~",1
|
{
|
||||||
}
|
// get set time to global variable
|
||||||
if(tInstruction.txt=="date")
|
spstr strCommand.txt,pageIcons.vaTime.txt,"~",1
|
||||||
{
|
}
|
||||||
// get set date to global variable
|
if(tInstruction.txt=="date")
|
||||||
spstr strCommand.txt,pageIcons.vaDate.txt,"~",1
|
{
|
||||||
}
|
// get set date to global variable
|
||||||
if(tInstruction.txt=="dimmode")
|
spstr strCommand.txt,pageIcons.vaDate.txt,"~",1
|
||||||
{
|
}
|
||||||
// get value
|
if(tInstruction.txt=="dimmode")
|
||||||
spstr strCommand.txt,tTmp.txt,"~",1
|
{
|
||||||
covx tTmp.txt,dimValue,0,0
|
// get value
|
||||||
// get value normal
|
spstr strCommand.txt,tTmp.txt,"~",1
|
||||||
spstr strCommand.txt,tTmp.txt,"~",2
|
covx tTmp.txt,dimValue,0,0
|
||||||
covx tTmp.txt,dimValueNormal,0,0
|
// get value normal
|
||||||
dim=dimValueNormal
|
spstr strCommand.txt,tTmp.txt,"~",2
|
||||||
// get background color
|
covx tTmp.txt,dimValueNormal,0,0
|
||||||
spstr strCommand.txt,tTmp.txt,"~",3
|
dim=dimValueNormal
|
||||||
if(tTmp.txt!="")
|
// get background color
|
||||||
{
|
spstr strCommand.txt,tTmp.txt,"~",3
|
||||||
covx tTmp.txt,defaultBcoColor,0,0
|
if(tTmp.txt!="")
|
||||||
}
|
{
|
||||||
// get font color
|
covx tTmp.txt,defaultBcoColor,0,0
|
||||||
spstr strCommand.txt,tTmp.txt,"~",4
|
}
|
||||||
if(tTmp.txt!="")
|
// get font color
|
||||||
{
|
spstr strCommand.txt,tTmp.txt,"~",4
|
||||||
covx tTmp.txt,defaultFontColor,0,0
|
if(tTmp.txt!="")
|
||||||
}
|
{
|
||||||
}""","")
|
covx tTmp.txt,defaultFontColor,0,0
|
||||||
print(foot)
|
}
|
||||||
|
}""","")
|
||||||
|
print(foot)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,63 +0,0 @@
|
|||||||
Page cardBurnRec
|
|
||||||
Attributes
|
|
||||||
ID : 0
|
|
||||||
Scope : local
|
|
||||||
Dragging : 0
|
|
||||||
Send Component ID : disabled
|
|
||||||
Opacity : 127
|
|
||||||
Width : 480
|
|
||||||
Effect : load
|
|
||||||
Effect Priority : 0
|
|
||||||
Effect Time : 300
|
|
||||||
Locked : no
|
|
||||||
Swide up page ID : disabled
|
|
||||||
Swide down page ID : disabled
|
|
||||||
Swide left page ID : disabled
|
|
||||||
Swide right page ID: disabled
|
|
||||||
Fill : solid color
|
|
||||||
Back. Color : 65535
|
|
||||||
|
|
||||||
Timer tm0
|
|
||||||
Attributes
|
|
||||||
ID : 1
|
|
||||||
Scope : local
|
|
||||||
Period (ms): 1001
|
|
||||||
Enabled : yes
|
|
||||||
|
|
||||||
Events
|
|
||||||
Timer Event
|
|
||||||
dim=100
|
|
||||||
sys0=0
|
|
||||||
sys1=0
|
|
||||||
if(sys2==WHITE)
|
|
||||||
{
|
|
||||||
sys2=BLACK
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
sys2=WHITE
|
|
||||||
}
|
|
||||||
sya1=sys2
|
|
||||||
while(sys0<8)
|
|
||||||
{
|
|
||||||
sya0=sys0%2
|
|
||||||
if(sya1==WHITE)
|
|
||||||
{
|
|
||||||
sya1=BLACK
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
sya1=WHITE
|
|
||||||
}
|
|
||||||
fill 0,40*sys0,480,40,sya1
|
|
||||||
sys0++
|
|
||||||
}
|
|
||||||
|
|
||||||
TouchCap tc0
|
|
||||||
Attributes
|
|
||||||
ID : 2
|
|
||||||
Scope: local
|
|
||||||
Value: 0
|
|
||||||
|
|
||||||
Events
|
|
||||||
Touch Press Event
|
|
||||||
page pageStartup
|
|
||||||
|
|
||||||
@@ -6,10 +6,14 @@ pageIcons
|
|||||||
7 Component(s)
|
7 Component(s)
|
||||||
0 Line(s) of event code
|
0 Line(s) of event code
|
||||||
0 Unique line(s) of event code
|
0 Unique line(s) of event code
|
||||||
cardBurnRec
|
pageTest
|
||||||
3 Component(s)
|
25 Component(s)
|
||||||
25 Line(s) of event code
|
68 Line(s) of event code
|
||||||
21 Unique line(s) of event code
|
66 Unique line(s) of event code
|
||||||
|
popupNotify
|
||||||
|
19 Component(s)
|
||||||
|
271 Line(s) of event code
|
||||||
|
174 Unique line(s) of event code
|
||||||
popupFan
|
popupFan
|
||||||
27 Component(s)
|
27 Component(s)
|
||||||
355 Line(s) of event code
|
355 Line(s) of event code
|
||||||
@@ -26,14 +30,10 @@ popupLightNew
|
|||||||
23 Component(s)
|
23 Component(s)
|
||||||
412 Line(s) of event code
|
412 Line(s) of event code
|
||||||
209 Unique line(s) of event code
|
209 Unique line(s) of event code
|
||||||
popupNotify
|
popupLight
|
||||||
19 Component(s)
|
28 Component(s)
|
||||||
267 Line(s) of event code
|
417 Line(s) of event code
|
||||||
172 Unique line(s) of event code
|
228 Unique line(s) of event code
|
||||||
pageTest
|
|
||||||
26 Component(s)
|
|
||||||
69 Line(s) of event code
|
|
||||||
67 Unique line(s) of event code
|
|
||||||
cardGrid2
|
cardGrid2
|
||||||
52 Component(s)
|
52 Component(s)
|
||||||
703 Line(s) of event code
|
703 Line(s) of event code
|
||||||
@@ -46,6 +46,10 @@ cardChart
|
|||||||
33 Component(s)
|
33 Component(s)
|
||||||
447 Line(s) of event code
|
447 Line(s) of event code
|
||||||
297 Unique line(s) of event code
|
297 Unique line(s) of event code
|
||||||
|
cardGrid
|
||||||
|
44 Component(s)
|
||||||
|
593 Line(s) of event code
|
||||||
|
333 Unique line(s) of event code
|
||||||
cardQR
|
cardQR
|
||||||
34 Component(s)
|
34 Component(s)
|
||||||
420 Line(s) of event code
|
420 Line(s) of event code
|
||||||
@@ -54,10 +58,6 @@ cardLChart
|
|||||||
33 Component(s)
|
33 Component(s)
|
||||||
412 Line(s) of event code
|
412 Line(s) of event code
|
||||||
267 Unique line(s) of event code
|
267 Unique line(s) of event code
|
||||||
popupLight
|
|
||||||
28 Component(s)
|
|
||||||
412 Line(s) of event code
|
|
||||||
227 Unique line(s) of event code
|
|
||||||
cardPower
|
cardPower
|
||||||
54 Component(s)
|
54 Component(s)
|
||||||
541 Line(s) of event code
|
541 Line(s) of event code
|
||||||
@@ -66,10 +66,6 @@ cardThermo
|
|||||||
57 Component(s)
|
57 Component(s)
|
||||||
550 Line(s) of event code
|
550 Line(s) of event code
|
||||||
320 Unique line(s) of event code
|
320 Unique line(s) of event code
|
||||||
cardGrid
|
|
||||||
44 Component(s)
|
|
||||||
593 Line(s) of event code
|
|
||||||
333 Unique line(s) of event code
|
|
||||||
popupInSel
|
popupInSel
|
||||||
34 Component(s)
|
34 Component(s)
|
||||||
621 Line(s) of event code
|
621 Line(s) of event code
|
||||||
@@ -91,16 +87,16 @@ popupThermo
|
|||||||
523 Line(s) of event code
|
523 Line(s) of event code
|
||||||
276 Unique line(s) of event code
|
276 Unique line(s) of event code
|
||||||
screensaver2
|
screensaver2
|
||||||
59 Component(s)
|
64 Component(s)
|
||||||
373 Line(s) of event code
|
448 Line(s) of event code
|
||||||
256 Unique line(s) of event code
|
272 Unique line(s) of event code
|
||||||
cardEntities
|
cardEntities
|
||||||
67 Component(s)
|
67 Component(s)
|
||||||
1205 Line(s) of event code
|
1205 Line(s) of event code
|
||||||
536 Unique line(s) of event code
|
536 Unique line(s) of event code
|
||||||
|
|
||||||
Total
|
Total
|
||||||
24 Page(s)
|
23 Page(s)
|
||||||
880 Component(s)
|
881 Component(s)
|
||||||
10740 Line(s) of event code
|
10798 Line(s) of event code
|
||||||
2475 Unique line(s) of event code
|
2472 Unique line(s) of event code
|
||||||
|
|||||||
@@ -335,41 +335,6 @@ Button b13
|
|||||||
Touch Press Event
|
Touch Press Event
|
||||||
showqq
|
showqq
|
||||||
|
|
||||||
Button b14
|
|
||||||
Attributes
|
|
||||||
ID : 25
|
|
||||||
Scope : local
|
|
||||||
Dragging : 0
|
|
||||||
Send Component ID : disabled
|
|
||||||
Opacity : 127
|
|
||||||
x coordinate : 229
|
|
||||||
y coordinate : 188
|
|
||||||
Width : 106
|
|
||||||
Height : 40
|
|
||||||
Effect : load
|
|
||||||
Effect Priority : 0
|
|
||||||
Effect Time : 300
|
|
||||||
Fill : solid color
|
|
||||||
Style : 3D auto
|
|
||||||
Font ID : 1
|
|
||||||
Back. Color : 50712
|
|
||||||
Back. Picture ID (Pressed): 65535
|
|
||||||
Back. Color (Pressed) : 1024
|
|
||||||
Font Color (Unpressed) : 0
|
|
||||||
Font Color (Pressed) : 65535
|
|
||||||
Horizontal Alignment : center
|
|
||||||
Vertical Alignment : center
|
|
||||||
State : unpressed
|
|
||||||
Text : burntest
|
|
||||||
Max. Text Size : 10
|
|
||||||
Word wrap : disabled
|
|
||||||
Horizontal Spacing : 0
|
|
||||||
Vertical Spacing : 0
|
|
||||||
|
|
||||||
Events
|
|
||||||
Touch Press Event
|
|
||||||
page cardBurnRec
|
|
||||||
|
|
||||||
Button b15
|
Button b15
|
||||||
Attributes
|
Attributes
|
||||||
ID : 21
|
ID : 21
|
||||||
|
|||||||
@@ -806,6 +806,11 @@ Timer tmSerial
|
|||||||
if(tInstruction.txt=="entityUpdateDetail"&&entn.txt==tTmp.txt)
|
if(tInstruction.txt=="entityUpdateDetail"&&entn.txt==tTmp.txt)
|
||||||
{
|
{
|
||||||
// change icon
|
// change icon
|
||||||
|
spstr strCommand.txt,tTmp.txt,"~",2
|
||||||
|
if(tTmp.txt!="")
|
||||||
|
{
|
||||||
|
tIcon1.txt=tTmp.txt
|
||||||
|
}
|
||||||
//spstr strCommand.txt,tIcon1.txt,"~",2
|
//spstr strCommand.txt,tIcon1.txt,"~",2
|
||||||
vis tIcon1,1
|
vis tIcon1,1
|
||||||
// change icon color
|
// change icon color
|
||||||
|
|||||||
@@ -672,6 +672,10 @@ Timer tmSerial
|
|||||||
{
|
{
|
||||||
page cardChart
|
page cardChart
|
||||||
}
|
}
|
||||||
|
if(tId.txt=="cardLChart")
|
||||||
|
{
|
||||||
|
page cardLChart
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// end of user code
|
// end of user code
|
||||||
udelete payloadLength-1
|
udelete payloadLength-1
|
||||||
|
|||||||
@@ -56,12 +56,47 @@ Page screensaver2
|
|||||||
Postinitialize Event
|
Postinitialize Event
|
||||||
click m0,1
|
click m0,1
|
||||||
|
|
||||||
|
Variable (string) entn1
|
||||||
|
Attributes
|
||||||
|
ID : 59
|
||||||
|
Scope : local
|
||||||
|
Text :
|
||||||
|
Max. Text Size: 14
|
||||||
|
|
||||||
|
Variable (string) entn2
|
||||||
|
Attributes
|
||||||
|
ID : 60
|
||||||
|
Scope : local
|
||||||
|
Text :
|
||||||
|
Max. Text Size: 14
|
||||||
|
|
||||||
|
Variable (string) entn3
|
||||||
|
Attributes
|
||||||
|
ID : 61
|
||||||
|
Scope : local
|
||||||
|
Text :
|
||||||
|
Max. Text Size: 14
|
||||||
|
|
||||||
|
Variable (string) entn4
|
||||||
|
Attributes
|
||||||
|
ID : 62
|
||||||
|
Scope : local
|
||||||
|
Text :
|
||||||
|
Max. Text Size: 14
|
||||||
|
|
||||||
|
Variable (string) entn5
|
||||||
|
Attributes
|
||||||
|
ID : 63
|
||||||
|
Scope : local
|
||||||
|
Text :
|
||||||
|
Max. Text Size: 14
|
||||||
|
|
||||||
Variable (string) strCommand
|
Variable (string) strCommand
|
||||||
Attributes
|
Attributes
|
||||||
ID : 4
|
ID : 4
|
||||||
Scope : local
|
Scope : local
|
||||||
Text :
|
Text :
|
||||||
Max. Text Size: 1979
|
Max. Text Size: 1935
|
||||||
|
|
||||||
Variable (string) strTmp
|
Variable (string) strTmp
|
||||||
Attributes
|
Attributes
|
||||||
@@ -82,7 +117,7 @@ Variable (string) tInstruction
|
|||||||
ID : 18
|
ID : 18
|
||||||
Scope : local
|
Scope : local
|
||||||
Text :
|
Text :
|
||||||
Max. Text Size: 50
|
Max. Text Size: 15
|
||||||
|
|
||||||
Variable (string) tSend
|
Variable (string) tSend
|
||||||
Attributes
|
Attributes
|
||||||
@@ -96,7 +131,7 @@ Variable (string) tTmp
|
|||||||
ID : 19
|
ID : 19
|
||||||
Scope : local
|
Scope : local
|
||||||
Text :
|
Text :
|
||||||
Max. Text Size: 50
|
Max. Text Size: 30
|
||||||
|
|
||||||
Variable (int32) vaTap
|
Variable (int32) vaTap
|
||||||
Attributes
|
Attributes
|
||||||
@@ -865,6 +900,25 @@ Text f1Icon
|
|||||||
Horizontal Spacing : 0
|
Horizontal Spacing : 0
|
||||||
Vertical Spacing : 0
|
Vertical Spacing : 0
|
||||||
|
|
||||||
|
Events
|
||||||
|
Touch Press Event
|
||||||
|
tSend.txt="event,buttonPress2,"+entn1.txt+",button"
|
||||||
|
if(entn1.txt=="")
|
||||||
|
{
|
||||||
|
tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
}
|
||||||
|
//send calc crc
|
||||||
|
btlen tSend.txt,sys0
|
||||||
|
crcrest 1,0xffff // reset CRC
|
||||||
|
crcputh 55 bb
|
||||||
|
crcputs sys0,2
|
||||||
|
crcputs tSend.txt,0
|
||||||
|
//send cmd
|
||||||
|
printh 55 bb
|
||||||
|
prints sys0,2
|
||||||
|
prints tSend.txt,0
|
||||||
|
prints crcval,2
|
||||||
|
|
||||||
Text f2Icon
|
Text f2Icon
|
||||||
Attributes
|
Attributes
|
||||||
ID : 54
|
ID : 54
|
||||||
@@ -894,6 +948,25 @@ Text f2Icon
|
|||||||
Horizontal Spacing : 0
|
Horizontal Spacing : 0
|
||||||
Vertical Spacing : 0
|
Vertical Spacing : 0
|
||||||
|
|
||||||
|
Events
|
||||||
|
Touch Press Event
|
||||||
|
tSend.txt="event,buttonPress2,"+entn2.txt+",button"
|
||||||
|
if(entn2.txt=="")
|
||||||
|
{
|
||||||
|
tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
}
|
||||||
|
//send calc crc
|
||||||
|
btlen tSend.txt,sys0
|
||||||
|
crcrest 1,0xffff // reset CRC
|
||||||
|
crcputh 55 bb
|
||||||
|
crcputs sys0,2
|
||||||
|
crcputs tSend.txt,0
|
||||||
|
//send cmd
|
||||||
|
printh 55 bb
|
||||||
|
prints sys0,2
|
||||||
|
prints tSend.txt,0
|
||||||
|
prints crcval,2
|
||||||
|
|
||||||
Text f3Icon
|
Text f3Icon
|
||||||
Attributes
|
Attributes
|
||||||
ID : 55
|
ID : 55
|
||||||
@@ -923,6 +996,25 @@ Text f3Icon
|
|||||||
Horizontal Spacing : 0
|
Horizontal Spacing : 0
|
||||||
Vertical Spacing : 0
|
Vertical Spacing : 0
|
||||||
|
|
||||||
|
Events
|
||||||
|
Touch Press Event
|
||||||
|
tSend.txt="event,buttonPress2,"+entn3.txt+",button"
|
||||||
|
if(entn3.txt=="")
|
||||||
|
{
|
||||||
|
tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
}
|
||||||
|
//send calc crc
|
||||||
|
btlen tSend.txt,sys0
|
||||||
|
crcrest 1,0xffff // reset CRC
|
||||||
|
crcputh 55 bb
|
||||||
|
crcputs sys0,2
|
||||||
|
crcputs tSend.txt,0
|
||||||
|
//send cmd
|
||||||
|
printh 55 bb
|
||||||
|
prints sys0,2
|
||||||
|
prints tSend.txt,0
|
||||||
|
prints crcval,2
|
||||||
|
|
||||||
Text f4Icon
|
Text f4Icon
|
||||||
Attributes
|
Attributes
|
||||||
ID : 53
|
ID : 53
|
||||||
@@ -952,6 +1044,25 @@ Text f4Icon
|
|||||||
Horizontal Spacing : 0
|
Horizontal Spacing : 0
|
||||||
Vertical Spacing : 0
|
Vertical Spacing : 0
|
||||||
|
|
||||||
|
Events
|
||||||
|
Touch Press Event
|
||||||
|
tSend.txt="event,buttonPress2,"+entn4.txt+",button"
|
||||||
|
if(entn4.txt=="")
|
||||||
|
{
|
||||||
|
tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
}
|
||||||
|
//send calc crc
|
||||||
|
btlen tSend.txt,sys0
|
||||||
|
crcrest 1,0xffff // reset CRC
|
||||||
|
crcputh 55 bb
|
||||||
|
crcputs sys0,2
|
||||||
|
crcputs tSend.txt,0
|
||||||
|
//send cmd
|
||||||
|
printh 55 bb
|
||||||
|
prints sys0,2
|
||||||
|
prints tSend.txt,0
|
||||||
|
prints crcval,2
|
||||||
|
|
||||||
Text f5Icon
|
Text f5Icon
|
||||||
Attributes
|
Attributes
|
||||||
ID : 52
|
ID : 52
|
||||||
@@ -981,6 +1092,25 @@ Text f5Icon
|
|||||||
Horizontal Spacing : 0
|
Horizontal Spacing : 0
|
||||||
Vertical Spacing : 0
|
Vertical Spacing : 0
|
||||||
|
|
||||||
|
Events
|
||||||
|
Touch Press Event
|
||||||
|
tSend.txt="event,buttonPress2,"+entn5.txt+",button"
|
||||||
|
if(entn5.txt=="")
|
||||||
|
{
|
||||||
|
tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
}
|
||||||
|
//send calc crc
|
||||||
|
btlen tSend.txt,sys0
|
||||||
|
crcrest 1,0xffff // reset CRC
|
||||||
|
crcputh 55 bb
|
||||||
|
crcputs sys0,2
|
||||||
|
crcputs tSend.txt,0
|
||||||
|
//send cmd
|
||||||
|
printh 55 bb
|
||||||
|
prints sys0,2
|
||||||
|
prints tSend.txt,0
|
||||||
|
prints crcval,2
|
||||||
|
|
||||||
Text m0
|
Text m0
|
||||||
Attributes
|
Attributes
|
||||||
ID : 32
|
ID : 32
|
||||||
@@ -1551,26 +1681,36 @@ Timer tmSerial
|
|||||||
//f1Icon Color
|
//f1Icon Color
|
||||||
spstr strCommand.txt,tTmp.txt,"~",64
|
spstr strCommand.txt,tTmp.txt,"~",64
|
||||||
covx tTmp.txt,f1Icon.pco,0,0
|
covx tTmp.txt,f1Icon.pco,0,0
|
||||||
|
//f1Icon intNameEntity
|
||||||
|
spstr strCommand.txt,entn1.txt,"~",62
|
||||||
//f2Icon
|
//f2Icon
|
||||||
spstr strCommand.txt,f2Icon.txt,"~",69
|
spstr strCommand.txt,f2Icon.txt,"~",69
|
||||||
//f2Icon Color
|
//f2Icon Color
|
||||||
spstr strCommand.txt,tTmp.txt,"~",70
|
spstr strCommand.txt,tTmp.txt,"~",70
|
||||||
covx tTmp.txt,f2Icon.pco,0,0
|
covx tTmp.txt,f2Icon.pco,0,0
|
||||||
|
//f2Icon intNameEntity
|
||||||
|
spstr strCommand.txt,entn2.txt,"~",68
|
||||||
//f3Icon
|
//f3Icon
|
||||||
spstr strCommand.txt,f3Icon.txt,"~",75
|
spstr strCommand.txt,f3Icon.txt,"~",75
|
||||||
//f3Icon Color
|
//f3Icon Color
|
||||||
spstr strCommand.txt,tTmp.txt,"~",76
|
spstr strCommand.txt,tTmp.txt,"~",76
|
||||||
covx tTmp.txt,f3Icon.pco,0,0
|
covx tTmp.txt,f3Icon.pco,0,0
|
||||||
|
//f3Icon intNameEntity
|
||||||
|
spstr strCommand.txt,entn3.txt,"~",74
|
||||||
//f4Icon
|
//f4Icon
|
||||||
spstr strCommand.txt,f4Icon.txt,"~",81
|
spstr strCommand.txt,f4Icon.txt,"~",81
|
||||||
//f4Icon Color
|
//f4Icon Color
|
||||||
spstr strCommand.txt,tTmp.txt,"~",82
|
spstr strCommand.txt,tTmp.txt,"~",82
|
||||||
covx tTmp.txt,f4Icon.pco,0,0
|
covx tTmp.txt,f4Icon.pco,0,0
|
||||||
|
//f4Icon intNameEntity
|
||||||
|
spstr strCommand.txt,entn4.txt,"~",80
|
||||||
//f5Icon
|
//f5Icon
|
||||||
spstr strCommand.txt,f5Icon.txt,"~",87
|
spstr strCommand.txt,f5Icon.txt,"~",87
|
||||||
//f5Icon Color
|
//f5Icon Color
|
||||||
spstr strCommand.txt,tTmp.txt,"~",88
|
spstr strCommand.txt,tTmp.txt,"~",88
|
||||||
covx tTmp.txt,f5Icon.pco,0,0
|
covx tTmp.txt,f5Icon.pco,0,0
|
||||||
|
//f5Icon intNameEntity
|
||||||
|
spstr strCommand.txt,entn5.txt,"~",86
|
||||||
}
|
}
|
||||||
if(tInstruction.txt=="notify")
|
if(tInstruction.txt=="notify")
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
Page cardBurnRec
|
|
||||||
Attributes
|
|
||||||
Scope : local
|
|
||||||
Dragging : 0
|
|
||||||
Send Component ID : disabled
|
|
||||||
Locked : no
|
|
||||||
Swide up page ID : disabled
|
|
||||||
Swide down page ID : disabled
|
|
||||||
Swide left page ID : disabled
|
|
||||||
Swide right page ID: disabled
|
|
||||||
|
|
||||||
Timer tm0
|
|
||||||
Attributes
|
|
||||||
Scope : local
|
|
||||||
Period (ms): 1001
|
|
||||||
Enabled : yes
|
|
||||||
|
|
||||||
Events
|
|
||||||
Timer Event
|
|
||||||
dim=100
|
|
||||||
sys0=0
|
|
||||||
sys1=0
|
|
||||||
if(sys2==WHITE)
|
|
||||||
{
|
|
||||||
sys2=BLACK
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
sys2=WHITE
|
|
||||||
}
|
|
||||||
sya1=sys2
|
|
||||||
while(sys0<8)
|
|
||||||
{
|
|
||||||
sya0=sys0%2
|
|
||||||
if(sya1==WHITE)
|
|
||||||
{
|
|
||||||
sya1=BLACK
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
sya1=WHITE
|
|
||||||
}
|
|
||||||
fill 0,40*sys0,480,40,sya1
|
|
||||||
sys0++
|
|
||||||
}
|
|
||||||
|
|
||||||
TouchCap tc0
|
|
||||||
Attributes
|
|
||||||
Scope: local
|
|
||||||
Value: 0
|
|
||||||
|
|
||||||
Events
|
|
||||||
Touch Press Event
|
|
||||||
page pageStartup
|
|
||||||
|
|
||||||
@@ -141,19 +141,6 @@ Button b13
|
|||||||
Touch Press Event
|
Touch Press Event
|
||||||
showqq
|
showqq
|
||||||
|
|
||||||
Button b14
|
|
||||||
Attributes
|
|
||||||
Scope : local
|
|
||||||
Dragging : 0
|
|
||||||
Send Component ID: disabled
|
|
||||||
State : unpressed
|
|
||||||
Text : burntest
|
|
||||||
Max. Text Size : 10
|
|
||||||
|
|
||||||
Events
|
|
||||||
Touch Press Event
|
|
||||||
page cardBurnRec
|
|
||||||
|
|
||||||
Button b15
|
Button b15
|
||||||
Attributes
|
Attributes
|
||||||
Scope : local
|
Scope : local
|
||||||
|
|||||||
@@ -457,6 +457,11 @@ Timer tmSerial
|
|||||||
if(tInstruction.txt=="entityUpdateDetail"&&entn.txt==tTmp.txt)
|
if(tInstruction.txt=="entityUpdateDetail"&&entn.txt==tTmp.txt)
|
||||||
{
|
{
|
||||||
// change icon
|
// change icon
|
||||||
|
spstr strCommand.txt,tTmp.txt,"~",2
|
||||||
|
if(tTmp.txt!="")
|
||||||
|
{
|
||||||
|
tIcon1.txt=tTmp.txt
|
||||||
|
}
|
||||||
//spstr strCommand.txt,tIcon1.txt,"~",2
|
//spstr strCommand.txt,tIcon1.txt,"~",2
|
||||||
vis tIcon1,1
|
vis tIcon1,1
|
||||||
// change icon color
|
// change icon color
|
||||||
|
|||||||
@@ -443,6 +443,10 @@ Timer tmSerial
|
|||||||
{
|
{
|
||||||
page cardChart
|
page cardChart
|
||||||
}
|
}
|
||||||
|
if(tId.txt=="cardLChart")
|
||||||
|
{
|
||||||
|
page cardLChart
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// end of user code
|
// end of user code
|
||||||
udelete payloadLength-1
|
udelete payloadLength-1
|
||||||
|
|||||||
@@ -48,11 +48,41 @@ Page screensaver2
|
|||||||
Postinitialize Event
|
Postinitialize Event
|
||||||
click m0,1
|
click m0,1
|
||||||
|
|
||||||
|
Variable (string) entn1
|
||||||
|
Attributes
|
||||||
|
Scope : local
|
||||||
|
Text :
|
||||||
|
Max. Text Size: 14
|
||||||
|
|
||||||
|
Variable (string) entn2
|
||||||
|
Attributes
|
||||||
|
Scope : local
|
||||||
|
Text :
|
||||||
|
Max. Text Size: 14
|
||||||
|
|
||||||
|
Variable (string) entn3
|
||||||
|
Attributes
|
||||||
|
Scope : local
|
||||||
|
Text :
|
||||||
|
Max. Text Size: 14
|
||||||
|
|
||||||
|
Variable (string) entn4
|
||||||
|
Attributes
|
||||||
|
Scope : local
|
||||||
|
Text :
|
||||||
|
Max. Text Size: 14
|
||||||
|
|
||||||
|
Variable (string) entn5
|
||||||
|
Attributes
|
||||||
|
Scope : local
|
||||||
|
Text :
|
||||||
|
Max. Text Size: 14
|
||||||
|
|
||||||
Variable (string) strCommand
|
Variable (string) strCommand
|
||||||
Attributes
|
Attributes
|
||||||
Scope : local
|
Scope : local
|
||||||
Text :
|
Text :
|
||||||
Max. Text Size: 1979
|
Max. Text Size: 1935
|
||||||
|
|
||||||
Variable (string) strTmp
|
Variable (string) strTmp
|
||||||
Attributes
|
Attributes
|
||||||
@@ -70,7 +100,7 @@ Variable (string) tInstruction
|
|||||||
Attributes
|
Attributes
|
||||||
Scope : local
|
Scope : local
|
||||||
Text :
|
Text :
|
||||||
Max. Text Size: 50
|
Max. Text Size: 15
|
||||||
|
|
||||||
Variable (string) tSend
|
Variable (string) tSend
|
||||||
Attributes
|
Attributes
|
||||||
@@ -82,7 +112,7 @@ Variable (string) tTmp
|
|||||||
Attributes
|
Attributes
|
||||||
Scope : local
|
Scope : local
|
||||||
Text :
|
Text :
|
||||||
Max. Text Size: 50
|
Max. Text Size: 30
|
||||||
|
|
||||||
Variable (int32) vaTap
|
Variable (int32) vaTap
|
||||||
Attributes
|
Attributes
|
||||||
@@ -344,6 +374,25 @@ Text f1Icon
|
|||||||
Text :
|
Text :
|
||||||
Max. Text Size : 4
|
Max. Text Size : 4
|
||||||
|
|
||||||
|
Events
|
||||||
|
Touch Press Event
|
||||||
|
tSend.txt="event,buttonPress2,"+entn1.txt+",button"
|
||||||
|
if(entn1.txt=="")
|
||||||
|
{
|
||||||
|
tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
}
|
||||||
|
//send calc crc
|
||||||
|
btlen tSend.txt,sys0
|
||||||
|
crcrest 1,0xffff // reset CRC
|
||||||
|
crcputh 55 bb
|
||||||
|
crcputs sys0,2
|
||||||
|
crcputs tSend.txt,0
|
||||||
|
//send cmd
|
||||||
|
printh 55 bb
|
||||||
|
prints sys0,2
|
||||||
|
prints tSend.txt,0
|
||||||
|
prints crcval,2
|
||||||
|
|
||||||
Text f2Icon
|
Text f2Icon
|
||||||
Attributes
|
Attributes
|
||||||
Scope : local
|
Scope : local
|
||||||
@@ -353,6 +402,25 @@ Text f2Icon
|
|||||||
Text :
|
Text :
|
||||||
Max. Text Size : 4
|
Max. Text Size : 4
|
||||||
|
|
||||||
|
Events
|
||||||
|
Touch Press Event
|
||||||
|
tSend.txt="event,buttonPress2,"+entn2.txt+",button"
|
||||||
|
if(entn2.txt=="")
|
||||||
|
{
|
||||||
|
tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
}
|
||||||
|
//send calc crc
|
||||||
|
btlen tSend.txt,sys0
|
||||||
|
crcrest 1,0xffff // reset CRC
|
||||||
|
crcputh 55 bb
|
||||||
|
crcputs sys0,2
|
||||||
|
crcputs tSend.txt,0
|
||||||
|
//send cmd
|
||||||
|
printh 55 bb
|
||||||
|
prints sys0,2
|
||||||
|
prints tSend.txt,0
|
||||||
|
prints crcval,2
|
||||||
|
|
||||||
Text f3Icon
|
Text f3Icon
|
||||||
Attributes
|
Attributes
|
||||||
Scope : local
|
Scope : local
|
||||||
@@ -362,6 +430,25 @@ Text f3Icon
|
|||||||
Text :
|
Text :
|
||||||
Max. Text Size : 4
|
Max. Text Size : 4
|
||||||
|
|
||||||
|
Events
|
||||||
|
Touch Press Event
|
||||||
|
tSend.txt="event,buttonPress2,"+entn3.txt+",button"
|
||||||
|
if(entn3.txt=="")
|
||||||
|
{
|
||||||
|
tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
}
|
||||||
|
//send calc crc
|
||||||
|
btlen tSend.txt,sys0
|
||||||
|
crcrest 1,0xffff // reset CRC
|
||||||
|
crcputh 55 bb
|
||||||
|
crcputs sys0,2
|
||||||
|
crcputs tSend.txt,0
|
||||||
|
//send cmd
|
||||||
|
printh 55 bb
|
||||||
|
prints sys0,2
|
||||||
|
prints tSend.txt,0
|
||||||
|
prints crcval,2
|
||||||
|
|
||||||
Text f4Icon
|
Text f4Icon
|
||||||
Attributes
|
Attributes
|
||||||
Scope : local
|
Scope : local
|
||||||
@@ -371,6 +458,25 @@ Text f4Icon
|
|||||||
Text :
|
Text :
|
||||||
Max. Text Size : 4
|
Max. Text Size : 4
|
||||||
|
|
||||||
|
Events
|
||||||
|
Touch Press Event
|
||||||
|
tSend.txt="event,buttonPress2,"+entn4.txt+",button"
|
||||||
|
if(entn4.txt=="")
|
||||||
|
{
|
||||||
|
tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
}
|
||||||
|
//send calc crc
|
||||||
|
btlen tSend.txt,sys0
|
||||||
|
crcrest 1,0xffff // reset CRC
|
||||||
|
crcputh 55 bb
|
||||||
|
crcputs sys0,2
|
||||||
|
crcputs tSend.txt,0
|
||||||
|
//send cmd
|
||||||
|
printh 55 bb
|
||||||
|
prints sys0,2
|
||||||
|
prints tSend.txt,0
|
||||||
|
prints crcval,2
|
||||||
|
|
||||||
Text f5Icon
|
Text f5Icon
|
||||||
Attributes
|
Attributes
|
||||||
Scope : local
|
Scope : local
|
||||||
@@ -380,6 +486,25 @@ Text f5Icon
|
|||||||
Text :
|
Text :
|
||||||
Max. Text Size : 4
|
Max. Text Size : 4
|
||||||
|
|
||||||
|
Events
|
||||||
|
Touch Press Event
|
||||||
|
tSend.txt="event,buttonPress2,"+entn5.txt+",button"
|
||||||
|
if(entn5.txt=="")
|
||||||
|
{
|
||||||
|
tSend.txt="event,buttonPress2,screensaver,bExit,"+tTmp.txt
|
||||||
|
}
|
||||||
|
//send calc crc
|
||||||
|
btlen tSend.txt,sys0
|
||||||
|
crcrest 1,0xffff // reset CRC
|
||||||
|
crcputh 55 bb
|
||||||
|
crcputs sys0,2
|
||||||
|
crcputs tSend.txt,0
|
||||||
|
//send cmd
|
||||||
|
printh 55 bb
|
||||||
|
prints sys0,2
|
||||||
|
prints tSend.txt,0
|
||||||
|
prints crcval,2
|
||||||
|
|
||||||
Text m0
|
Text m0
|
||||||
Attributes
|
Attributes
|
||||||
Scope : local
|
Scope : local
|
||||||
@@ -718,26 +843,36 @@ Timer tmSerial
|
|||||||
//f1Icon Color
|
//f1Icon Color
|
||||||
spstr strCommand.txt,tTmp.txt,"~",64
|
spstr strCommand.txt,tTmp.txt,"~",64
|
||||||
covx tTmp.txt,f1Icon.pco,0,0
|
covx tTmp.txt,f1Icon.pco,0,0
|
||||||
|
//f1Icon intNameEntity
|
||||||
|
spstr strCommand.txt,entn1.txt,"~",62
|
||||||
//f2Icon
|
//f2Icon
|
||||||
spstr strCommand.txt,f2Icon.txt,"~",69
|
spstr strCommand.txt,f2Icon.txt,"~",69
|
||||||
//f2Icon Color
|
//f2Icon Color
|
||||||
spstr strCommand.txt,tTmp.txt,"~",70
|
spstr strCommand.txt,tTmp.txt,"~",70
|
||||||
covx tTmp.txt,f2Icon.pco,0,0
|
covx tTmp.txt,f2Icon.pco,0,0
|
||||||
|
//f2Icon intNameEntity
|
||||||
|
spstr strCommand.txt,entn2.txt,"~",68
|
||||||
//f3Icon
|
//f3Icon
|
||||||
spstr strCommand.txt,f3Icon.txt,"~",75
|
spstr strCommand.txt,f3Icon.txt,"~",75
|
||||||
//f3Icon Color
|
//f3Icon Color
|
||||||
spstr strCommand.txt,tTmp.txt,"~",76
|
spstr strCommand.txt,tTmp.txt,"~",76
|
||||||
covx tTmp.txt,f3Icon.pco,0,0
|
covx tTmp.txt,f3Icon.pco,0,0
|
||||||
|
//f3Icon intNameEntity
|
||||||
|
spstr strCommand.txt,entn3.txt,"~",74
|
||||||
//f4Icon
|
//f4Icon
|
||||||
spstr strCommand.txt,f4Icon.txt,"~",81
|
spstr strCommand.txt,f4Icon.txt,"~",81
|
||||||
//f4Icon Color
|
//f4Icon Color
|
||||||
spstr strCommand.txt,tTmp.txt,"~",82
|
spstr strCommand.txt,tTmp.txt,"~",82
|
||||||
covx tTmp.txt,f4Icon.pco,0,0
|
covx tTmp.txt,f4Icon.pco,0,0
|
||||||
|
//f4Icon intNameEntity
|
||||||
|
spstr strCommand.txt,entn4.txt,"~",80
|
||||||
//f5Icon
|
//f5Icon
|
||||||
spstr strCommand.txt,f5Icon.txt,"~",87
|
spstr strCommand.txt,f5Icon.txt,"~",87
|
||||||
//f5Icon Color
|
//f5Icon Color
|
||||||
spstr strCommand.txt,tTmp.txt,"~",88
|
spstr strCommand.txt,tTmp.txt,"~",88
|
||||||
covx tTmp.txt,f5Icon.pco,0,0
|
covx tTmp.txt,f5Icon.pco,0,0
|
||||||
|
//f5Icon intNameEntity
|
||||||
|
spstr strCommand.txt,entn5.txt,"~",86
|
||||||
}
|
}
|
||||||
if(tInstruction.txt=="notify")
|
if(tInstruction.txt=="notify")
|
||||||
{
|
{
|
||||||
|
|||||||
BIN
HMI/nspanel.HMI
BIN
HMI/nspanel.HMI
Binary file not shown.
BIN
HMI/nspanel.tft
BIN
HMI/nspanel.tft
Binary file not shown.
@@ -5,7 +5,7 @@ If you like this project consider buying me a pizza 🍕 <a href="https://paypal
|
|||||||
[](https://github.com/hacs/integration)
|
[](https://github.com/hacs/integration)
|
||||||

|

|
||||||
[](https://github.com/joBr99/nspanel-lovelace-ui/releases)
|
[](https://github.com/joBr99/nspanel-lovelace-ui/releases)
|
||||||

|

|
||||||
[](https://github.com/joBr99/nspanel-lovelace-ui/commits/main)
|
[](https://github.com/joBr99/nspanel-lovelace-ui/commits/main)
|
||||||
|
|
||||||
|
|
||||||
@@ -65,3 +65,5 @@ SmartHomeNG: https://github.com/sisamiwe/shng-nspanel-plugin
|
|||||||
OpenHAB: https://github.com/donoo/o2n2l
|
OpenHAB: https://github.com/donoo/o2n2l
|
||||||
|
|
||||||
NodeRed: https://github.com/laluz742/node-red-contrib-nspanel-lui
|
NodeRed: https://github.com/laluz742/node-red-contrib-nspanel-lui
|
||||||
|
|
||||||
|
ESPHome without any Backend: https://github.com/olicooper/esphome-nspanel-lovelace-native
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
ha_api = None
|
ha_api = None
|
||||||
mqtt_api = None
|
mqtt_api = None
|
||||||
|
ad_api = None
|
||||||
@@ -132,6 +132,7 @@ class LuiBackendConfig(object):
|
|||||||
'sleepTrackingZones': ["not_home", "off"],
|
'sleepTrackingZones': ["not_home", "off"],
|
||||||
'sleepOverride': None,
|
'sleepOverride': None,
|
||||||
'locale': "en_US",
|
'locale': "en_US",
|
||||||
|
'quiet': True,
|
||||||
'timeFormat': "%H:%M",
|
'timeFormat': "%H:%M",
|
||||||
'dateFormatBabel': "full",
|
'dateFormatBabel': "full",
|
||||||
'dateAdditionalTemplate': "",
|
'dateAdditionalTemplate': "",
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import datetime
|
|||||||
import apis
|
import apis
|
||||||
from helper import scale, pos_to_color, rgb_dec565
|
from helper import scale, pos_to_color, rgb_dec565
|
||||||
from pages import LuiPagesGen
|
from pages import LuiPagesGen
|
||||||
|
from luibackend.config import Card
|
||||||
|
|
||||||
class LuiController(object):
|
class LuiController(object):
|
||||||
|
|
||||||
@@ -150,7 +151,7 @@ class LuiController(object):
|
|||||||
items = self._config.get_all_entity_names()
|
items = self._config.get_all_entity_names()
|
||||||
apis.ha_api.log(f"gtest123: {items}")
|
apis.ha_api.log(f"gtest123: {items}")
|
||||||
prefixes = ("navigate.", "delete", "iText")
|
prefixes = ("navigate.", "delete", "iText")
|
||||||
items = [x for x in items if not (x is None or x.startswith(prefixes))]
|
items = set([x for x in items if not (x is None or x.startswith(prefixes))])
|
||||||
apis.ha_api.log(f"Registering callbacks for the following items: {items}")
|
apis.ha_api.log(f"Registering callbacks for the following items: {items}")
|
||||||
for item in items:
|
for item in items:
|
||||||
if apis.ha_api.entity_exists(item):
|
if apis.ha_api.entity_exists(item):
|
||||||
@@ -205,11 +206,15 @@ class LuiController(object):
|
|||||||
self._pages_gen.generate_timer_detail_page(entity_id, True)
|
self._pages_gen.generate_timer_detail_page(entity_id, True)
|
||||||
|
|
||||||
def button_press(self, entity_id, button_type, value):
|
def button_press(self, entity_id, button_type, value):
|
||||||
apis.ha_api.log(f"Button Press Event; entity_id: {entity_id}; button_type: {button_type}; value: {value} ")
|
#apis.ha_api.log(f"Button Press Event; entity_id: {entity_id}; button_type: {button_type}; value: {value} ")
|
||||||
|
entity_id_new = entity_id
|
||||||
if entity_id.startswith('uuid'):
|
if entity_id.startswith('uuid'):
|
||||||
entity_config = self._config._config_entites_table.get(entity_id)
|
entity_config = self._config._config_entites_table.get(entity_id)
|
||||||
if entity_config is not None:
|
if entity_config is not None:
|
||||||
entity_id = entity_config.entityId
|
entity_id_new = entity_config.entityId
|
||||||
|
apis.ha_api.log(f"Button Press Event; entity_id: {entity_id}; entity_id_resolved: {entity_id_new}; button_type: {button_type}; value: {value} ")
|
||||||
|
entity_id = entity_id_new
|
||||||
|
|
||||||
# internal buttons
|
# internal buttons
|
||||||
if entity_id == "screensaver" and button_type == "bExit":
|
if entity_id == "screensaver" and button_type == "bExit":
|
||||||
# get default card if there is one
|
# get default card if there is one
|
||||||
@@ -333,6 +338,11 @@ class LuiController(object):
|
|||||||
apis.ha_api.get_entity(entity_id).call_service("return_to_base")
|
apis.ha_api.get_entity(entity_id).call_service("return_to_base")
|
||||||
elif entity_id.startswith('service'):
|
elif entity_id.startswith('service'):
|
||||||
apis.ha_api.call_service(entity_id.replace('service.', '', 1).replace('.','/', 1), **entity_config.data)
|
apis.ha_api.call_service(entity_id.replace('service.', '', 1).replace('.','/', 1), **entity_config.data)
|
||||||
|
elif entity_id.startswith('valve'):
|
||||||
|
if apis.ha_api.get_entity(entity_id).state == "open":
|
||||||
|
apis.ha_api.get_entity(entity_id).call_service("close_valve")
|
||||||
|
else:
|
||||||
|
apis.ha_api.get_entity(entity_id).call_service("open_valve")
|
||||||
|
|
||||||
# for media page
|
# for media page
|
||||||
if button_type == "media-next":
|
if button_type == "media-next":
|
||||||
@@ -347,8 +357,8 @@ class LuiController(object):
|
|||||||
else:
|
else:
|
||||||
apis.ha_api.get_entity(entity_id).call_service("turn_off")
|
apis.ha_api.get_entity(entity_id).call_service("turn_off")
|
||||||
if button_type == "media-shuffle":
|
if button_type == "media-shuffle":
|
||||||
suffle = not apis.ha_api.get_entity(entity_id).attributes.shuffle
|
shuffle = not apis.ha_api.get_entity(entity_id).attributes['shuffle']
|
||||||
apis.ha_api.get_entity(entity_id).call_service("shuffle_set", shuffle=suffle)
|
apis.ha_api.get_entity(entity_id).call_service("shuffle_set", shuffle=shuffle)
|
||||||
if button_type == "volumeSlider":
|
if button_type == "volumeSlider":
|
||||||
pos = int(value)
|
pos = int(value)
|
||||||
# HA wants this value between 0 and 1 as float
|
# HA wants this value between 0 and 1 as float
|
||||||
@@ -365,7 +375,7 @@ class LuiController(object):
|
|||||||
if button_type == "colorTempSlider":
|
if button_type == "colorTempSlider":
|
||||||
entity = apis.ha_api.get_entity(entity_id)
|
entity = apis.ha_api.get_entity(entity_id)
|
||||||
#scale 0-100 from slider to color range of lamp
|
#scale 0-100 from slider to color range of lamp
|
||||||
color_val = scale(int(value), (0, 100), (entity.attributes.min_mireds, entity.attributes.max_mireds))
|
color_val = scale(int(value), (0, 100), (entity.attributes['min_mireds'], entity.attributes['max_mireds']))
|
||||||
apis.ha_api.get_entity(entity_id).call_service("turn_on", color_temp=color_val)
|
apis.ha_api.get_entity(entity_id).call_service("turn_on", color_temp=color_val)
|
||||||
if button_type == "colorWheel":
|
if button_type == "colorWheel":
|
||||||
apis.ha_api.log(value)
|
apis.ha_api.log(value)
|
||||||
@@ -392,9 +402,9 @@ class LuiController(object):
|
|||||||
if button_type == "opnSensorNotify":
|
if button_type == "opnSensorNotify":
|
||||||
msg = ""
|
msg = ""
|
||||||
entity = apis.ha_api.get_entity(entity_id)
|
entity = apis.ha_api.get_entity(entity_id)
|
||||||
if "open_sensors" in entity.attributes and entity.attributes.open_sensors is not None:
|
if open_sensors := entity.attributes.get("open_sensors") is not None:
|
||||||
for e in entity.attributes.open_sensors:
|
for e in open_sensors:
|
||||||
msg += f"- {apis.ha_api.get_entity(e).attributes.friendly_name}\r\n"
|
msg += f"- {apis.ha_api.get_entity(e).attributes['friendly_name']}\r\n"
|
||||||
self._pages_gen.send_message_page("opnSensorNotifyRes", "", msg, "", "")
|
self._pages_gen.send_message_page("opnSensorNotifyRes", "", msg, "", "")
|
||||||
|
|
||||||
# for cardUnlock
|
# for cardUnlock
|
||||||
@@ -411,22 +421,22 @@ class LuiController(object):
|
|||||||
|
|
||||||
if button_type == "mode-preset_modes":
|
if button_type == "mode-preset_modes":
|
||||||
entity = apis.ha_api.get_entity(entity_id)
|
entity = apis.ha_api.get_entity(entity_id)
|
||||||
preset_mode = entity.attributes.preset_modes[int(value)]
|
preset_mode = entity.attributes['preset_modes'][int(value)]
|
||||||
entity.call_service("set_preset_mode", preset_mode=preset_mode)
|
entity.call_service("set_preset_mode", preset_mode=preset_mode)
|
||||||
|
|
||||||
if button_type == "mode-swing_modes":
|
if button_type == "mode-swing_modes":
|
||||||
entity = apis.ha_api.get_entity(entity_id)
|
entity = apis.ha_api.get_entity(entity_id)
|
||||||
swing_mode = entity.attributes.swing_modes[int(value)]
|
swing_mode = entity.attributes['swing_modes'][int(value)]
|
||||||
entity.call_service("set_swing_mode", swing_mode=swing_mode)
|
entity.call_service("set_swing_mode", swing_mode=swing_mode)
|
||||||
|
|
||||||
if button_type == "mode-fan_modes":
|
if button_type == "mode-fan_modes":
|
||||||
entity = apis.ha_api.get_entity(entity_id)
|
entity = apis.ha_api.get_entity(entity_id)
|
||||||
fan_mode = entity.attributes.fan_modes[int(value)]
|
fan_mode = entity.attributes['fan_modes'][int(value)]
|
||||||
entity.call_service("set_fan_mode", fan_mode=fan_mode)
|
entity.call_service("set_fan_mode", fan_mode=fan_mode)
|
||||||
|
|
||||||
if button_type in ["mode-input_select", "mode-select"]:
|
if button_type in ["mode-input_select", "mode-select"]:
|
||||||
entity = apis.ha_api.get_entity(entity_id)
|
entity = apis.ha_api.get_entity(entity_id)
|
||||||
option = entity.attributes.options[int(value)]
|
option = entity.attributes['options'][int(value)]
|
||||||
entity.call_service("select_option", option=option)
|
entity.call_service("select_option", option=option)
|
||||||
|
|
||||||
if button_type == "mode-light":
|
if button_type == "mode-light":
|
||||||
@@ -438,12 +448,12 @@ class LuiController(object):
|
|||||||
if options_list is not None:
|
if options_list is not None:
|
||||||
option = options_list[int(value)]
|
option = options_list[int(value)]
|
||||||
else:
|
else:
|
||||||
option = entity.attributes.effect_list[int(value)]
|
option = entity.attributes['effect_list'][int(value)]
|
||||||
entity.call_service("turn_on", effect=option)
|
entity.call_service("turn_on", effect=option)
|
||||||
|
|
||||||
if button_type == "mode-media_player":
|
if button_type == "mode-media_player":
|
||||||
entity = apis.ha_api.get_entity(entity_id)
|
entity = apis.ha_api.get_entity(entity_id)
|
||||||
option = entity.attributes.source_list[int(value)]
|
option = entity.attributes['source_list'][int(value)]
|
||||||
entity.call_service("select_source", source=option)
|
entity.call_service("select_source", source=option)
|
||||||
|
|
||||||
# timer detail page
|
# timer detail page
|
||||||
@@ -458,3 +468,9 @@ class LuiController(object):
|
|||||||
apis.ha_api.get_entity(entity_id).call_service("pause")
|
apis.ha_api.get_entity(entity_id).call_service("pause")
|
||||||
if button_type == "timer-finish":
|
if button_type == "timer-finish":
|
||||||
apis.ha_api.get_entity(entity_id).call_service("finish")
|
apis.ha_api.get_entity(entity_id).call_service("finish")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def current_card(self) -> Card:
|
||||||
|
"""Used to get the current card"""
|
||||||
|
|
||||||
|
return self._current_card
|
||||||
|
|||||||
@@ -159,8 +159,8 @@ alarm_control_panel_mapping = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
climate_mapping = {
|
climate_mapping = {
|
||||||
'auto': 'calendar-sync',
|
'auto': 'fan-auto',
|
||||||
'heat_cool': 'calendar-sync',
|
'heat_cool': 'sun-snowflake-variant',
|
||||||
'heat': 'fire',
|
'heat': 'fire',
|
||||||
'off': 'power',
|
'off': 'power',
|
||||||
'cool': 'snowflake',
|
'cool': 'snowflake',
|
||||||
@@ -213,6 +213,9 @@ def get_icon_ha(entity_id, overwrite=None, stateOverwrite=None):
|
|||||||
entity = apis.ha_api.get_entity(entity_id)
|
entity = apis.ha_api.get_entity(entity_id)
|
||||||
state = entity.state if stateOverwrite is None else stateOverwrite
|
state = entity.state if stateOverwrite is None else stateOverwrite
|
||||||
|
|
||||||
|
if entity_id in ["sensor.weather_forecast_daily", "sensor.weather_forecast_hourly"]:
|
||||||
|
ha_type = "weather"
|
||||||
|
|
||||||
if overwrite is not None:
|
if overwrite is not None:
|
||||||
if type(overwrite) is str:
|
if type(overwrite) is str:
|
||||||
return get_icon_char(overwrite)
|
return get_icon_char(overwrite)
|
||||||
@@ -263,8 +266,8 @@ def get_icon_ha(entity_id, overwrite=None, stateOverwrite=None):
|
|||||||
# based on media_content_type
|
# based on media_content_type
|
||||||
elif ha_type == "media_player":
|
elif ha_type == "media_player":
|
||||||
result_icon = "speaker-off"
|
result_icon = "speaker-off"
|
||||||
if "media_content_type" in entity.attributes:
|
if media_content_type := entity.attributes.get("media_content_type"):
|
||||||
if entity.attributes.media_content_type in media_content_type_mapping:
|
if media_content_type in media_content_type_mapping:
|
||||||
result_icon = media_content_type_mapping[entity.attributes.media_content_type]
|
result_icon = media_content_type_mapping[media_content_type]
|
||||||
|
|
||||||
return get_icon_char(result_icon)
|
return get_icon_char(result_icon)
|
||||||
|
|||||||
@@ -77,12 +77,13 @@ class LuiMqttListener(object):
|
|||||||
self._controller.detail_open(msg[2], msg[3])
|
self._controller.detail_open(msg[2], msg[3])
|
||||||
|
|
||||||
class LuiMqttSender(object):
|
class LuiMqttSender(object):
|
||||||
def __init__(self, api, use_api, topic_send, api_panel_name):
|
def __init__(self, api, use_api, topic_send, api_panel_name, quiet):
|
||||||
self._ha_api = api
|
self._ha_api = api
|
||||||
self._use_api = use_api
|
self._use_api = use_api
|
||||||
self._topic_send = topic_send
|
self._topic_send = topic_send
|
||||||
self._api_panel_name = api_panel_name
|
self._api_panel_name = api_panel_name
|
||||||
self._prev_msg = ""
|
self._prev_msg = ""
|
||||||
|
self._quiet = quiet
|
||||||
|
|
||||||
def send_mqtt_msg(self, msg, topic=None, force=False):
|
def send_mqtt_msg(self, msg, topic=None, force=False):
|
||||||
if not force and self._prev_msg == msg:
|
if not force and self._prev_msg == msg:
|
||||||
@@ -90,7 +91,9 @@ class LuiMqttSender(object):
|
|||||||
return
|
return
|
||||||
self._prev_msg = msg
|
self._prev_msg = msg
|
||||||
|
|
||||||
apis.ha_api.log(f"Sending Message: {msg}")
|
if self._quiet is False:
|
||||||
|
apis.ha_api.log(f"Sending Message: {msg}")
|
||||||
|
|
||||||
if self._use_api:
|
if self._use_api:
|
||||||
apis.ha_api.call_service(service="esphome/" + self._api_panel_name + "_nspanelui_api_call", command=2, data=msg)
|
apis.ha_api.call_service(service="esphome/" + self._api_panel_name + "_nspanelui_api_call", command=2, data=msg)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class LuiPagesGen(object):
|
|||||||
self._config = config
|
self._config = config
|
||||||
self._locale = config.get("locale")
|
self._locale = config.get("locale")
|
||||||
self._send_mqtt_msg = send_mqtt_msg
|
self._send_mqtt_msg = send_mqtt_msg
|
||||||
|
|
||||||
def get_entity_color(self, entity, ha_type=None, stateOverwrite=None, overwrite=None):
|
def get_entity_color(self, entity, ha_type=None, stateOverwrite=None, overwrite=None):
|
||||||
if overwrite is not None:
|
if overwrite is not None:
|
||||||
if type(overwrite) in [str, list]:
|
if type(overwrite) in [str, list]:
|
||||||
@@ -82,7 +82,7 @@ class LuiPagesGen(object):
|
|||||||
icon_color = 63878 #red
|
icon_color = 63878 #red
|
||||||
if state == "fog":
|
if state == "fog":
|
||||||
icon_color = 38066 #75% grey
|
icon_color = 38066 #75% grey
|
||||||
if state in ["hail", "snowy"]:
|
if state in ["hail", "snowy"]:
|
||||||
icon_color = 65535 #white
|
icon_color = 65535 #white
|
||||||
if state == "lightning":
|
if state == "lightning":
|
||||||
icon_color = 65120 #golden-yellow
|
icon_color = 65120 #golden-yellow
|
||||||
@@ -97,13 +97,12 @@ class LuiPagesGen(object):
|
|||||||
if state == "sunny":
|
if state == "sunny":
|
||||||
icon_color = 65504 #bright-yellow
|
icon_color = 65504 #bright-yellow
|
||||||
|
|
||||||
if "rgb_color" in attr and attr.rgb_color:
|
if color := attr.get("rgb_color"):
|
||||||
color = attr.rgb_color
|
if brightness := attr.get("brightness"):
|
||||||
if "brightness" in attr and attr.brightness:
|
color = rgb_brightness(color, brightness)
|
||||||
color = rgb_brightness(color, attr.brightness)
|
|
||||||
icon_color = rgb_dec565(color)
|
icon_color = rgb_dec565(color)
|
||||||
elif "brightness" in attr and attr.brightness:
|
elif brightness := attr.get("brightness"):
|
||||||
color = rgb_brightness([253, 216, 53], attr.brightness)
|
color = rgb_brightness([253, 216, 53], brightness)
|
||||||
icon_color = rgb_dec565(color)
|
icon_color = rgb_dec565(color)
|
||||||
return icon_color
|
return icon_color
|
||||||
|
|
||||||
@@ -129,7 +128,7 @@ class LuiPagesGen(object):
|
|||||||
else:
|
else:
|
||||||
dateformat = self._config.get("dateFormat")
|
dateformat = self._config.get("dateFormat")
|
||||||
date = datetime.datetime.now().strftime(dateformat)
|
date = datetime.datetime.now().strftime(dateformat)
|
||||||
|
|
||||||
addTemplate = self._config.get("dateAdditionalTemplate")
|
addTemplate = self._config.get("dateAdditionalTemplate")
|
||||||
addDateText = apis.ha_api.render_template(addTemplate)
|
addDateText = apis.ha_api.render_template(addTemplate)
|
||||||
self._send_mqtt_msg(f"date~{date}{addDateText}")
|
self._send_mqtt_msg(f"date~{date}{addDateText}")
|
||||||
@@ -138,7 +137,7 @@ class LuiPagesGen(object):
|
|||||||
if target_page == "cardUnlock":
|
if target_page == "cardUnlock":
|
||||||
target_page = "cardAlarm"
|
target_page = "cardAlarm"
|
||||||
self._send_mqtt_msg(f"pageType~{target_page}")
|
self._send_mqtt_msg(f"pageType~{target_page}")
|
||||||
|
|
||||||
def update_screensaver_weather(self, theme):
|
def update_screensaver_weather(self, theme):
|
||||||
entities = self._config._config_screensaver.entities
|
entities = self._config._config_screensaver.entities
|
||||||
|
|
||||||
@@ -151,7 +150,7 @@ class LuiPagesGen(object):
|
|||||||
item_str = ""
|
item_str = ""
|
||||||
for item in entities:
|
for item in entities:
|
||||||
item_str += self.generate_entities_item(item, "cardEntities", mask=["type", "entityId"])
|
item_str += self.generate_entities_item(item, "cardEntities", mask=["type", "entityId"])
|
||||||
|
|
||||||
self._send_mqtt_msg(f"weatherUpdate{item_str}")
|
self._send_mqtt_msg(f"weatherUpdate{item_str}")
|
||||||
# send color if configured in screensaver
|
# send color if configured in screensaver
|
||||||
if theme is not None:
|
if theme is not None:
|
||||||
@@ -181,17 +180,20 @@ class LuiPagesGen(object):
|
|||||||
colorOverride = item.colorOverride
|
colorOverride = item.colorOverride
|
||||||
name = item.nameOverride
|
name = item.nameOverride
|
||||||
uuid = item.uuid
|
uuid = item.uuid
|
||||||
|
|
||||||
# check ha template for name
|
# check ha template for name
|
||||||
if item.nameOverride is not None and ("{" in item.nameOverride and "}" in item.nameOverride):
|
if item.nameOverride is not None and ("{" in item.nameOverride and "}" in item.nameOverride):
|
||||||
name = apis.ha_api.render_template(item.nameOverride)
|
name = apis.ha_api.render_template(item.nameOverride)
|
||||||
|
|
||||||
# type of the item is the string before the "." in the entityId
|
# type of the item is the string before the "." in the entityId
|
||||||
if entityId is not None:
|
if entityId is not None:
|
||||||
entityType = entityId.split(".")[0]
|
entityType = entityId.split(".")[0]
|
||||||
else:
|
else:
|
||||||
entityType = "delete"
|
entityType = "delete"
|
||||||
|
|
||||||
|
if entityId in ["sensor.weather_forecast_daily", "sensor.weather_forecast_hourly"]:
|
||||||
|
entityType = "weather"
|
||||||
|
|
||||||
apis.ha_api.log(f"Generating item for {entityId} with type {entityType}", level="DEBUG")
|
apis.ha_api.log(f"Generating item for {entityId} with type {entityType}", level="DEBUG")
|
||||||
|
|
||||||
status_entity = apis.ha_api.get_entity(item.status) if item.status and apis.ha_api.entity_exists(item.status) else None
|
status_entity = apis.ha_api.get_entity(item.status) if item.status and apis.ha_api.entity_exists(item.status) else None
|
||||||
@@ -221,7 +223,7 @@ class LuiPagesGen(object):
|
|||||||
if status_entity:
|
if status_entity:
|
||||||
icon_res = get_icon_ha(item.status, overwrite=icon)
|
icon_res = get_icon_ha(item.status, overwrite=icon)
|
||||||
icon_color = self.get_entity_color(status_entity, ha_type=item.status.split(".")[0], overwrite=colorOverride)
|
icon_color = self.get_entity_color(status_entity, ha_type=item.status.split(".")[0], overwrite=colorOverride)
|
||||||
if item.status.startswith("sensor") and (cardType == "cardGrid" or cardType == "cardGrid2") and item.iconOverride is None:
|
if item.status.startswith("sensor") and cardType in ["cardGrid", "cardGrid1", "cardGrid2"] and item.iconOverride is None:
|
||||||
icon_res = status_entity.state[:4]
|
icon_res = status_entity.state[:4]
|
||||||
if icon_res[-1] == ".":
|
if icon_res[-1] == ".":
|
||||||
icon_res = icon_res[:-1]
|
icon_res = icon_res[:-1]
|
||||||
@@ -245,7 +247,7 @@ class LuiPagesGen(object):
|
|||||||
if status_entity:
|
if status_entity:
|
||||||
icon_id = get_icon_ha(item.status, overwrite=icon)
|
icon_id = get_icon_ha(item.status, overwrite=icon)
|
||||||
icon_color = self.get_entity_color(status_entity, ha_type=item.status.split(".")[0], overwrite=colorOverride)
|
icon_color = self.get_entity_color(status_entity, ha_type=item.status.split(".")[0], overwrite=colorOverride)
|
||||||
if item.status.startswith("sensor") and (cardType == "cardGrid" or cardType == "cardGrid2") and item.iconOverride is None:
|
if item.status.startswith("sensor") and cardType in ["cardGrid", "cardGrid1", "cardGrid2"] and item.iconOverride is None:
|
||||||
icon_id = status_entity.state[:4]
|
icon_id = status_entity.state[:4]
|
||||||
if icon_id[-1] == ".":
|
if icon_id[-1] == ".":
|
||||||
icon_id = icon_id[:-1]
|
icon_id = icon_id[:-1]
|
||||||
@@ -254,7 +256,7 @@ class LuiPagesGen(object):
|
|||||||
if entity is None:
|
if entity is None:
|
||||||
return f"~text~{entityId}~{get_icon_id('alert-circle-outline')}~17299~Not found check~ apps.yaml"
|
return f"~text~{entityId}~{get_icon_id('alert-circle-outline')}~17299~Not found check~ apps.yaml"
|
||||||
|
|
||||||
|
|
||||||
# HA Entities
|
# HA Entities
|
||||||
# common res vars
|
# common res vars
|
||||||
entityTypePanel = "text"
|
entityTypePanel = "text"
|
||||||
@@ -273,7 +275,7 @@ class LuiPagesGen(object):
|
|||||||
icon_up_status = "disable"
|
icon_up_status = "disable"
|
||||||
icon_stop_status = "disable"
|
icon_stop_status = "disable"
|
||||||
icon_down_status = "disable"
|
icon_down_status = "disable"
|
||||||
bits = entity.attributes.supported_features
|
bits = entity.attributes.get('supported_features')
|
||||||
pos = entity.attributes.get("current_position")
|
pos = entity.attributes.get("current_position")
|
||||||
if pos is None:
|
if pos is None:
|
||||||
pos_status = entity.state
|
pos_status = entity.state
|
||||||
@@ -306,19 +308,24 @@ class LuiPagesGen(object):
|
|||||||
device_class = entity.attributes.get("device_class", "")
|
device_class = entity.attributes.get("device_class", "")
|
||||||
unit_of_measurement = entity.attributes.get("unit_of_measurement", "")
|
unit_of_measurement = entity.attributes.get("unit_of_measurement", "")
|
||||||
value = entity.state
|
value = entity.state
|
||||||
|
|
||||||
|
try:
|
||||||
|
value = str(round(float(value), 1))
|
||||||
|
except:
|
||||||
|
print("An exception occurred")
|
||||||
|
|
||||||
# limit value to 4 chars on us-p
|
# limit value to 4 chars on us-p
|
||||||
if self._config.get("model") == "us-p" and cardType == "cardEntities":
|
if self._config.get("model") == "us-p" and cardType == "cardEntities":
|
||||||
value = entity.state[:4]
|
value = entity.state[:4]
|
||||||
if value[-1] == ".":
|
if value[-1] == ".":
|
||||||
value = value[:-1]
|
value = value[:-1]
|
||||||
|
|
||||||
if device_class != "temperature":
|
if device_class != "temperature":
|
||||||
value = value + " "
|
value = value + " "
|
||||||
value = value + unit_of_measurement
|
value = value + unit_of_measurement
|
||||||
if entityType == "binary_sensor":
|
if entityType == "binary_sensor":
|
||||||
value = get_translation(self._locale, f"backend.component.binary_sensor.state.{device_class}.{entity.state}")
|
value = get_translation(self._locale, f"backend.component.binary_sensor.state.{device_class}.{entity.state}")
|
||||||
if (cardType == "cardGrid" or cardType == "cardGrid2") and entityType == "sensor" and icon is None:
|
if cardType in ["cardGrid", "cardGrid1", "cardGrid2"] and entityType == "sensor" and icon is None:
|
||||||
icon_id = entity.state[:4]
|
icon_id = entity.state[:4]
|
||||||
if icon_id[-1] == ".":
|
if icon_id[-1] == ".":
|
||||||
icon_id = icon_id[:-1]
|
icon_id = icon_id[:-1]
|
||||||
@@ -380,20 +387,51 @@ class LuiPagesGen(object):
|
|||||||
elif entityType == "weather":
|
elif entityType == "weather":
|
||||||
entityTypePanel = "text"
|
entityTypePanel = "text"
|
||||||
unit = get_attr_safe(entity, "temperature_unit", "")
|
unit = get_attr_safe(entity, "temperature_unit", "")
|
||||||
if type(item.stype) == int and len(entity.attributes.forecast) >= item.stype:
|
rt = None
|
||||||
fdate = dp.parse(entity.attributes.forecast[item.stype]['datetime'])
|
index = item.stype
|
||||||
global babel_spec
|
if type(item.stype) == str and ":" in item.stype and len(item.stype.split(":")) == 2:
|
||||||
if babel_spec is not None:
|
spintstr = item.stype.split(":")
|
||||||
dateformat = "E" if item.nameOverride is None else item.nameOverride
|
rt = spintstr[0]
|
||||||
name = babel.dates.format_datetime(fdate.astimezone(), dateformat, locale=self._locale)
|
index = int(spintstr[1])
|
||||||
|
if type(index) == int:
|
||||||
|
bits = get_attr_safe(entity, "supported_features", 0b0)
|
||||||
|
if not rt:
|
||||||
|
rt = "daily"
|
||||||
|
if bits & 0b001: #FORECAST_DAILY
|
||||||
|
rt = "daily"
|
||||||
|
elif bits & 0b010: #FORECAST_HOURLY
|
||||||
|
rt = "hourly"
|
||||||
|
elif bits & 0b100: #FORECAST_TWICE_DAILY
|
||||||
|
rt = "twice_daily"
|
||||||
|
|
||||||
|
results = apis.ha_api.call_service(
|
||||||
|
"weather/get_forecasts", target={"entity_id": entityId}, service_data={"type": rt}
|
||||||
|
)
|
||||||
|
forecast = results.get("result", {}).get("response", {}).get(entityId, {}).get('forecast') or entity.attributes.get('forecast', [])
|
||||||
|
if len(forecast) >= index:
|
||||||
|
day_forecast = forecast[index]
|
||||||
|
fdate = dp.parse(day_forecast['datetime'])
|
||||||
|
global babel_spec
|
||||||
|
if babel_spec is not None:
|
||||||
|
dateformat = "E" if item.nameOverride is None else item.nameOverride
|
||||||
|
name = babel.dates.format_datetime(fdate.astimezone(), dateformat, locale=self._locale)
|
||||||
|
else:
|
||||||
|
dateformat = "%a" if item.nameOverride is None else item.nameOverride
|
||||||
|
name = fdate.astimezone().strftime(dateformat)
|
||||||
|
icon_id = get_icon_ha(entityId, stateOverwrite=day_forecast['condition'])
|
||||||
|
value = f'{day_forecast.get("temperature", "")}{unit}'
|
||||||
|
color = self.get_entity_color(entity, ha_type=entityType, stateOverwrite=day_forecast['condition'], overwrite=colorOverride)
|
||||||
else:
|
else:
|
||||||
dateformat = "%a" if item.nameOverride is None else item.nameOverride
|
value = f'{get_attr_safe(entity, "temperature", "")}{unit}'
|
||||||
name = fdate.astimezone().strftime(dateformat)
|
|
||||||
icon_id = get_icon_ha(entityId, stateOverwrite=entity.attributes.forecast[item.stype]['condition'])
|
|
||||||
value = f'{entity.attributes.forecast[item.stype].get("temperature", "")}{unit}'
|
|
||||||
color = self.get_entity_color(entity, ha_type=entityType, stateOverwrite=entity.attributes.forecast[item.stype]['condition'], overwrite=colorOverride)
|
|
||||||
else:
|
else:
|
||||||
value = f'{get_attr_safe(entity, "temperature", "")}{unit}'
|
value = f'{get_attr_safe(entity, "temperature", "")}{unit}'
|
||||||
|
elif entityType == "valve":
|
||||||
|
entityTypePanel = "valve"
|
||||||
|
value = get_translation(self._locale, f"backend.component.binary_sensor.state.door.{entity.state}")
|
||||||
|
if entity.state == "open":
|
||||||
|
icon_id = get_icon_id("valve-open")
|
||||||
|
else:
|
||||||
|
icon_id = get_icon_id("valve-closed")
|
||||||
else:
|
else:
|
||||||
name = "unsupported"
|
name = "unsupported"
|
||||||
# Overwrite for value
|
# Overwrite for value
|
||||||
@@ -452,7 +490,7 @@ class LuiPagesGen(object):
|
|||||||
command = f"entityUpd~Not found~{navigation}~{item}~check~220~apps.yaml~150~300~5~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Please~your~~"
|
command = f"entityUpd~Not found~{navigation}~{item}~check~220~apps.yaml~150~300~5~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Please~your~~"
|
||||||
else:
|
else:
|
||||||
entity = apis.ha_api.get_entity(item)
|
entity = apis.ha_api.get_entity(item)
|
||||||
heading = title if title != "unknown" else entity.attributes.friendly_name
|
heading = title if title != "unknown" else entity.attributes['friendly_name']
|
||||||
current_temp = get_attr_safe(entity, "current_temperature", "")
|
current_temp = get_attr_safe(entity, "current_temperature", "")
|
||||||
dest_temp = get_attr_safe(entity, "temperature", None)
|
dest_temp = get_attr_safe(entity, "temperature", None)
|
||||||
dest_temp2 = ""
|
dest_temp2 = ""
|
||||||
@@ -473,10 +511,10 @@ class LuiPagesGen(object):
|
|||||||
state_value += get_translation(self._locale, f"backend.component.climate.state._.{entity.state}")
|
state_value += get_translation(self._locale, f"backend.component.climate.state._.{entity.state}")
|
||||||
if hvac_action != "":
|
if hvac_action != "":
|
||||||
state_value += ")"
|
state_value += ")"
|
||||||
|
|
||||||
min_temp = int(get_attr_safe(entity, "min_temp", 0)*10)
|
min_temp = int(get_attr_safe(entity, "min_temp", 0)*10)
|
||||||
max_temp = int(get_attr_safe(entity, "max_temp", 0)*10)
|
max_temp = int(get_attr_safe(entity, "max_temp", 0)*10)
|
||||||
step_temp = int(get_attr_safe(entity, "target_temp_step", 0.5)*10)
|
step_temp = int(get_attr_safe(entity, "target_temp_step", 0.5)*10)
|
||||||
icon_res_list = []
|
icon_res_list = []
|
||||||
icon_res = ""
|
icon_res = ""
|
||||||
|
|
||||||
@@ -501,7 +539,7 @@ class LuiPagesGen(object):
|
|||||||
state = 0
|
state = 0
|
||||||
if(mode == entity.state):
|
if(mode == entity.state):
|
||||||
state = 1
|
state = 1
|
||||||
|
|
||||||
icon_res_list.append(f"~{icon_id}~{color_on}~{state}~{mode}")
|
icon_res_list.append(f"~{icon_id}~{color_on}~{state}~{mode}")
|
||||||
|
|
||||||
icon_res = "".join(icon_res_list)
|
icon_res = "".join(icon_res_list)
|
||||||
@@ -516,11 +554,11 @@ class LuiPagesGen(object):
|
|||||||
icon_res = "~"*4 + icon_res_list[0] + "~"*4 + icon_res_list[1] + "~"*4 + icon_res_list[2] + "~"*4 + icon_res_list[3]
|
icon_res = "~"*4 + icon_res_list[0] + "~"*4 + icon_res_list[1] + "~"*4 + icon_res_list[2] + "~"*4 + icon_res_list[3]
|
||||||
elif len(icon_res_list) >= 5 or self._config.get("model") == "us-p":
|
elif len(icon_res_list) >= 5 or self._config.get("model") == "us-p":
|
||||||
icon_res = "".join(icon_res_list) + "~"*4*(8-len(icon_res_list))
|
icon_res = "".join(icon_res_list) + "~"*4*(8-len(icon_res_list))
|
||||||
|
|
||||||
currently_translation = get_translation(self._locale, "frontend.ui.card.climate.currently")
|
currently_translation = get_translation(self._locale, "frontend.ui.card.climate.currently")
|
||||||
state_translation = get_translation(self._locale, "frontend.ui.panel.config.devices.entities.state")
|
state_translation = get_translation(self._locale, "frontend.ui.panel.config.devices.entities.state")
|
||||||
action_translation = get_translation(self._locale, "frontend.ui.card.climate.operation").replace(' ','\r\n')
|
action_translation = get_translation(self._locale, "frontend.ui.card.climate.operation").replace(' ','\r\n')
|
||||||
|
|
||||||
detailPage = "1"
|
detailPage = "1"
|
||||||
if any(x in ["preset_modes", "swing_modes", "fan_modes"] for x in entity.attributes):
|
if any(x in ["preset_modes", "swing_modes", "fan_modes"] for x in entity.attributes):
|
||||||
detailPage = "0"
|
detailPage = "0"
|
||||||
@@ -534,7 +572,7 @@ class LuiPagesGen(object):
|
|||||||
command = f"entityUpd~Not found~{navigation}"
|
command = f"entityUpd~Not found~{navigation}"
|
||||||
else:
|
else:
|
||||||
entity = apis.ha_api.get_entity(item)
|
entity = apis.ha_api.get_entity(item)
|
||||||
heading = title if title != "unknown" else entity.attributes.friendly_name
|
heading = title if title != "unknown" else entity.attributes['friendly_name']
|
||||||
|
|
||||||
# get data from homeassistant
|
# get data from homeassistant
|
||||||
data_raw = apis.ha_api.get_history(entity_id = item, days = 7)
|
data_raw = apis.ha_api.get_history(entity_id = item, days = 7)
|
||||||
@@ -581,12 +619,12 @@ class LuiPagesGen(object):
|
|||||||
else:
|
else:
|
||||||
media_icon = self.generate_entities_item(entity, "cardGrid")
|
media_icon = self.generate_entities_item(entity, "cardGrid")
|
||||||
ha_entity = apis.ha_api.get_entity(entityId)
|
ha_entity = apis.ha_api.get_entity(entityId)
|
||||||
heading = title if title != "unknown" else ha_entity.attributes.friendly_name
|
heading = title if title != "unknown" else ha_entity.attributes['friendly_name']
|
||||||
title = get_attr_safe(ha_entity, "media_title", "")
|
title = get_attr_safe(ha_entity, "media_title", "")
|
||||||
author = get_attr_safe(ha_entity, "media_artist", "")
|
author = get_attr_safe(ha_entity, "media_artist", "")
|
||||||
volume = int(get_attr_safe(ha_entity, "volume_level", 0)*100)
|
volume = int(get_attr_safe(ha_entity, "volume_level", 0)*100)
|
||||||
iconplaypause = get_icon_id("pause") if ha_entity.state == "playing" else get_icon_id("play")
|
iconplaypause = get_icon_id("pause") if ha_entity.state == "playing" else get_icon_id("play")
|
||||||
bits = ha_entity.attributes.supported_features
|
bits = ha_entity.attributes['supported_features']
|
||||||
onoffbutton = "disable"
|
onoffbutton = "disable"
|
||||||
if bits & 0b10000000:
|
if bits & 0b10000000:
|
||||||
if ha_entity.state == "off":
|
if ha_entity.state == "off":
|
||||||
@@ -604,7 +642,7 @@ class LuiPagesGen(object):
|
|||||||
item_str = ""
|
item_str = ""
|
||||||
for item in entities:
|
for item in entities:
|
||||||
item_str += self.generate_entities_item(item, "cardGrid")
|
item_str += self.generate_entities_item(item, "cardGrid")
|
||||||
|
|
||||||
bck_override = entity.iconOverride
|
bck_override = entity.iconOverride
|
||||||
if entity.status is not None:
|
if entity.status is not None:
|
||||||
bck_entity = entity.entityId
|
bck_entity = entity.entityId
|
||||||
@@ -612,14 +650,14 @@ class LuiPagesGen(object):
|
|||||||
|
|
||||||
entity.iconOverride = "mdi:speaker"
|
entity.iconOverride = "mdi:speaker"
|
||||||
item_str += self.generate_entities_item(entity, "cardGrid")
|
item_str += self.generate_entities_item(entity, "cardGrid")
|
||||||
|
|
||||||
entity.iconOverride = bck_override
|
entity.iconOverride = bck_override
|
||||||
if entity.status is not None:
|
if entity.status is not None:
|
||||||
entity.entityId = bck_entity
|
entity.entityId = bck_entity
|
||||||
|
|
||||||
command = f"entityUpd~{heading}~{navigation}~{entityId}~{title}~~{author}~~{volume}~{iconplaypause}~{onoffbutton}~{shuffleBtn}{media_icon}{item_str}"
|
command = f"entityUpd~{heading}~{navigation}~{entityId}~{title}~~{author}~~{volume}~{iconplaypause}~{onoffbutton}~{shuffleBtn}{media_icon}{item_str}"
|
||||||
self._send_mqtt_msg(command)
|
self._send_mqtt_msg(command)
|
||||||
|
|
||||||
def generate_alarm_page(self, navigation, title, entity, overwrite_supported_modes, alarmBtn):
|
def generate_alarm_page(self, navigation, title, entity, overwrite_supported_modes, alarmBtn):
|
||||||
item = entity.entityId
|
item = entity.entityId
|
||||||
if not apis.ha_api.entity_exists(item):
|
if not apis.ha_api.entity_exists(item):
|
||||||
@@ -636,7 +674,7 @@ class LuiPagesGen(object):
|
|||||||
if not entity.attributes.get("code_arm_required", False):
|
if not entity.attributes.get("code_arm_required", False):
|
||||||
numpad = "disable"
|
numpad = "disable"
|
||||||
if overwrite_supported_modes is None:
|
if overwrite_supported_modes is None:
|
||||||
bits = entity.attributes.supported_features
|
bits = entity.attributes['supported_features']
|
||||||
if bits & 0b000001:
|
if bits & 0b000001:
|
||||||
supported_modes.append("arm_home")
|
supported_modes.append("arm_home")
|
||||||
if bits & 0b000010:
|
if bits & 0b000010:
|
||||||
@@ -675,7 +713,7 @@ class LuiPagesGen(object):
|
|||||||
|
|
||||||
#add button to show sensor state
|
#add button to show sensor state
|
||||||
add_btn = ""
|
add_btn = ""
|
||||||
if "open_sensors" in entity.attributes and entity.attributes.open_sensors is not None:
|
if entity.attributes.get("open_sensors") is not None:
|
||||||
add_btn=f"{get_icon_id('progress-alert')}~{rgb_dec565([243,179,0])}~"
|
add_btn=f"{get_icon_id('progress-alert')}~{rgb_dec565([243,179,0])}~"
|
||||||
if alarmBtn is not None and type(alarmBtn) is dict:
|
if alarmBtn is not None and type(alarmBtn) is dict:
|
||||||
entity = alarmBtn.get("entity")
|
entity = alarmBtn.get("entity")
|
||||||
@@ -686,8 +724,8 @@ class LuiPagesGen(object):
|
|||||||
else:
|
else:
|
||||||
icon_color = rgb_dec565([243,179,0])
|
icon_color = rgb_dec565([243,179,0])
|
||||||
add_btn=f"{iconnav}~{icon_color}~{entity}"
|
add_btn=f"{iconnav}~{icon_color}~{entity}"
|
||||||
|
|
||||||
|
|
||||||
# add padding to arm buttons
|
# add padding to arm buttons
|
||||||
arm_buttons = ""
|
arm_buttons = ""
|
||||||
for b in supported_modes:
|
for b in supported_modes:
|
||||||
@@ -697,12 +735,12 @@ class LuiPagesGen(object):
|
|||||||
arm_buttons += "~"*((4-len(supported_modes))*2)
|
arm_buttons += "~"*((4-len(supported_modes))*2)
|
||||||
command = f"entityUpd~{title}~{navigation}~{item}{arm_buttons}~{icon}~{color}~{numpad}~{flashing}~{add_btn}"
|
command = f"entityUpd~{title}~{navigation}~{item}{arm_buttons}~{icon}~{color}~{numpad}~{flashing}~{add_btn}"
|
||||||
self._send_mqtt_msg(command)
|
self._send_mqtt_msg(command)
|
||||||
|
|
||||||
def generate_unlock_page(self, navigation, item, title, destination, pin):
|
def generate_unlock_page(self, navigation, item, title, destination, pin):
|
||||||
color = rgb_dec565([255,0,0])
|
color = rgb_dec565([255,0,0])
|
||||||
icon = get_icon_id("lock")
|
icon = get_icon_id("lock")
|
||||||
supported_modes = ["cardUnlock-unlock"]
|
supported_modes = ["cardUnlock-unlock"]
|
||||||
|
|
||||||
# add padding to arm buttons
|
# add padding to arm buttons
|
||||||
arm_buttons = ""
|
arm_buttons = ""
|
||||||
for b in supported_modes:
|
for b in supported_modes:
|
||||||
@@ -741,8 +779,8 @@ class LuiPagesGen(object):
|
|||||||
if (time.time()-card.last_update) < card.cooldown:
|
if (time.time()-card.last_update) < card.cooldown:
|
||||||
return
|
return
|
||||||
card.last_update = time.time()
|
card.last_update = time.time()
|
||||||
|
|
||||||
|
|
||||||
leftBtn = "delete~~~~~"
|
leftBtn = "delete~~~~~"
|
||||||
if card.uuid_prev is not None:
|
if card.uuid_prev is not None:
|
||||||
leftBtn = self.generate_entities_item(Entity(
|
leftBtn = self.generate_entities_item(Entity(
|
||||||
@@ -779,6 +817,8 @@ class LuiPagesGen(object):
|
|||||||
if send_page_type:
|
if send_page_type:
|
||||||
if card.cardType == "cardGrid" and len(card.entities) > 6:
|
if card.cardType == "cardGrid" and len(card.entities) > 6:
|
||||||
card.cardType = "cardGrid2"
|
card.cardType = "cardGrid2"
|
||||||
|
if card.cardType == "cardGrid1":
|
||||||
|
card.cardType = "cardGrid"
|
||||||
self.page_type(card.cardType)
|
self.page_type(card.cardType)
|
||||||
|
|
||||||
# send sleep timeout if there is one configured for the current card
|
# send sleep timeout if there is one configured for the current card
|
||||||
@@ -786,9 +826,9 @@ class LuiPagesGen(object):
|
|||||||
self._send_mqtt_msg(f"timeout~{card.sleepTimeout}")
|
self._send_mqtt_msg(f"timeout~{card.sleepTimeout}")
|
||||||
else:
|
else:
|
||||||
self._send_mqtt_msg(f'timeout~{self._config.get("sleepTimeout")}')
|
self._send_mqtt_msg(f'timeout~{self._config.get("sleepTimeout")}')
|
||||||
|
|
||||||
temp_unit = card.raw_config.get("temperatureUnit", "celsius")
|
temp_unit = card.raw_config.get("temperatureUnit", "celsius")
|
||||||
if card.cardType in ["cardEntities", "cardGrid", "cardGrid2"]:
|
if card.cardType in ["cardEntities", "cardGrid", "cardGrid1","cardGrid2"]:
|
||||||
self.generate_entities_page(navigation, card.title, card.entities, card.cardType, temp_unit)
|
self.generate_entities_page(navigation, card.title, card.entities, card.cardType, temp_unit)
|
||||||
return
|
return
|
||||||
if card.cardType == "cardThermo":
|
if card.cardType == "cardThermo":
|
||||||
@@ -840,25 +880,26 @@ class LuiPagesGen(object):
|
|||||||
color_temp = "disable"
|
color_temp = "disable"
|
||||||
color = "disable"
|
color = "disable"
|
||||||
effect_supported = "disable"
|
effect_supported = "disable"
|
||||||
|
supported_color_modes = entity.attributes['supported_color_modes']
|
||||||
if "onoff" not in entity.attributes.supported_color_modes:
|
|
||||||
|
if "onoff" not in supported_color_modes:
|
||||||
brightness = 0
|
brightness = 0
|
||||||
if entity.state == "on":
|
if entity.state == "on":
|
||||||
if "brightness" in entity.attributes and entity.attributes.brightness:
|
if brightness := entity.attributes.get("brightness"):
|
||||||
# scale 0-255 brightness from ha to 0-100
|
# scale 0-255 brightness from ha to 0-100
|
||||||
brightness = int(scale(entity.attributes.brightness,(0,255),(0,100)))
|
brightness = int(scale(brightness, (0,255), (0,100)))
|
||||||
else:
|
else:
|
||||||
brightness = "disable"
|
brightness = "disable"
|
||||||
if "color_temp" in entity.attributes.supported_color_modes and entity.attributes.supported_color_modes:
|
if "color_temp" in supported_color_modes:
|
||||||
if "color_temp" in entity.attributes and entity.attributes.color_temp:
|
if color_temp := entity.attributes.get("color_temp"):
|
||||||
# scale ha color temp range to 0-100
|
# scale ha color temp range to 0-100
|
||||||
color_temp = int(scale(entity.attributes.color_temp,(entity.attributes.min_mireds, entity.attributes.max_mireds),(0,100)))
|
color_temp = int(scale(color_temp, (entity.attributes['min_mireds'], entity.attributes['max_mireds']),(0, 100)))
|
||||||
else:
|
else:
|
||||||
color_temp = "unknown"
|
color_temp = "unknown"
|
||||||
else:
|
else:
|
||||||
color_temp = "disable"
|
color_temp = "disable"
|
||||||
list_color_modes = ["xy", "rgb", "rgbw", "hs"]
|
list_color_modes = ["xy", "rgb", "rgbw", "hs"]
|
||||||
if any(item in list_color_modes for item in entity.attributes.supported_color_modes):
|
if any(item in list_color_modes for item in supported_color_modes):
|
||||||
color = "enable"
|
color = "enable"
|
||||||
else:
|
else:
|
||||||
color = "disable"
|
color = "disable"
|
||||||
@@ -868,20 +909,20 @@ class LuiPagesGen(object):
|
|||||||
brightness_translation = get_translation(self._locale, "frontend.ui.card.light.brightness")
|
brightness_translation = get_translation(self._locale, "frontend.ui.card.light.brightness")
|
||||||
color_temp_translation = get_translation(self._locale, "frontend.ui.card.light.color_temperature")
|
color_temp_translation = get_translation(self._locale, "frontend.ui.card.light.color_temperature")
|
||||||
self._send_mqtt_msg(f"entityUpdateDetail~{entity_id}~~{icon_color}~{switch_val}~{brightness}~{color_temp}~{color}~{color_translation}~{color_temp_translation}~{brightness_translation}~{effect_supported}", force=is_open_detail)
|
self._send_mqtt_msg(f"entityUpdateDetail~{entity_id}~~{icon_color}~{switch_val}~{brightness}~{color_temp}~{color}~{color_translation}~{color_temp_translation}~{brightness_translation}~{effect_supported}", force=is_open_detail)
|
||||||
|
|
||||||
def generate_shutter_detail_page(self, entity_id, is_open_detail=False):
|
def generate_shutter_detail_page(self, entity_id, is_open_detail=False):
|
||||||
entity = apis.ha_api.get_entity(entity_id)
|
entity = apis.ha_api.get_entity(entity_id)
|
||||||
entityType = "cover"
|
entityType = "cover"
|
||||||
device_class = entity.attributes.get("device_class", "window")
|
device_class = entity.attributes.get("device_class", "window")
|
||||||
icon_id = get_icon_ha(entity_id)
|
icon_id = get_icon_ha(entity_id)
|
||||||
|
|
||||||
pos = entity.attributes.get("current_position")
|
pos = entity.attributes.get("current_position")
|
||||||
if pos is None:
|
if pos is None:
|
||||||
pos_status = entity.state
|
pos_status = entity.state
|
||||||
pos = "disable"
|
pos = "disable"
|
||||||
else:
|
else:
|
||||||
pos_status = pos
|
pos_status = pos
|
||||||
|
|
||||||
pos_translation = ""
|
pos_translation = ""
|
||||||
icon_up = ""
|
icon_up = ""
|
||||||
icon_stop = ""
|
icon_stop = ""
|
||||||
@@ -898,7 +939,7 @@ class LuiPagesGen(object):
|
|||||||
iconTiltRightStatus = "disable"
|
iconTiltRightStatus = "disable"
|
||||||
tilt_pos = "disable"
|
tilt_pos = "disable"
|
||||||
|
|
||||||
bits = entity.attributes.supported_features
|
bits = entity.attributes['supported_features']
|
||||||
|
|
||||||
# position supported
|
# position supported
|
||||||
if bits & 0b00001111:
|
if bits & 0b00001111:
|
||||||
@@ -985,7 +1026,7 @@ class LuiPagesGen(object):
|
|||||||
if modes:
|
if modes:
|
||||||
modes_out += f"{heading}~{mode}~{cur_mode}~{modes_res}~"
|
modes_out += f"{heading}~{mode}~{cur_mode}~{modes_res}~"
|
||||||
|
|
||||||
self._send_mqtt_msg(f"entityUpdateDetail~{entity_id}~{icon_id}~{icon_color}~{modes_out}", force=is_open_detail)
|
self._send_mqtt_msg(f"entityUpdateDetail~{entity_id}~{icon_id}~{icon_color}~{modes_out}", force=is_open_detail)
|
||||||
|
|
||||||
def generate_input_select_detail_page(self, entity_id, is_open_detail=False):
|
def generate_input_select_detail_page(self, entity_id, is_open_detail=False):
|
||||||
options_list = None
|
options_list = None
|
||||||
@@ -1049,8 +1090,9 @@ class LuiPagesGen(object):
|
|||||||
label2 = get_translation(self._locale, "frontend.ui.card.timer.actions.cancel")
|
label2 = get_translation(self._locale, "frontend.ui.card.timer.actions.cancel")
|
||||||
label3 = get_translation(self._locale, "frontend.ui.card.timer.actions.finish")
|
label3 = get_translation(self._locale, "frontend.ui.card.timer.actions.finish")
|
||||||
self._send_mqtt_msg(f"entityUpdateDetail~{entity_id}~~{icon_color}~{entity_id}~{min_remaining}~{sec_remaining}~{editable}~{action1}~{action2}~{action3}~{label1}~{label2}~{label3}", force=is_open_detail)
|
self._send_mqtt_msg(f"entityUpdateDetail~{entity_id}~~{icon_color}~{entity_id}~{min_remaining}~{sec_remaining}~{editable}~{action1}~{action2}~{action3}~{label1}~{label2}~{label3}", force=is_open_detail)
|
||||||
|
|
||||||
def send_message_page(self, ident, heading, msg, b1, b2):
|
def send_message_page(self, ident, heading, msg, b1, b2):
|
||||||
self._send_mqtt_msg(f"pageType~popupNotify")
|
self._send_mqtt_msg(f"pageType~popupNotify")
|
||||||
self._send_mqtt_msg(f"entityUpdateDetail~{ident}~{heading}~65535~{b1}~65535~{b2}~65535~{msg}~65535~0")
|
self._send_mqtt_msg(f"entityUpdateDetail~{ident}~{heading}~65535~{b1}~65535~{b2}~65535~{msg}~65535~0")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import hassapi as hass
|
import adbase as ad
|
||||||
|
|
||||||
from luibackend.config import LuiBackendConfig
|
from luibackend.config import LuiBackendConfig
|
||||||
from luibackend.controller import LuiController
|
from luibackend.controller import LuiController
|
||||||
@@ -6,15 +6,19 @@ from luibackend.mqtt import LuiMqttListener, LuiMqttSender
|
|||||||
from luibackend.updater import Updater
|
from luibackend.updater import Updater
|
||||||
|
|
||||||
import apis
|
import apis
|
||||||
|
import json
|
||||||
|
from typing import Literal
|
||||||
|
|
||||||
class NsPanelLovelaceUIManager(hass.Hass):
|
class NsPanelLovelaceUIManager(ad.ADBase):
|
||||||
|
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
self.log('Starting')
|
self.adapi = self.get_ad_api()
|
||||||
apis.ha_api = self
|
self.adapi.log('Starting')
|
||||||
|
apis.ad_api = self.adapi
|
||||||
|
apis.ha_api = self.get_plugin_api("HASS")
|
||||||
apis.mqtt_api = self.get_plugin_api("MQTT")
|
apis.mqtt_api = self.get_plugin_api("MQTT")
|
||||||
|
|
||||||
cfg = self._cfg = LuiBackendConfig(self, self.args["config"])
|
cfg = self._cfg = LuiBackendConfig(apis.ha_api, self.args["config"])
|
||||||
|
|
||||||
use_api = cfg.get("use_api") == True
|
use_api = cfg.get("use_api") == True
|
||||||
|
|
||||||
@@ -22,14 +26,15 @@ class NsPanelLovelaceUIManager(hass.Hass):
|
|||||||
topic_recv = cfg.get("panelRecvTopic")
|
topic_recv = cfg.get("panelRecvTopic")
|
||||||
api_panel_name = cfg.get("panelName")
|
api_panel_name = cfg.get("panelName")
|
||||||
api_device_id = cfg.get("panelDeviceId")
|
api_device_id = cfg.get("panelDeviceId")
|
||||||
|
quiet = cfg.get("quiet")
|
||||||
|
|
||||||
mqttsend = LuiMqttSender(self, use_api, topic_send, api_panel_name)
|
mqttsender = self._mqttsender = LuiMqttSender(apis.ha_api, use_api, topic_send, api_panel_name, quiet)
|
||||||
|
|
||||||
controller = LuiController(cfg, mqttsend.send_mqtt_msg)
|
self._controller = LuiController(cfg, mqttsender.send_mqtt_msg)
|
||||||
|
|
||||||
desired_tasmota_driver_version = 8
|
desired_tasmota_driver_version = 8
|
||||||
desired_display_firmware_version = 53
|
desired_display_firmware_version = 53
|
||||||
version = "v4.3.3"
|
version = "v4.7.3"
|
||||||
|
|
||||||
model = cfg.get("model")
|
model = cfg.get("model")
|
||||||
if model == "us-l":
|
if model == "us-l":
|
||||||
@@ -41,11 +46,35 @@ class NsPanelLovelaceUIManager(hass.Hass):
|
|||||||
desired_tasmota_driver_url = cfg._config.get("berryURL", "https://raw.githubusercontent.com/joBr99/nspanel-lovelace-ui/main/tasmota/autoexec.be")
|
desired_tasmota_driver_url = cfg._config.get("berryURL", "https://raw.githubusercontent.com/joBr99/nspanel-lovelace-ui/main/tasmota/autoexec.be")
|
||||||
|
|
||||||
mode = cfg.get("updateMode")
|
mode = cfg.get("updateMode")
|
||||||
updater = Updater(self.log, mqttsend, topic_send, mode, desired_display_firmware_version, model, desired_display_firmware_url, desired_tasmota_driver_version, desired_tasmota_driver_url)
|
updater = Updater(self.adapi.log, mqttsender, topic_send, mode, desired_display_firmware_version, model, desired_display_firmware_url, desired_tasmota_driver_version, desired_tasmota_driver_url)
|
||||||
|
|
||||||
# Request Tasmota Driver Version
|
# Request Tasmota Driver Version
|
||||||
updater.request_berry_driver_version()
|
updater.request_berry_driver_version()
|
||||||
|
|
||||||
LuiMqttListener(use_api, topic_recv, api_panel_name, api_device_id, controller, updater)
|
LuiMqttListener(use_api, topic_recv, api_panel_name, api_device_id, self._controller, updater)
|
||||||
|
|
||||||
self.log(f'Started ({version})')
|
self.adapi.log(f'Started ({version})')
|
||||||
|
|
||||||
|
#
|
||||||
|
# helpers
|
||||||
|
#
|
||||||
|
|
||||||
|
def show_card(self, card_key: str) -> None:
|
||||||
|
"""Used to show card on panel"""
|
||||||
|
|
||||||
|
msg = json.dumps({"CustomRecv":f"event,buttonPress2,navigate.{card_key},button"})
|
||||||
|
topic = self._cfg.get("panelRecvTopic")
|
||||||
|
self._mqttsender.send_mqtt_msg(msg, topic)
|
||||||
|
|
||||||
|
def navigate(self, direction: Literal['up', 'prev', 'next']) -> None:
|
||||||
|
"""Used to navigate different directions on the panel"""
|
||||||
|
|
||||||
|
msg = json.dumps({"CustomRecv":f"event,buttonPress2,nav{direction.title()},button"})
|
||||||
|
topic = self._cfg.get("panelRecvTopic")
|
||||||
|
self._mqttsender.send_mqtt_msg(msg, topic)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def current_card(self) -> str:
|
||||||
|
"""Used to get the panel's current card"""
|
||||||
|
|
||||||
|
return self._controller.current_card.key
|
||||||
|
|||||||
112
docs-standalone/docs/_assets/user.css
Normal file
112
docs-standalone/docs/_assets/user.css
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
/*.md-header__button.md-logo img {
|
||||||
|
width: unset;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
.md-main__inner {
|
||||||
|
margin-top: unset;
|
||||||
|
}
|
||||||
|
|
||||||
|
.md-nav__title {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*.md-header,*/ .md-footer,
|
||||||
|
.md-footer-meta {
|
||||||
|
background-color: #333333;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Footer contrast fixes for Zensical/Material variants */
|
||||||
|
:root {
|
||||||
|
--md-footer-bg-color: #333333;
|
||||||
|
--md-footer-bg-color--dark: #2b2b2b;
|
||||||
|
--md-footer-fg-color: #f2f2f2;
|
||||||
|
--md-footer-fg-color--light: #ffffff;
|
||||||
|
--md-footer-fg-color--lighter: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.md-footer,
|
||||||
|
.md-footer-meta,
|
||||||
|
.md-footer * {
|
||||||
|
color: #f2f2f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.md-footer a,
|
||||||
|
.md-footer-meta a,
|
||||||
|
.md-footer .md-footer__link {
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.md-footer a:hover,
|
||||||
|
.md-footer-meta a:hover,
|
||||||
|
.md-footer .md-footer__link:hover {
|
||||||
|
color: #d9e7ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.md-footer .md-icon svg,
|
||||||
|
.md-footer-meta .md-icon svg {
|
||||||
|
fill: currentColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Zensical keeps footer content in the inner/meta containers.
|
||||||
|
Don't hide footer structure, only style it. */
|
||||||
|
|
||||||
|
.md-sidebar {
|
||||||
|
padding-top: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*.md-sidebar.md-sidebar--primary {
|
||||||
|
position: unset;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
.md-sidebar.md-sidebar--secondary {
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.md-sidebar.md-sidebar--primary .md-sidebar__scrollwrap {
|
||||||
|
/*overflow-y: unset;*/
|
||||||
|
padding-right: 1px;
|
||||||
|
border-right: 1px solid #adadad;
|
||||||
|
}
|
||||||
|
|
||||||
|
.md-sidebar.md-sidebar--primary .md-sidebar__inner {
|
||||||
|
/*border-right: 1px solid #adadad;*/
|
||||||
|
padding-bottom: 30px;
|
||||||
|
}
|
||||||
|
.md-sidebar.md-sidebar--secondary .md-sidebar__inner {
|
||||||
|
border-left: 1px solid #adadad;
|
||||||
|
}
|
||||||
|
|
||||||
|
.md-nav__item .md-nav__list {
|
||||||
|
padding-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.md-content {
|
||||||
|
margin-top: 25px;
|
||||||
|
/*border-left: 1px solid #adadad;
|
||||||
|
border-right: 1px solid #adadad;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
.md-top {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.md-typeset hr {
|
||||||
|
border-bottom: 1px solid #adadad;
|
||||||
|
}
|
||||||
|
|
||||||
|
.md-typeset h1,
|
||||||
|
.md-typeset h2,
|
||||||
|
.md-typeset h3,
|
||||||
|
.md-typeset h4,
|
||||||
|
.md-typeset h5 {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.md-typeset table:not([class]) td:not(:last-child),
|
||||||
|
.md-typeset table:not([class]) th:not(:last-child) {
|
||||||
|
border-right: .05rem solid var(--md-typeset-table-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
ol li::marker {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
137
docs-standalone/docs/cards.md
Normal file
137
docs-standalone/docs/cards.md
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
# Cards
|
||||||
|
|
||||||
|
## Supported card types
|
||||||
|
|
||||||
|
- `cardEntities`
|
||||||
|
- `cardGrid`
|
||||||
|
- `cardQR`
|
||||||
|
- `cardPower`
|
||||||
|
- `cardMedia`
|
||||||
|
- `cardThermo`
|
||||||
|
- `cardAlarm`
|
||||||
|
- `cardUnlock`
|
||||||
|
|
||||||
|
## Common card keys
|
||||||
|
|
||||||
|
key | required | type | description
|
||||||
|
-- | -- | -- | --
|
||||||
|
`type` | yes | string | Card type.
|
||||||
|
`title` | no | string | Card title.
|
||||||
|
`key` | no | string | Navigation key used by `navigate.<key>`.
|
||||||
|
|
||||||
|
## `cardEntities` and `cardGrid`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- type: cardEntities
|
||||||
|
title: Main
|
||||||
|
key: main
|
||||||
|
entities:
|
||||||
|
- entity: light.kitchen
|
||||||
|
- entity: navigate.settings
|
||||||
|
icon: mdi:cog
|
||||||
|
```
|
||||||
|
|
||||||
|
- `entities` is required.
|
||||||
|
- `cardGrid` auto-switches to `cardGrid2` if more than 6 entities are present.
|
||||||
|
|
||||||
|
## `cardQR`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- type: cardQR
|
||||||
|
title: Guest WiFi
|
||||||
|
qrCode: "WIFI:S:myssid;T:WPA;P:mypassword;;"
|
||||||
|
entities:
|
||||||
|
- entity: iText.myssid
|
||||||
|
name: SSID
|
||||||
|
icon: mdi:wifi
|
||||||
|
```
|
||||||
|
|
||||||
|
Keys:
|
||||||
|
|
||||||
|
- `qrCode` optional (default value exists, but set it explicitly)
|
||||||
|
- supports optional `entity` / `entities`
|
||||||
|
|
||||||
|
## `cardPower`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- type: cardPower
|
||||||
|
title: Energy
|
||||||
|
entities:
|
||||||
|
- entity: sensor.house_power
|
||||||
|
- entity: delete
|
||||||
|
- entity: sensor.solar_power
|
||||||
|
```
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
- `entities` is required.
|
||||||
|
- `speed` key is accepted in config but currently not applied by the renderer.
|
||||||
|
|
||||||
|
## `cardMedia`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- type: cardMedia
|
||||||
|
title: Living Room
|
||||||
|
entity: media_player.living_room
|
||||||
|
entities:
|
||||||
|
- entity: light.ambient
|
||||||
|
- entity: switch.tv_bias_light
|
||||||
|
```
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
- Main media entity must exist (`entity` or first generated entity).
|
||||||
|
- Additional `entities` are rendered as action buttons on the bottom row.
|
||||||
|
|
||||||
|
## `cardThermo`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- type: cardThermo
|
||||||
|
title: Heating
|
||||||
|
entity: climate.downstairs
|
||||||
|
supported_modes: ["heat", "off"]
|
||||||
|
```
|
||||||
|
|
||||||
|
Keys:
|
||||||
|
|
||||||
|
- `entity` required
|
||||||
|
- `supported_modes` optional (filters shown HVAC mode buttons)
|
||||||
|
|
||||||
|
## `cardAlarm`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- type: cardAlarm
|
||||||
|
title: House Alarm
|
||||||
|
entity: alarm_control_panel.house
|
||||||
|
supported_modes: ["arm_home", "arm_away", "arm_night"]
|
||||||
|
```
|
||||||
|
|
||||||
|
Keys:
|
||||||
|
|
||||||
|
- `entity` required
|
||||||
|
- `supported_modes` optional
|
||||||
|
|
||||||
|
## `cardUnlock`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- type: cardUnlock
|
||||||
|
title: Admin
|
||||||
|
pin: 1234
|
||||||
|
destination: navigate.admin
|
||||||
|
```
|
||||||
|
|
||||||
|
Keys:
|
||||||
|
|
||||||
|
- `pin` required
|
||||||
|
- `destination` required
|
||||||
|
|
||||||
|
Typical target in `hiddenCards`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
hiddenCards:
|
||||||
|
- type: cardGrid
|
||||||
|
key: admin
|
||||||
|
title: Admin
|
||||||
|
entities:
|
||||||
|
- entity: switch.maintenance_mode
|
||||||
|
```
|
||||||
61
docs-standalone/docs/configuration.md
Normal file
61
docs-standalone/docs/configuration.md
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
# Configuration
|
||||||
|
|
||||||
|
The runtime reads one YAML file (default: `./panels.yaml`, add-on mode: `/config/panels.yaml`).
|
||||||
|
|
||||||
|
## Top-level keys
|
||||||
|
|
||||||
|
key | required | type | default | description
|
||||||
|
-- | -- | -- | -- | --
|
||||||
|
`nspanels` | yes | object | none | Map of panel definitions.
|
||||||
|
`home_assistant_address` | recommended | string | none | Home Assistant base URL. In add-on mode it is auto-filled as `http://supervisor` if missing.
|
||||||
|
`home_assistant_token` | recommended | string | none | Long-lived token or Supervisor token.
|
||||||
|
`mqtt_server` | required in MQTT mode | string | from env | MQTT host.
|
||||||
|
`mqtt_port` | required in MQTT mode | int | from env | MQTT port.
|
||||||
|
`mqtt_username` | required in MQTT mode | string | from env | MQTT username.
|
||||||
|
`mqtt_password` | required in MQTT mode | string | from env | MQTT password.
|
||||||
|
`use_ha_api` | optional | any | absent | If present, MQTT input mode is disabled and HA event mode is used.
|
||||||
|
`timeZone` | optional | string | `Europe/Berlin` | Global fallback for panel `timeZone`.
|
||||||
|
`hiddenCards` | optional | list | `[]` | Global fallback for panel `hiddenCards`.
|
||||||
|
|
||||||
|
## Panel keys (`nspanels.<name>`)
|
||||||
|
|
||||||
|
key | required | type | default | description
|
||||||
|
-- | -- | -- | -- | --
|
||||||
|
`panelRecvTopic` | yes | string | none | Receive channel for panel events.
|
||||||
|
`panelSendTopic` | yes | string | none | Send channel for panel commands.
|
||||||
|
`locale` | yes | string | none | Locale used for translations and date formatting.
|
||||||
|
`timeZone` | recommended | string | from top-level `timeZone` | Time zone for clock.
|
||||||
|
`timeFormat` | yes | string | none | Python `strftime` format.
|
||||||
|
`dateFormat` | yes | string | none | Babel date format (example: `full`, `medium`).
|
||||||
|
`model` | optional | string | `eu` | Panel model (`eu`, `us-p`, `us-l`).
|
||||||
|
`temp_unit` | optional | string | `celsius` | Thermostat card unit (`celsius` or `fahrenheit`).
|
||||||
|
`sleepTimeout` | optional | int | `20` | Seconds before screensaver.
|
||||||
|
`sleepBrightness` | optional | int or entity_id | `10` | Screensaver brightness.
|
||||||
|
`screenBrightness` | optional | int or entity_id | `100` | Active-screen brightness.
|
||||||
|
`sleepTracking` | optional | entity_id | none | Forces sleep brightness to 0 when entity state matches `sleepTrackingZones`.
|
||||||
|
`sleepTrackingZones` | optional | list | `["not_home", "off"]` | States that trigger forced dimming.
|
||||||
|
`sleepOverride` | optional | object | none | Override sleep brightness when entity is `on`/`true`/`home`.
|
||||||
|
`defaultBackgroundColor` | optional | string | `ha-dark` | `ha-dark` or `black`.
|
||||||
|
`featExperimentalSliders` | optional | int | `0` | Forwarded in dimmode command.
|
||||||
|
`defaultCard` | optional | string | none | Default card when leaving screensaver (`navigate.<key>`).
|
||||||
|
`screensaver` | yes | object | none | Screensaver definition.
|
||||||
|
`cards` | yes | list | none | Top-level cards.
|
||||||
|
`hiddenCards` | optional | list | `[]` | Hidden cards addressable through `navigate.<key>`.
|
||||||
|
|
||||||
|
## Brightness behavior
|
||||||
|
|
||||||
|
- Integer values are used directly.
|
||||||
|
- Entity values read Home Assistant state and cast to number.
|
||||||
|
- List/schedule style brightness is not supported in this rewrite.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
sleepBrightness: input_number.nspanel_sleep
|
||||||
|
screenBrightness: input_number.nspanel_awake
|
||||||
|
sleepTracking: person.john
|
||||||
|
sleepTrackingZones: ["not_home", "off"]
|
||||||
|
sleepOverride:
|
||||||
|
entity: light.bedroom
|
||||||
|
brightness: 30
|
||||||
|
```
|
||||||
45
docs-standalone/docs/connection-modes.md
Normal file
45
docs-standalone/docs/connection-modes.md
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
# Connection Modes
|
||||||
|
|
||||||
|
The rewrite supports two panel input/output modes.
|
||||||
|
|
||||||
|
## 1) MQTT mode (default)
|
||||||
|
|
||||||
|
Enabled when:
|
||||||
|
|
||||||
|
- `mqtt_server` is configured
|
||||||
|
- `use_ha_api` is not present
|
||||||
|
|
||||||
|
Behavior:
|
||||||
|
|
||||||
|
- Subscribes to every panel `panelRecvTopic`
|
||||||
|
- Expects JSON payload containing `CustomRecv`
|
||||||
|
- Publishes commands to `panelSendTopic`
|
||||||
|
|
||||||
|
Example receive payload:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{"CustomRecv":"event,startup,54,eu"}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 2) Home Assistant API mode (`use_ha_api`)
|
||||||
|
|
||||||
|
Enabled when key `use_ha_api` exists in config.
|
||||||
|
|
||||||
|
Behavior:
|
||||||
|
|
||||||
|
- Subscribes to HA event `esphome.nspanel.data`
|
||||||
|
- Routes events by `device_id` (must match configured `panelRecvTopic`)
|
||||||
|
- Sends panel commands by calling Home Assistant service:
|
||||||
|
- `<panelSendTopic>_nspanelui_api_call`
|
||||||
|
|
||||||
|
Service payload shape:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
data: "...panel command..."
|
||||||
|
command: 2
|
||||||
|
```
|
||||||
|
|
||||||
|
## Common to both modes
|
||||||
|
|
||||||
|
- Home Assistant websocket connection is used for entity state cache and service calls.
|
||||||
|
- UI actions (button presses, sliders, mode selects) are translated to Home Assistant service calls.
|
||||||
77
docs-standalone/docs/entities.md
Normal file
77
docs-standalone/docs/entities.md
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
# Entities
|
||||||
|
|
||||||
|
Entities are used in cards and screensaver lists.
|
||||||
|
|
||||||
|
## Entity keys
|
||||||
|
|
||||||
|
key | required | type | description
|
||||||
|
-- | -- | -- | --
|
||||||
|
`entity` | yes | string | Home Assistant entity id, or internal entity (`navigate.*`, `delete`, `iText.*`).
|
||||||
|
`name` | no | string | Display name override.
|
||||||
|
`icon` | no | string or map | Icon override (`mdi:*`), optionally per state.
|
||||||
|
`color` | no | `[r,g,b]` or map | Color override, optionally per state.
|
||||||
|
`value` | no | string | Value override.
|
||||||
|
`font` | no | string | Icon font variant (`small`, `medium`, `medium-icon`, `large`).
|
||||||
|
`status` | no | string | Extra status entity for `navigate.*` items.
|
||||||
|
`effectList` | no | list | Custom light effect list for detail popup.
|
||||||
|
`attribute` | no | string | Weather attribute to display.
|
||||||
|
`day` | no | int | Weather daily forecast index.
|
||||||
|
`hour` | no | int | Weather hourly forecast index.
|
||||||
|
`unit` | no | string | Value suffix.
|
||||||
|
|
||||||
|
## Supported Home Assistant domains
|
||||||
|
|
||||||
|
- `switch`
|
||||||
|
- `input_boolean`
|
||||||
|
- `automation`
|
||||||
|
- `lock`
|
||||||
|
- `input_text`
|
||||||
|
- `input_select`
|
||||||
|
- `select`
|
||||||
|
- `light`
|
||||||
|
- `fan`
|
||||||
|
- `button`
|
||||||
|
- `input_button`
|
||||||
|
- `scene`
|
||||||
|
- `script`
|
||||||
|
- `number`
|
||||||
|
- `input_number`
|
||||||
|
- `timer`
|
||||||
|
- `alarm_control_panel`
|
||||||
|
- `vacuum`
|
||||||
|
- `media_player`
|
||||||
|
- `sun`
|
||||||
|
- `person`
|
||||||
|
- `climate`
|
||||||
|
- `cover`
|
||||||
|
- `sensor`
|
||||||
|
- `binary_sensor`
|
||||||
|
- `weather`
|
||||||
|
|
||||||
|
## Internal entities
|
||||||
|
|
||||||
|
- `navigate.<key>`: Navigate to card with matching `key`.
|
||||||
|
- `navigate.UP`: Navigate back.
|
||||||
|
- `delete`: Placeholder/empty slot.
|
||||||
|
- `iText.<text>`: Static text entry.
|
||||||
|
|
||||||
|
## Template-based values
|
||||||
|
|
||||||
|
The rewrite supports Home Assistant template rendering for selected fields when prefixed with `ha:`:
|
||||||
|
|
||||||
|
- `icon: "ha:{{ ... }}"`
|
||||||
|
- `color: "ha:{{ ... }}"` (must evaluate to JSON RGB list)
|
||||||
|
- `value: "ha:{{ ... }}"`
|
||||||
|
- `qrCode: "ha:{{ ... }}"`
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- entity: light.kitchen
|
||||||
|
icon:
|
||||||
|
"on": mdi:lightbulb
|
||||||
|
"off": mdi:lightbulb-outline
|
||||||
|
color:
|
||||||
|
"on": [255, 210, 90]
|
||||||
|
"off": [80, 120, 170]
|
||||||
|
```
|
||||||
55
docs-standalone/docs/getting-started.md
Normal file
55
docs-standalone/docs/getting-started.md
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
# Getting Started
|
||||||
|
|
||||||
|
## Home Assistant add-on mode
|
||||||
|
|
||||||
|
In add-on mode, the container startup script:
|
||||||
|
|
||||||
|
- reads MQTT credentials from Home Assistant service discovery
|
||||||
|
- sets `CONFIG_FILE=/config/panels.yaml`
|
||||||
|
- creates `/config/panels.yaml` from the bundled example if it does not exist
|
||||||
|
|
||||||
|
Relevant files:
|
||||||
|
|
||||||
|
- `nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/run.sh`
|
||||||
|
- `nspanel-lovelace-ui/config.yaml`
|
||||||
|
|
||||||
|
## Minimal `panels.yaml`
|
||||||
|
|
||||||
|
Start with one panel:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
home_assistant_address: "http://supervisor"
|
||||||
|
home_assistant_token: "SUPERVISOR_TOKEN_OR_LONG_LIVED_TOKEN"
|
||||||
|
|
||||||
|
nspanels:
|
||||||
|
kitchen:
|
||||||
|
panelRecvTopic: "tele/tasmota_kitchen/RESULT"
|
||||||
|
panelSendTopic: "cmnd/tasmota_kitchen/CustomSend"
|
||||||
|
locale: "en_US"
|
||||||
|
timeZone: "Europe/Berlin"
|
||||||
|
timeFormat: "%H:%M"
|
||||||
|
dateFormat: "full"
|
||||||
|
screensaver:
|
||||||
|
entities:
|
||||||
|
- entity: weather.home
|
||||||
|
cards:
|
||||||
|
- type: cardEntities
|
||||||
|
title: Main
|
||||||
|
entities:
|
||||||
|
- entity: light.kitchen
|
||||||
|
- entity: switch.coffee_machine
|
||||||
|
```
|
||||||
|
|
||||||
|
## Important notes
|
||||||
|
|
||||||
|
- `cards` and `screensaver` are required per panel.
|
||||||
|
- `timeFormat`, `dateFormat`, and `locale` should be set per panel.
|
||||||
|
- `panelRecvTopic` / `panelSendTopic` are required.
|
||||||
|
|
||||||
|
## Running standalone (outside HA add-on)
|
||||||
|
|
||||||
|
If you run this container/process outside Supervisor:
|
||||||
|
|
||||||
|
- provide `home_assistant_address` and `home_assistant_token` in YAML
|
||||||
|
- provide MQTT values in YAML (`mqtt_server`, `mqtt_port`, `mqtt_username`, `mqtt_password`) or environment
|
||||||
|
- set `CONFIG_FILE` if the config is not `./panels.yaml`
|
||||||
38
docs-standalone/docs/index.md
Normal file
38
docs-standalone/docs/index.md
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# Overview
|
||||||
|
|
||||||
|
This documentation covers the standalone rewrite located in `nspanel-lovelace-ui/`.
|
||||||
|
|
||||||
|
It is a Python backend that:
|
||||||
|
|
||||||
|
- receives panel input (MQTT mode or Home Assistant API mode)
|
||||||
|
- reads Home Assistant state through the websocket API
|
||||||
|
- renders cards and screensaver pages
|
||||||
|
- sends panel commands back to the device
|
||||||
|
|
||||||
|
This docs set is intentionally separate from the AppDaemon docs in `docs/`.
|
||||||
|
|
||||||
|
## Rewrite location
|
||||||
|
|
||||||
|
- Add-on package: `nspanel-lovelace-ui/`
|
||||||
|
- Runtime code: `nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/`
|
||||||
|
- Example panel config: `nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/panels.yaml.example`
|
||||||
|
|
||||||
|
## What is supported
|
||||||
|
|
||||||
|
- `cardEntities`
|
||||||
|
- `cardGrid` (auto-switches to `cardGrid2` when needed)
|
||||||
|
- `cardQR`
|
||||||
|
- `cardPower`
|
||||||
|
- `cardMedia`
|
||||||
|
- `cardThermo`
|
||||||
|
- `cardAlarm`
|
||||||
|
- `cardUnlock`
|
||||||
|
- screensaver with status icons and weather forecast entities
|
||||||
|
|
||||||
|
## Runtime model
|
||||||
|
|
||||||
|
1. Load `panels.yaml`.
|
||||||
|
2. Resolve MQTT and Home Assistant connection settings.
|
||||||
|
3. Create one thread per panel.
|
||||||
|
4. Listen for events and state changes.
|
||||||
|
5. Re-render active pages and detail popups when relevant entities change.
|
||||||
120
docs-standalone/docs/migration-appdaemon.md
Normal file
120
docs-standalone/docs/migration-appdaemon.md
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
# Migration from AppDaemon Config
|
||||||
|
|
||||||
|
This page explains how to migrate panel configuration from the legacy AppDaemon `apps.yaml` format to the standalone rewrite `panels.yaml` format.
|
||||||
|
|
||||||
|
## File and structure changes
|
||||||
|
|
||||||
|
Old (AppDaemon):
|
||||||
|
|
||||||
|
- panel config lived under `apps.yaml`
|
||||||
|
- MQTT and Home Assistant base connection config was split across AppDaemon files (`appdaemon.yaml`, plugin config, and app config)
|
||||||
|
|
||||||
|
New (rewrite):
|
||||||
|
|
||||||
|
- panel config lives in one file: `panels.yaml` (usually `/config/panels.yaml`)
|
||||||
|
- connection values are read from this file and/or environment variables
|
||||||
|
|
||||||
|
## Minimal before/after example
|
||||||
|
|
||||||
|
Old AppDaemon (`apps.yaml`):
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
nspanel-1:
|
||||||
|
module: nspanel-lovelace-ui
|
||||||
|
class: NsPanelLovelaceUIManager
|
||||||
|
config:
|
||||||
|
panelRecvTopic: "tele/tasmota_panel/RESULT"
|
||||||
|
panelSendTopic: "cmnd/tasmota_panel/CustomSend"
|
||||||
|
model: eu
|
||||||
|
locale: en_US
|
||||||
|
timeFormat: "%H:%M"
|
||||||
|
```
|
||||||
|
|
||||||
|
New rewrite (`panels.yaml`):
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
home_assistant_address: "http://supervisor"
|
||||||
|
home_assistant_token: "YOUR_TOKEN"
|
||||||
|
|
||||||
|
nspanels:
|
||||||
|
panel-1:
|
||||||
|
panelRecvTopic: "tele/tasmota_panel/RESULT"
|
||||||
|
panelSendTopic: "cmnd/tasmota_panel/CustomSend"
|
||||||
|
model: eu
|
||||||
|
locale: en_US
|
||||||
|
timeZone: "Europe/Berlin"
|
||||||
|
timeFormat: "%H:%M"
|
||||||
|
dateFormat: "full"
|
||||||
|
screensaver:
|
||||||
|
entities:
|
||||||
|
- entity: weather.home
|
||||||
|
cards:
|
||||||
|
- type: cardEntities
|
||||||
|
title: Main
|
||||||
|
entities:
|
||||||
|
- entity: light.kitchen
|
||||||
|
```
|
||||||
|
|
||||||
|
## Key mapping
|
||||||
|
|
||||||
|
Legacy AppDaemon key or concept | Standalone rewrite | Notes
|
||||||
|
-- | -- | --
|
||||||
|
`module`, `class`, `config` wrapper | removed | Rewrite uses `nspanels.<panel_name>` directly.
|
||||||
|
`panelRecvTopic` | `panelRecvTopic` | Same meaning.
|
||||||
|
`panelSendTopic` | `panelSendTopic` | Same meaning.
|
||||||
|
`model` | `model` | Same meaning (`eu`, `us-p`, `us-l`).
|
||||||
|
`locale` | `locale` | Same meaning.
|
||||||
|
`timeFormat` | `timeFormat` | Same meaning.
|
||||||
|
`timezone` (legacy docs casing) | `timeZone` | Use exact camelCase `timeZone`.
|
||||||
|
`dateFormatBabel` / `dateFormat` | `dateFormat` | Rewrite expects `dateFormat`.
|
||||||
|
`cards` | `cards` | Same concept.
|
||||||
|
`hiddenCards` | `hiddenCards` | Same concept.
|
||||||
|
`screensaver` | `screensaver` | Same concept; some legacy theme options are not available.
|
||||||
|
`defaultCard` under screensaver usage | `defaultCard` (panel level) | Use as panel-level key in rewrite.
|
||||||
|
`temperatureUnit` (card-level legacy usage) | `temp_unit` (panel level) | Rewrite reads panel-level `temp_unit`.
|
||||||
|
`sleepBrightness` list schedule | not supported | Rewrite supports integer or entity id, not list-based schedules.
|
||||||
|
`screenBrightness` list schedule | not supported | Rewrite supports integer or entity id, not list-based schedules.
|
||||||
|
`sleepTracking` | `sleepTracking` | Same concept.
|
||||||
|
`sleepTrackingZones` | `sleepTrackingZones` | Same concept.
|
||||||
|
`sleepOverride` | `sleepOverride` | Same concept.
|
||||||
|
`updateMode` / OTA URL overrides (`displayURL-*`, `berryURL`) | not supported | Rewrite does not implement these legacy update keys.
|
||||||
|
`theme`, `dateAdditionalTemplate`, `timeAdditionalTemplate` | not supported | Not implemented in rewrite config.
|
||||||
|
|
||||||
|
## Connection config differences
|
||||||
|
|
||||||
|
In AppDaemon setups, MQTT and Home Assistant connectivity was mostly configured via AppDaemon plugin settings.
|
||||||
|
|
||||||
|
In the rewrite, connectivity is resolved directly by the runtime:
|
||||||
|
|
||||||
|
- Home Assistant:
|
||||||
|
- `home_assistant_address`
|
||||||
|
- `home_assistant_token`
|
||||||
|
- MQTT (for MQTT mode):
|
||||||
|
- `mqtt_server`, `mqtt_port`, `mqtt_username`, `mqtt_password`
|
||||||
|
- Optional mode switch:
|
||||||
|
- set `use_ha_api` to use Home Assistant event mode instead of MQTT receive mode
|
||||||
|
|
||||||
|
## Entity-level differences to watch
|
||||||
|
|
||||||
|
Some legacy entity config fields are not implemented in the rewrite parser/renderer:
|
||||||
|
|
||||||
|
- `state`, `state_not`, `state_template`
|
||||||
|
- direct `service.*` action entries with custom `data`
|
||||||
|
- `action_name`
|
||||||
|
|
||||||
|
Supported and commonly used fields in rewrite:
|
||||||
|
|
||||||
|
- `entity`, `name`, `icon`, `color`, `value`, `font`
|
||||||
|
- weather-related: `attribute`, `day`, `hour`, `unit`
|
||||||
|
- light detail helper: `effectList`
|
||||||
|
- navigation helper: `status` for `navigate.*` entities
|
||||||
|
|
||||||
|
## Migration checklist
|
||||||
|
|
||||||
|
1. Create `/config/panels.yaml` from the rewrite example.
|
||||||
|
2. Move each old app entry (`nspanel-1`, `nspanel-2`, ...) into `nspanels`.
|
||||||
|
3. Remove `module/class/config` wrappers.
|
||||||
|
4. Rename `timezone` to `timeZone`.
|
||||||
|
5. Ensure each panel has `dateFormat`, `timeFormat`, `screensaver`, and `cards`.
|
||||||
|
6. Replace unsupported scheduled brightness lists with integer/entity-based values.
|
||||||
|
7. Remove unsupported legacy-only keys listed above.
|
||||||
57
docs-standalone/docs/screensaver.md
Normal file
57
docs-standalone/docs/screensaver.md
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
# Screensaver
|
||||||
|
|
||||||
|
`screensaver` is a required object in each panel config.
|
||||||
|
|
||||||
|
## Keys
|
||||||
|
|
||||||
|
key | required | type | default | description
|
||||||
|
-- | -- | -- | -- | --
|
||||||
|
`type` | no | string | `screensaver` | Layout type (`screensaver` / `screensaver2`).
|
||||||
|
`entities` | yes* | list | none | Screensaver entities.
|
||||||
|
`entity` | yes* | string | none | Single-entity shortcut.
|
||||||
|
`statusIcon1` | no | object | none | Left status icon near date.
|
||||||
|
`statusIcon2` | no | object | none | Right status icon near date.
|
||||||
|
`doubleTapToUnlock` | no | bool | `false` | Requires double tap when leaving screensaver.
|
||||||
|
`sleepTimeout` | no | int | panel `sleepTimeout` | Per-screensaver timeout override.
|
||||||
|
|
||||||
|
`*` Provide at least one of `entity` or `entities`.
|
||||||
|
|
||||||
|
## Screensaver entities
|
||||||
|
|
||||||
|
Screensaver entities use the same entity format as other cards.
|
||||||
|
|
||||||
|
For `weather.<entity>` you can also use:
|
||||||
|
|
||||||
|
- `attribute` (default `temperature`)
|
||||||
|
- `day` (daily forecast index)
|
||||||
|
- `hour` (hourly forecast index)
|
||||||
|
- `unit` (suffix, default `°C` for temperature-like attributes)
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
screensaver:
|
||||||
|
type: screensaver
|
||||||
|
doubleTapToUnlock: true
|
||||||
|
sleepTimeout: 30
|
||||||
|
statusIcon1:
|
||||||
|
entity: binary_sensor.front_door
|
||||||
|
icon:
|
||||||
|
"on": mdi:door-open
|
||||||
|
"off": mdi:door-closed
|
||||||
|
font: medium-icon
|
||||||
|
statusIcon2:
|
||||||
|
entity: sensor.outdoor_temperature
|
||||||
|
icon: mdi:thermometer
|
||||||
|
entities:
|
||||||
|
- entity: weather.home
|
||||||
|
attribute: temperature
|
||||||
|
- entity: weather.home
|
||||||
|
day: 1
|
||||||
|
attribute: temperature
|
||||||
|
- entity: weather.home
|
||||||
|
day: 2
|
||||||
|
attribute: temperature
|
||||||
|
- entity: sensor.indoor_temperature
|
||||||
|
icon: mdi:home-thermometer
|
||||||
|
```
|
||||||
63
docs-standalone/docs/troubleshooting.md
Normal file
63
docs-standalone/docs/troubleshooting.md
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
# Troubleshooting
|
||||||
|
|
||||||
|
## Config does not load
|
||||||
|
|
||||||
|
Symptoms:
|
||||||
|
|
||||||
|
- no panel output
|
||||||
|
- log shows YAML parse error or file missing
|
||||||
|
|
||||||
|
Checks:
|
||||||
|
|
||||||
|
1. Confirm `CONFIG_FILE` path.
|
||||||
|
2. Validate YAML syntax.
|
||||||
|
3. Ensure required per-panel keys exist: `panelRecvTopic`, `panelSendTopic`, `locale`, `timeFormat`, `dateFormat`, `screensaver`, `cards`.
|
||||||
|
|
||||||
|
## MQTT not connected
|
||||||
|
|
||||||
|
Symptoms:
|
||||||
|
|
||||||
|
- log repeats MQTT connection retry
|
||||||
|
|
||||||
|
Checks:
|
||||||
|
|
||||||
|
1. Verify `mqtt_server`, `mqtt_port`, `mqtt_username`, `mqtt_password`.
|
||||||
|
2. Verify panel publishes on the same topic as `panelRecvTopic`.
|
||||||
|
3. Verify payload includes `CustomRecv` JSON key.
|
||||||
|
|
||||||
|
## Home Assistant websocket not connected
|
||||||
|
|
||||||
|
Symptoms:
|
||||||
|
|
||||||
|
- log repeatedly waits for websocket/auth
|
||||||
|
|
||||||
|
Checks:
|
||||||
|
|
||||||
|
1. Verify `home_assistant_address` and `home_assistant_token`.
|
||||||
|
2. In add-on mode, verify Supervisor token access is available.
|
||||||
|
3. Confirm HA is reachable from container network.
|
||||||
|
|
||||||
|
## Card does not open or navigate
|
||||||
|
|
||||||
|
Checks:
|
||||||
|
|
||||||
|
1. For `navigate.<key>`, confirm target card has matching `key`.
|
||||||
|
2. For `cardUnlock`, confirm `destination` and `pin` are set.
|
||||||
|
3. Confirm card `type` is one of the implemented types.
|
||||||
|
|
||||||
|
## Brightness behaves unexpectedly
|
||||||
|
|
||||||
|
Checks:
|
||||||
|
|
||||||
|
1. If using entity-based brightness, verify entity state is numeric.
|
||||||
|
2. Avoid list-based brightness schedules in this rewrite (not supported).
|
||||||
|
3. Review interaction between `sleepTracking`, `sleepTrackingZones`, and `sleepOverride`.
|
||||||
|
|
||||||
|
## Useful logs to look for
|
||||||
|
|
||||||
|
- `Config file not found`
|
||||||
|
- `Error while parsing YAML file`
|
||||||
|
- `Connected to MQTT Server`
|
||||||
|
- `Home Assistant auth OK`
|
||||||
|
- `card type ... not implemented`
|
||||||
|
- `Not implemented: <button action>`
|
||||||
60
docs-standalone/mkdocs.yml
Normal file
60
docs-standalone/mkdocs.yml
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
site_name: NsPanel Lovelace UI Standalone Docs
|
||||||
|
site_description: Documentation for the standalone/Home Assistant add-on rewrite in nspanel-lovelace-ui.
|
||||||
|
site_author: Johannes Braun
|
||||||
|
site_url: https://jobr99.github.io/nspanel-lovelace-ui/standalone
|
||||||
|
|
||||||
|
repo_name: jobr99/nspanel-lovelace-ui
|
||||||
|
repo_url: https://github.com/jobr99/nspanel-lovelace-ui
|
||||||
|
edit_uri: ""
|
||||||
|
|
||||||
|
copyright: "Copyright © 2026 Johannes Braun"
|
||||||
|
|
||||||
|
docs_dir: docs
|
||||||
|
|
||||||
|
theme:
|
||||||
|
name: material
|
||||||
|
palette:
|
||||||
|
accent: blue
|
||||||
|
font:
|
||||||
|
text: "arial, sans-serif"
|
||||||
|
code: monospace
|
||||||
|
features:
|
||||||
|
- navigation.indexes
|
||||||
|
- navigation.sections
|
||||||
|
- navigation.top
|
||||||
|
- navigation.tracking
|
||||||
|
- navigation.expand
|
||||||
|
- search.highlight
|
||||||
|
- search.share
|
||||||
|
- search.suggest
|
||||||
|
|
||||||
|
extra_css:
|
||||||
|
- _assets/user.css
|
||||||
|
|
||||||
|
markdown_extensions:
|
||||||
|
- admonition
|
||||||
|
- def_list
|
||||||
|
- attr_list
|
||||||
|
- pymdownx.tilde
|
||||||
|
- pymdownx.details
|
||||||
|
- pymdownx.superfences
|
||||||
|
- pymdownx.magiclink
|
||||||
|
- toc:
|
||||||
|
permalink: true
|
||||||
|
- codehilite:
|
||||||
|
guess_lang: false
|
||||||
|
|
||||||
|
plugins:
|
||||||
|
- search:
|
||||||
|
lang: en
|
||||||
|
|
||||||
|
nav:
|
||||||
|
- "Overview": index.md
|
||||||
|
- "Getting Started": getting-started.md
|
||||||
|
- "Configuration": configuration.md
|
||||||
|
- "Migration from AppDaemon": migration-appdaemon.md
|
||||||
|
- "Screensaver": screensaver.md
|
||||||
|
- "Cards": cards.md
|
||||||
|
- "Entities": entities.md
|
||||||
|
- "Connection Modes": connection-modes.md
|
||||||
|
- "Troubleshooting": troubleshooting.md
|
||||||
@@ -10,14 +10,46 @@
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*.md-header,*/ .md-footer {
|
/*.md-header,*/ .md-footer,
|
||||||
|
.md-footer-meta {
|
||||||
background-color: #333333;
|
background-color: #333333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.md-footer__inner.md-grid {
|
/* Footer contrast fixes for Zensical/Material variants */
|
||||||
display: none;
|
:root {
|
||||||
|
--md-footer-bg-color: #333333;
|
||||||
|
--md-footer-bg-color--dark: #2b2b2b;
|
||||||
|
--md-footer-fg-color: #f2f2f2;
|
||||||
|
--md-footer-fg-color--light: #ffffff;
|
||||||
|
--md-footer-fg-color--lighter: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.md-footer,
|
||||||
|
.md-footer-meta,
|
||||||
|
.md-footer * {
|
||||||
|
color: #f2f2f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.md-footer a,
|
||||||
|
.md-footer-meta a,
|
||||||
|
.md-footer .md-footer__link {
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.md-footer a:hover,
|
||||||
|
.md-footer-meta a:hover,
|
||||||
|
.md-footer .md-footer__link:hover {
|
||||||
|
color: #d9e7ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.md-footer .md-icon svg,
|
||||||
|
.md-footer-meta .md-icon svg {
|
||||||
|
fill: currentColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Zensical keeps footer content in the inner/meta containers.
|
||||||
|
Don't hide footer structure, only style it. */
|
||||||
|
|
||||||
.md-sidebar {
|
.md-sidebar {
|
||||||
padding-top: 0px;
|
padding-top: 0px;
|
||||||
}
|
}
|
||||||
@@ -77,4 +109,4 @@
|
|||||||
|
|
||||||
ol li::marker {
|
ol li::marker {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|||||||
75
docs/config-migration-standalone.md
Normal file
75
docs/config-migration-standalone.md
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
# Migration to Standalone Rewrite Config
|
||||||
|
|
||||||
|
This page compares the legacy AppDaemon `apps.yaml` config with the standalone rewrite `panels.yaml` config.
|
||||||
|
|
||||||
|
For the full rewrite docs, including full key descriptions, see:
|
||||||
|
|
||||||
|
- [Standalone documentation](https://docs.nspanel.pky.eu/standalone/)
|
||||||
|
- [Standalone migration page](https://docs.nspanel.pky.eu/standalone/migration-appdaemon/)
|
||||||
|
|
||||||
|
## High-level differences
|
||||||
|
|
||||||
|
Old AppDaemon version:
|
||||||
|
|
||||||
|
- panel config in `apps.yaml` with `module` / `class` / `config`
|
||||||
|
- connectivity partly configured in AppDaemon plugin config (`appdaemon.yaml`)
|
||||||
|
|
||||||
|
Standalone rewrite:
|
||||||
|
|
||||||
|
- one runtime config file: `/config/panels.yaml`
|
||||||
|
- panel definitions under `nspanels`
|
||||||
|
- Home Assistant and MQTT connection values resolved directly by the rewrite runtime
|
||||||
|
|
||||||
|
## Minimal before/after example
|
||||||
|
|
||||||
|
Old (`apps.yaml`):
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
nspanel-1:
|
||||||
|
module: nspanel-lovelace-ui
|
||||||
|
class: NsPanelLovelaceUIManager
|
||||||
|
config:
|
||||||
|
panelRecvTopic: "tele/tasmota_panel/RESULT"
|
||||||
|
panelSendTopic: "cmnd/tasmota_panel/CustomSend"
|
||||||
|
model: eu
|
||||||
|
```
|
||||||
|
|
||||||
|
New (`panels.yaml`):
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
home_assistant_address: "http://supervisor"
|
||||||
|
home_assistant_token: "YOUR_TOKEN"
|
||||||
|
|
||||||
|
nspanels:
|
||||||
|
panel-1:
|
||||||
|
panelRecvTopic: "tele/tasmota_panel/RESULT"
|
||||||
|
panelSendTopic: "cmnd/tasmota_panel/CustomSend"
|
||||||
|
model: eu
|
||||||
|
locale: en_US
|
||||||
|
timeZone: "Europe/Berlin"
|
||||||
|
timeFormat: "%H:%M"
|
||||||
|
dateFormat: "full"
|
||||||
|
screensaver:
|
||||||
|
entities:
|
||||||
|
- entity: weather.home
|
||||||
|
cards:
|
||||||
|
- type: cardEntities
|
||||||
|
title: Main
|
||||||
|
entities:
|
||||||
|
- entity: light.kitchen
|
||||||
|
```
|
||||||
|
|
||||||
|
## Important key changes
|
||||||
|
|
||||||
|
Legacy key/concept | Rewrite key/concept | Notes
|
||||||
|
-- | -- | --
|
||||||
|
`module`, `class`, `config` wrapper | removed | Rewrite uses `nspanels.<panel_name>` directly.
|
||||||
|
`timezone` | `timeZone` | Casing changed.
|
||||||
|
`dateFormatBabel` | `dateFormat` | Use `dateFormat` in rewrite.
|
||||||
|
`temperatureUnit` (legacy card-level usage) | `temp_unit` (panel-level) | Rewrite reads `temp_unit` from panel settings.
|
||||||
|
brightness schedule lists | not supported | Rewrite supports integer or entity id for brightness values.
|
||||||
|
`updateMode` / OTA URL override keys | not supported | Legacy update behavior is not part of rewrite config.
|
||||||
|
|
||||||
|
If you are migrating now, use the standalone migration page for the complete mapping:
|
||||||
|
|
||||||
|
- [Complete mapping and checklist](https://docs.nspanel.pky.eu/standalone/migration-appdaemon/)
|
||||||
@@ -44,8 +44,6 @@ Using a 6th entity will automatically activate the alternative layout.
|
|||||||
type: 0
|
type: 0
|
||||||
- entity: weather.demo_weather_north
|
- entity: weather.demo_weather_north
|
||||||
type: 1
|
type: 1
|
||||||
- entity: weather.demo_weather_north
|
|
||||||
type: 2
|
|
||||||
- entity: sensor.energy_usage
|
- entity: sensor.energy_usage
|
||||||
- entity: delete
|
- entity: delete
|
||||||
- entity: sensor.indoor_temp
|
- entity: sensor.indoor_temp
|
||||||
|
|||||||
@@ -93,3 +93,4 @@ Now, to install NSPanel Lovelace UI Backend with HACS, follow these steps:
|
|||||||
6. A confirmation panel will appear, click on `Download`, and wait for HACS to
|
6. A confirmation panel will appear, click on `Download`, and wait for HACS to
|
||||||
proceed with the download
|
proceed with the download
|
||||||
7. The Backend Application is now installed, and HACS will inform you when updates are available
|
7. The Backend Application is now installed, and HACS will inform you when updates are available
|
||||||
|
|
||||||
|
|||||||
@@ -1,65 +1,71 @@
|
|||||||
# Flash Tasmota to your NSPanel
|
# Flash Tasmota to Your NSPanel
|
||||||
|
|
||||||
You need to connect to your nspanel via serial and flash tasmota [tasmota32-nspanel.bin](http://ota.tasmota.com/tasmota32/release/tasmota32-nspanel.bin) to your NSPanel.
|
You need to connect to your NSPanel via serial and flash Tasmota using [tasmota32-nspanel.bin](http://ota.tasmota.com/tasmota32/release/tasmota32-nspanel.bin).
|
||||||
You can use the Tasmota Web Installer to do so. [Tasmota Web Installer](https://tasmota.github.io/install/)
|
You can use the [Tasmota Web Installer](https://tasmota.github.io/install/) to do so.
|
||||||
|
|
||||||
Checkout Blakadders Template Repo for more information on flashing, do not use the autoexec.be from this page.
|
Check out Blakadder's Template Repo for more information on flashing. **Do not** use the autoexec.be from that page.
|
||||||
[NSPanel Page of the Tasmota Template Repository](https://templates.blakadder.com/sonoff_NSPanel.html)
|
[NSPanel Page of the Tasmota Template Repository](https://templates.blakadder.com/sonoff_NSPanel.html)
|
||||||
|
|
||||||
If you prefer EspHome over Tasmota, you can use this thrid party esphome component, which is replacing tasmota and the berry driver of this project.
|
If you prefer ESPHome over Tasmota, you can use this third-party ESPHome component, which replaces Tasmota and the Berry driver used in this project.
|
||||||
[ESPHome component](https://github.com/sairon/esphome-nspanel-lovelace-ui)
|
[ESPHome Component](https://github.com/sairon/esphome-nspanel-lovelace-ui)
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Configure Tasmota Template for NSPanel
|
## Configure Tasmota Template for NSPanel
|
||||||
|
|
||||||
Configure the NSPanel template for Tasmota. (Go to Configuration and Configure Other and paste the template there, make sure to tick the activate checkbox)
|
Configure the NSPanel template for Tasmota. (Go to Configuration > Configure Other, paste the template there, and make sure to tick the Activate checkbox.)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
You can use the following template or copy the one on the [Tasmota Template Repo Site](https://templates.blakadder.com/sonoff_NSPanel.html).
|
You can use the following template or copy the one from the [Tasmota Template Repo Site](https://templates.blakadder.com/sonoff_NSPanel.html):
|
||||||
|
|
||||||
`{"NAME":"NSPanel","GPIO":[0,0,0,0,3872,0,0,0,0,0,32,0,0,0,0,225,0,480,224,1,0,0,0,33,0,0,0,0,0,0,0,0,0,0,4736,0],"FLAG":0,"BASE":1,"CMND":"ADCParam 2,11200,10000,3950 | Sleep 0 | BuzzerPWM 1"}`
|
{"NAME":"NSPanel","GPIO":[0,0,0,0,3872,0,0,0,0,0,32,0,0,0,0,225,0,480,224,1,0,0,0,33,0,0,0,0,0,0,0,0,0,0,4736,0],"FLAG":0,"BASE":1,"CMND":"ADCParam 2,11200,10000,3950 | Sleep 0 | BuzzerPWM 1"}
|
||||||
|
|
||||||
After a reboot of tasmota your screen will light up with the stock display firmware.
|
After a reboot of Tasmota, your screen will light up with the stock display firmware.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Upload Berry Driver to Tasmota
|
## Upload Berry Driver to Tasmota
|
||||||
|
|
||||||
Go to `Consoles` > `Console` in Tasmota and execute the following command:
|
Go to Consoles > Console in Tasmota and execute the following command:
|
||||||
|
|
||||||
```
|
Backlog UrlFetch https://raw.githubusercontent.com/joBr99/nspanel-lovelace-ui/main/tasmota/autoexec.be; SetOption151 0; Restart 1
|
||||||
Backlog UrlFetch https://raw.githubusercontent.com/joBr99/nspanel-lovelace-ui/main/tasmota/autoexec.be; SetOption151 0;Restart 1
|
|
||||||
```
|
|
||||||
|
|
||||||
This will download the autoexec.be file from the repository and restart tasmota.
|
This downloads the autoexec.be file from the repository and restarts Tasmota.
|
||||||
|
|
||||||
Note: The command is also disabling matter to free up memory, as it's most likely not used by any homeassistant users anyway.
|
Note: This command also disables Matter to free up memory, as it's unlikely to be used by most Home Assistant users. (Matter can cause memory issues during flashing of the Nextion screen, but you can re-enable it later if needed.)
|
||||||
(Matter could cause memory issues during flashing of the Nextion Screen, but you can still enable it if you need to.)
|
|
||||||
|
---
|
||||||
|
|
||||||
## Flash Firmware to Nextion Screen
|
## Flash Firmware to Nextion Screen
|
||||||
|
|
||||||
Due the limitations of Berry, it's not possible to download the tft file directly from github, so I'm also renting a small server where you can download the file via HTTP.
|
Due to the limitations of Berry, it's not possible to download the TFT file directly from GitHub. A small server is available to download the file via HTTP.
|
||||||
|
|
||||||
Use the one following commands in the tasmota console (not berry console) to flash the latest release from this repository:
|
Use one of the following commands in the Tasmota console (not the Berry console) to flash the latest release from this repository:
|
||||||
|
|
||||||
EU Version: `FlashNextion http://nspanel.pky.eu/lui-release.tft`
|
EU Version:
|
||||||
|
FlashNextion http://nspanel.pky.eu/lui-release.tft
|
||||||
|
|
||||||
US Version Portrait: `FlashNextion http://nspanel.pky.eu/lui-us-p-release.tft`
|
US Version Portrait:
|
||||||
|
FlashNextion http://nspanel.pky.eu/lui-us-p-release.tft
|
||||||
|
|
||||||
US Version Landscape: `FlashNextion http://nspanel.pky.eu/lui-us-l-release.tft`
|
US Version Landscape:
|
||||||
|
FlashNextion http://nspanel.pky.eu/lui-us-l-release.tft
|
||||||
|
|
||||||
After sending the command, the screen should show a progress bar. The flashing progress takes around 5 minutes.
|
After sending the command, the screen should show a progress bar. The flashing process takes around 5 minutes.
|
||||||
|
|
||||||
Note: For the US Version Users - keep in mind that you need to add the model config option to your apps.yaml later, more details on config overview page
|
Note for US users: You'll need to add the model config option to your apps.yaml later. More details can be found on the config overview page.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>Alternatively you can use your own webserver or the one build into HomeAssistant:</summary>
|
<summary>Alternatively, you can use your own web server or the one built into Home Assistant:</summary>
|
||||||
<br>
|
<br>
|
||||||
Upload the nspanel.tft from the lastest release to a Webserver (for example www folder of Home Assistant) and execute the following command in Tasmota Console. (Development Version: [tft file from HMI folder](HMI/nspanel.tft))
|
Upload the nspanel.tft from the latest release to a web server (for example, the www folder of Home Assistant) and execute the following command in the Tasmota Console.
|
||||||
|
(Development version: [TFT file from HMI folder](HMI/nspanel.tft))
|
||||||
|
|
||||||
**Webserver must be HTTP, HTTPS is not supported, due to limitations of berry lang on tasmota**
|
**The web server must be HTTP. HTTPS is not supported due to Berry language limitations in Tasmota.**
|
||||||
|
|
||||||
`FlashNextion http://ip-address-of-your-homeassistant:8123/local/nspanel.tft`
|
FlashNextion http://ip-address-of-your-homeassistant:8123/local/nspanel.tft
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,74 +0,0 @@
|
|||||||
const idAbfalliCal = 'ical.1'; // iCal Instanz zum Abfallkalender
|
|
||||||
const idZeichenLoeschen = 14; // x Zeichen links vom String abziehen, wenn vor dem Eventname noch Text steht z.B. Strassenname; Standard = 0
|
|
||||||
const idRestmuellName ='Hausmüll'; // Schwarze Tonne
|
|
||||||
const idWertstoffName = 'Gelber Sack'; // Gelbe Tonne / Sack
|
|
||||||
const idPappePapierName = 'Papier'; // Blaue Tonne
|
|
||||||
const idBioabfaelleName = 'Biomüll'; // Braune Tonne
|
|
||||||
|
|
||||||
|
|
||||||
var i, Muell_JSON, Event2, Color = 0;
|
|
||||||
|
|
||||||
for (i = 1; i <= 4; i++) {
|
|
||||||
if (!existsState('0_userdata.0.Abfallkalender.' + parseFloat(i) + '.date')) {
|
|
||||||
log(i + '.date nicht vorhanden, wurde erstellt');
|
|
||||||
createState('0_userdata.0.Abfallkalender.' + parseFloat(i) + '.date', '',
|
|
||||||
{
|
|
||||||
name: parseFloat(i) + '.date',
|
|
||||||
role: 'state',
|
|
||||||
type: 'string',
|
|
||||||
read: true,
|
|
||||||
write: true,
|
|
||||||
def: ''
|
|
||||||
});
|
|
||||||
};
|
|
||||||
if (!existsState('0_userdata.0.Abfallkalender.' + parseFloat(i) + '.event')) {
|
|
||||||
log(i + '.event nicht vorhanden, wurde erstellt');
|
|
||||||
createState('0_userdata.0.Abfallkalender.' + parseFloat(i) + '.event', '',
|
|
||||||
{
|
|
||||||
name: parseFloat(i) + '.event',
|
|
||||||
role: 'state',
|
|
||||||
type: 'string',
|
|
||||||
read: true,
|
|
||||||
write: true,
|
|
||||||
def: ''
|
|
||||||
});
|
|
||||||
};
|
|
||||||
if (!existsState('0_userdata.0.Abfallkalender.' + parseFloat(i) + '.color')) {
|
|
||||||
log(i + '.color nicht vorhanden, wurde erstellt');
|
|
||||||
createState('0_userdata.0.Abfallkalender.' + parseFloat(i) + '.color', 0,
|
|
||||||
{
|
|
||||||
name: parseFloat(i) + '.color',
|
|
||||||
role: 'state',
|
|
||||||
type: 'number',
|
|
||||||
read: true,
|
|
||||||
write: true,
|
|
||||||
def: 0
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function subsequenceFromStartLast(sequence, at1) {
|
|
||||||
var start = at1;
|
|
||||||
var end = sequence.length;
|
|
||||||
return sequence.slice(start, end);
|
|
||||||
}
|
|
||||||
|
|
||||||
on({ id: idAbfalliCal + '.data.table', change: "ne" }, async function () {
|
|
||||||
|
|
||||||
for (i = 0; i <= 3; i++) {
|
|
||||||
Muell_JSON = getState(idAbfalliCal + '.data.table').val;
|
|
||||||
setStateDelayed((['0_userdata.0.Abfallkalender.', parseFloat(i) + 1, '.date'].join('')), getAttr(Muell_JSON, (String(i) + '.date')), false, parseInt(((0) || "").toString(), 10), false);
|
|
||||||
Event2 = subsequenceFromStartLast(getAttr(Muell_JSON, (String(i) + '.event')), idZeichenLoeschen);
|
|
||||||
setStateDelayed((['0_userdata.0.Abfallkalender.', parseFloat(i) + 1, '.event'].join('')), Event2, false, parseInt(((0) || "").toString(), 10), false);
|
|
||||||
if (Event2 == idRestmuellName) {
|
|
||||||
Color = 33840;
|
|
||||||
} else if (Event2 == idBioabfaelleName) {
|
|
||||||
Color = 2016;
|
|
||||||
} else if (Event2 == idPappePapierName) {
|
|
||||||
Color = 31;
|
|
||||||
} else if (Event2 == idWertstoffName) {
|
|
||||||
Color = 65504;
|
|
||||||
}
|
|
||||||
setStateDelayed((['0_userdata.0.Abfallkalender.', parseFloat(i) + 1, '.color'].join('')), Color, false, parseInt(((0) || "").toString(), 10), false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
224
ioBroker/Blockly/Abfallkalender.ts
Normal file
224
ioBroker/Blockly/Abfallkalender.ts
Normal file
@@ -0,0 +1,224 @@
|
|||||||
|
/*
|
||||||
|
* @author 2023 @tt-tom
|
||||||
|
*
|
||||||
|
* Version 5.1.1
|
||||||
|
*
|
||||||
|
* Das Script erstellt die Datenpunkte und Alias für den Abfallkalender im Sonoff NSPanel
|
||||||
|
* Es wird der iCal Adapter benötigt und eine URL mit Terminen vom Entsorger bzw. eine .ics-Datei mit den Terminen.
|
||||||
|
* Das Script triggert auf dem bereitgestellten JSON im iCal adapter und füllt die 0_userdata.0 Datenpunkte
|
||||||
|
* Weitere Informationen findest du in der FAQ auf Github https://github.com/joBr99/nspanel-lovelace-ui/wiki
|
||||||
|
*
|
||||||
|
* changelog
|
||||||
|
* - 06.12.2023 - v5.0.2 add custom name for trashtype
|
||||||
|
* - 06.12.2023 - v5.1.0 Refactoring
|
||||||
|
* - 22.01.2024 - v5.1.1 Add tow Events more
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
const idTrashData: string = 'ical.0.data.table'; // Datenpunkt mit Daten im JSON Format
|
||||||
|
const idUserdataAbfallVerzeichnis: string = '0_userdata.0.Abfallkalender'; // Name des Datenpunktverzeichnis unter 0_userdata.0 -> Strandard = 0_userdata.0.Abfallkalender
|
||||||
|
const idAliasPanelVerzeichnis: string = 'alias.0.NSPanel.allgemein'; //Name PanelVerzeichnis unter alias.0. Standard = alias.0.NSPanel.1
|
||||||
|
const idAliasAbfallVerzeichnis: string = 'Abfall'; //Name Verzeichnis unterhalb der idPanelverzeichnis Standard = Abfall
|
||||||
|
|
||||||
|
const anzahlZeichenLoeschen: number = 14; // x Zeichen links vom String abziehen, wenn vor dem Eventname noch Text steht z.B. Strassenname; Standard = 0
|
||||||
|
const jsonEventName1: string = 'Hausmüll'; // Vergleichstring für Schwarze Tonne
|
||||||
|
const customEventName1: string = ''; // benutzerdefinierter Text für schwarze Tonne
|
||||||
|
const jsonEventName2: string = 'Gelber Sack'; // Vergleichstring für Gelbe Tonne / Sack
|
||||||
|
const customEventName2: string = ''; // benutzerdefinierter Text für gelbe Tonne
|
||||||
|
const jsonEventName3: string = 'Papier'; // Vergleichstring für Blaue Tonne
|
||||||
|
const customEventName3: string = ''; // benutzerdefinierter Text für blaue Tonne
|
||||||
|
const jsonEventName4: string = 'Biomüll'; // Vergleichstring für Braune Tonne
|
||||||
|
const customEventName4: string = ''; // benutzerdefinierter Text für braune Tonne
|
||||||
|
const jsonEventName5: string = 'Treppe'; // Vergleichstring für Event 5
|
||||||
|
const customEventName5: string = 'Besen schwingen'; // benutzerdefinierter Text für Event 5
|
||||||
|
const jsonEventName6: string = ''; // Vergleichstring für Event 6
|
||||||
|
const customEventName6: string = ''; // benutzerdefinierter Text für Event 6
|
||||||
|
|
||||||
|
const Debug: boolean = false;
|
||||||
|
|
||||||
|
// ------------------------- Trigger zum füllen der 0_userdata Datenpunkte aus dem json vom ical Adapter -------------------------------
|
||||||
|
|
||||||
|
// Trigger auf JSON Datenpunkt
|
||||||
|
on({ id: idTrashData, change: 'ne' }, async function () {
|
||||||
|
JSON_auswerten();
|
||||||
|
});
|
||||||
|
|
||||||
|
// ------------------------------------- Ende Trigger ------------------------------------
|
||||||
|
|
||||||
|
// ------------------------------------- Funktion JSON auswerten und DP füllen -------------------------------
|
||||||
|
async function JSON_auswerten() {
|
||||||
|
try {
|
||||||
|
|
||||||
|
let trashJSON: any;
|
||||||
|
let instanzName: any;
|
||||||
|
let eventName: string;
|
||||||
|
let eventDatum: string;
|
||||||
|
let eventStartdatum: string;
|
||||||
|
let farbNummer: number = 0;
|
||||||
|
let farbString: string;
|
||||||
|
let abfallNummer: number = 1;
|
||||||
|
|
||||||
|
trashJSON = getState(idTrashData).val;
|
||||||
|
instanzName = idTrashData.split('.');
|
||||||
|
|
||||||
|
if (Debug) log('Rohdaten von Instanz ' + instanzName[0] + ': ' + JSON.stringify(trashJSON), 'info')
|
||||||
|
|
||||||
|
|
||||||
|
if (Debug) log('Anzahl Trash - Daten: ' + trashJSON.length, 'info');
|
||||||
|
|
||||||
|
for (let i = 0; i < trashJSON.length; i++) {
|
||||||
|
if (abfallNummer === 7) {
|
||||||
|
if (Debug) log('Alle Abfall-Datenpunkte gefüllt', 'warn');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
log('Daten vom ical Adapter werden ausgewertet', 'info');
|
||||||
|
eventName = getAttr(trashJSON, (String(i) + '.event')).slice(anzahlZeichenLoeschen, getAttr(trashJSON, (String(i) + '.event')).length);
|
||||||
|
// Leerzeichen vorne und hinten löschen
|
||||||
|
eventName = eventName.trimEnd();
|
||||||
|
eventName = eventName.trimStart();
|
||||||
|
eventDatum = getAttr(trashJSON, (String(i) + '.date'));
|
||||||
|
eventStartdatum = getAttr(trashJSON, (String(i) + '._date'));
|
||||||
|
|
||||||
|
let d: Date = currentDate();
|
||||||
|
let d1: Date = new Date(eventStartdatum);
|
||||||
|
|
||||||
|
if (Debug) log('--------- Nächster Termin wird geprüft ---------', 'info');
|
||||||
|
//if (Debug) log(d + ' ' + d1, 'info');
|
||||||
|
if (Debug) log('Startdatum UTC: ' + eventStartdatum, 'info');
|
||||||
|
if (Debug) log('Datum: ' + eventDatum, 'info');
|
||||||
|
if (Debug) log('Event: ' + eventName, 'info');
|
||||||
|
if (Debug) log('Kontrolle Leerzeichen %' + eventName + '%', 'info');
|
||||||
|
|
||||||
|
if (d.getTime() <= d1.getTime()) {
|
||||||
|
if ((eventName == jsonEventName1) || (eventName == jsonEventName2) || (eventName == jsonEventName3) || (eventName == jsonEventName4) || (eventName == jsonEventName5) || (eventName == jsonEventName6)) {
|
||||||
|
|
||||||
|
switch (eventName) {
|
||||||
|
case jsonEventName1:
|
||||||
|
farbNummer = 33840;
|
||||||
|
if (customEventName1 != '') {
|
||||||
|
eventName = customEventName1;
|
||||||
|
if (Debug) log('Event customName: ' + eventName, 'info');
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case jsonEventName2:
|
||||||
|
farbNummer = 65504;
|
||||||
|
if (customEventName2 != '') {
|
||||||
|
eventName = customEventName2;
|
||||||
|
if (Debug) log('Event customName: ' + eventName, 'info');
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case jsonEventName3:
|
||||||
|
farbNummer = 31;
|
||||||
|
if (customEventName3 != '') {
|
||||||
|
eventName = customEventName3
|
||||||
|
if (Debug) log('Event customName: ' + eventName, 'info');
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case jsonEventName4:
|
||||||
|
farbNummer = 2016;
|
||||||
|
if (customEventName4 != '') {
|
||||||
|
eventName = customEventName4;
|
||||||
|
if (Debug) log('Event customName: ' + eventName, 'info');
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case jsonEventName5:
|
||||||
|
farbNummer = 2016;
|
||||||
|
if (customEventName5 != '') {
|
||||||
|
eventName = customEventName5;
|
||||||
|
if (Debug) log('Event customName: ' + eventName, 'info');
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case jsonEventName6:
|
||||||
|
farbNummer = 2016;
|
||||||
|
if (customEventName6 != '') {
|
||||||
|
eventName = customEventName6
|
||||||
|
if (Debug) log('Event customName: ' + eventName, 'info');
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//if (farbString != undefined) farbNummer = rgb_dec565(hex_rgb(farbString));
|
||||||
|
|
||||||
|
|
||||||
|
setState(idUserdataAbfallVerzeichnis + '.' + String(abfallNummer) + '.date', eventDatum);
|
||||||
|
setState(idUserdataAbfallVerzeichnis + '.' + String(abfallNummer) + '.event', eventName);
|
||||||
|
setState(idUserdataAbfallVerzeichnis + '.' + String(abfallNummer) + '.color', farbNummer);
|
||||||
|
|
||||||
|
|
||||||
|
//if (Debug) log('farbString: ' + farbString + ' farbNummer: ' + farbNummer, 'info');
|
||||||
|
if (Debug) log('Abfallnummer: ' + abfallNummer, 'info');
|
||||||
|
|
||||||
|
abfallNummer += 1
|
||||||
|
} else {
|
||||||
|
if (Debug) log('Kein Abfalltermin => Event passt mit keinem Abfallnamen überein.', 'warn');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Debug) log('Termin liegt vor dem heutigen Tag', 'warn');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
log('error at subscrption: ' + err.message, 'warn');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// ------------------------------------- Ende Funktion JSON ------------------------------
|
||||||
|
|
||||||
|
// ------------------------------------- Funktion zur Prüfung und Erstellung der Datenpunkte in 0_userdata.0 und alias.0 -----------------------
|
||||||
|
|
||||||
|
async function Init_Datenpunkte() {
|
||||||
|
try {
|
||||||
|
for (let i = 1; i <= 6; i++) {
|
||||||
|
if (existsObject(idUserdataAbfallVerzeichnis + '.' + String(i)) == false) {
|
||||||
|
log('Datenpunkt ' + idUserdataAbfallVerzeichnis + '.' + String(i) + ' werden angelegt', 'info')
|
||||||
|
await createStateAsync(idUserdataAbfallVerzeichnis + '.' + String(i) + '.date', '', { type: 'string' });
|
||||||
|
await createStateAsync(idUserdataAbfallVerzeichnis + '.' + String(i) + '.event', '', { type: 'string' });
|
||||||
|
await createStateAsync(idUserdataAbfallVerzeichnis + '.' + String(i) + '.color', 0, { type: 'number' });
|
||||||
|
setObject(idAliasPanelVerzeichnis + '.' + idAliasAbfallVerzeichnis, { type: 'device', common: { name: { de: 'Abfall', en: 'Trash' } }, native: {} });
|
||||||
|
setObject(idAliasPanelVerzeichnis + '.' + idAliasAbfallVerzeichnis + '.event' + String(i), { type: 'channel', common: { role: 'warning', name: { de: 'Ereignis ' + String(i), en: 'Event' + String(i) } }, native: {} });
|
||||||
|
await createAliasAsync(idAliasPanelVerzeichnis + '.' + idAliasAbfallVerzeichnis + '.event' + String(i) + '.TITLE', idUserdataAbfallVerzeichnis + '.' + String(i) + '.event', true, <iobJS.StateCommon>{ type: 'string', role: 'weather.title.short', name: { de: 'TITEL', en: 'TITLE' } });
|
||||||
|
await createAliasAsync(idAliasPanelVerzeichnis + '.' + idAliasAbfallVerzeichnis + '.event' + String(i) + '.LEVEL', idUserdataAbfallVerzeichnis + '.' + String(i) + '.color', true, <iobJS.StateCommon>{ type: 'number', role: 'value.warning', name: { de: 'LEVEL', en: 'LEVEL' } });
|
||||||
|
await createAliasAsync(idAliasPanelVerzeichnis + '.' + idAliasAbfallVerzeichnis + '.event' + String(i) + '.INFO', idUserdataAbfallVerzeichnis + '.' + String(i) + '.date', true, <iobJS.StateCommon>{ type: 'string', role: 'weather.title', name: { de: 'INFO', en: 'INFO' } });
|
||||||
|
log('Fertig', 'info')
|
||||||
|
} else {
|
||||||
|
log('Datenpunkt ' + idUserdataAbfallVerzeichnis + '.' + String(i) + ' vorhanden', 'info')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log('Startabfrage der Daten', 'info');
|
||||||
|
JSON_auswerten();
|
||||||
|
} catch (err) {
|
||||||
|
log('error at function Init_Datenpunkte: ' + err.message, 'warn');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Init_Datenpunkte();
|
||||||
|
|
||||||
|
// --------------------------- Ende Funktion Datenpunkte ------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
// --------------------------- Zusatzfuktionen -------------------------------------------------------------
|
||||||
|
function currentDate() {
|
||||||
|
let d: Date = new Date();
|
||||||
|
return new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
||||||
|
}
|
||||||
|
|
||||||
|
function rgb_dec565(rgb: RGB): number {
|
||||||
|
//return ((Math.floor(rgb.red / 255 * 31) << 11) | (Math.floor(rgb.green / 255 * 63) << 5) | (Math.floor(rgb.blue / 255 * 31)));
|
||||||
|
return ((rgb.red >> 3) << 11) | ((rgb.green >> 2)) << 5 | ((rgb.blue) >> 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
function hex_rgb(colorhex: string): RGB {
|
||||||
|
let r = parseInt(colorhex.substring(1, 3), 16);
|
||||||
|
let g = parseInt(colorhex.substring(3, 5), 16);
|
||||||
|
let b = parseInt(colorhex.substring(5, 7), 16);
|
||||||
|
return { red: r, green: g, blue: b };
|
||||||
|
}
|
||||||
|
|
||||||
|
type RGB = {
|
||||||
|
red: number,
|
||||||
|
green: number,
|
||||||
|
blue: number
|
||||||
|
};
|
||||||
|
|
||||||
|
// -------------------- Ende Zudatzfunktionen --------------------------------------------------------------------------
|
||||||
51
ioBroker/Blockly/CardChart_History.js
Normal file
51
ioBroker/Blockly/CardChart_History.js
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
const sourceDP = 'alias.0.Wohnzimmer.Heizung.ACTUAL';
|
||||||
|
const targetDP = '0_userdata.0.Test.chartTest';
|
||||||
|
const rangeHours = 24;
|
||||||
|
const maxXAchsisTicks = 6;
|
||||||
|
const historyInstance = 'history.0';
|
||||||
|
const factor = 1; // Bei zu großen Werten und negativen Anzeigen im Panel um das 10fache erhöhen
|
||||||
|
|
||||||
|
on({id: sourceDP, change: "any"}, async function (obj) {
|
||||||
|
sendTo(historyInstance, 'getHistory', {
|
||||||
|
id: sourceDP,
|
||||||
|
options: {
|
||||||
|
start: Date.now() - (60 * 60 * 1000 * rangeHours),
|
||||||
|
end: Date.now(),
|
||||||
|
count: rangeHours,
|
||||||
|
limit: rangeHours,
|
||||||
|
aggregate: 'average'
|
||||||
|
}
|
||||||
|
}, function (result) {
|
||||||
|
var cardChartString = "";
|
||||||
|
var stepXAchsis = rangeHours / maxXAchsisTicks;
|
||||||
|
|
||||||
|
for (var i = 0; i < rangeHours; i++){
|
||||||
|
var deltaHour = rangeHours - i;
|
||||||
|
var targetDate = new Date(Date.now() - (deltaHour * 60 * 60 * 1000));
|
||||||
|
|
||||||
|
//Check history items for requested hours
|
||||||
|
for (var j = 0, targetValue = 0; j < result.result.length; j++) {
|
||||||
|
var valueDate = new Date(result.result[j].ts);
|
||||||
|
var value = Math.round(result.result[j].val / factor * 10);
|
||||||
|
|
||||||
|
if (valueDate > targetDate){
|
||||||
|
if ((targetDate.getHours() % stepXAchsis) == 0){
|
||||||
|
cardChartString += targetValue + '^' + targetDate.getHours() + ':00' + '~';
|
||||||
|
} else {
|
||||||
|
cardChartString += targetValue + '~';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
targetValue = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cardChartString = cardChartString.substring(0,cardChartString.length-1);
|
||||||
|
if (existsState(targetDP) == false ) {
|
||||||
|
createState(targetDP, cardChartString, true, { type: 'string' });
|
||||||
|
} else {
|
||||||
|
setState(targetDP, cardChartString, true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
78
ioBroker/Blockly/CardLChart_History.js
Normal file
78
ioBroker/Blockly/CardLChart_History.js
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
const sourceDP = 'alias.0.Wohnzimmer.Heizung.ACTUAL';
|
||||||
|
const targetDP = '0_userdata.0.Test.chartTest';
|
||||||
|
const numberOfHoursAgo = 24; // Period of time in hours which shall be visualized
|
||||||
|
const xAxisTicksEveryM = 60; // Time after x axis gets a tick in minutes
|
||||||
|
const xAxisLabelEveryM = 240; // Time after x axis is labeled in minutes
|
||||||
|
const historyInstance = 'history.0';
|
||||||
|
|
||||||
|
const Debug = false;
|
||||||
|
const maxX = 1420;
|
||||||
|
const limitMeasurements = 35;
|
||||||
|
|
||||||
|
createState(targetDP, "", {
|
||||||
|
name: 'SensorGrid',
|
||||||
|
desc: 'Sensor Values [~<time>:<value>]*',
|
||||||
|
type: 'string',
|
||||||
|
role: 'value',
|
||||||
|
});
|
||||||
|
|
||||||
|
on({id: sourceDP, change: "any"}, async function (obj) {
|
||||||
|
sendTo(historyInstance, 'getHistory', {
|
||||||
|
id: sourceDP,
|
||||||
|
options: {
|
||||||
|
start: Date.now() - (numberOfHoursAgo * 60 * 60 * 1000 ), //Time in ms: hours * 60m * 60s * 1000ms
|
||||||
|
end: Date.now(),
|
||||||
|
count: limitMeasurements,
|
||||||
|
limit: limitMeasurements,
|
||||||
|
aggregate: 'average'
|
||||||
|
}
|
||||||
|
}, function (result) {
|
||||||
|
var ticksAndLabels = ""
|
||||||
|
var coordinates = "";
|
||||||
|
var cardLChartString = "";
|
||||||
|
|
||||||
|
let ticksAndLabelsList = []
|
||||||
|
var date = new Date();
|
||||||
|
date.setMinutes(0, 0, 0);
|
||||||
|
var ts = Math.round(date.getTime() / 1000);
|
||||||
|
var tsYesterday = ts - (numberOfHoursAgo * 3600);
|
||||||
|
|
||||||
|
for (var x = tsYesterday, i = 0; x < ts; x += (xAxisTicksEveryM * 60), i += xAxisTicksEveryM)
|
||||||
|
{
|
||||||
|
if (i % xAxisLabelEveryM)
|
||||||
|
{
|
||||||
|
ticksAndLabelsList.push(i);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
var currentDate = new Date(x * 1000);
|
||||||
|
// Hours part from the timestamp
|
||||||
|
var hours = "0" + currentDate.getHours();
|
||||||
|
// Minutes part from the timestamp
|
||||||
|
var minutes = "0" + currentDate.getMinutes();
|
||||||
|
// Seconds part from the timestamp
|
||||||
|
var seconds = "0" + currentDate.getSeconds();
|
||||||
|
var formattedTime = hours.slice(-2) + ':' + minutes.slice(-2);
|
||||||
|
ticksAndLabelsList.push(String(i) + "^" + formattedTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ticksAndLabels = ticksAndLabelsList.join("+");
|
||||||
|
|
||||||
|
let list = [];
|
||||||
|
let offSetTime = Math.round(result.result[0].ts / 1000);
|
||||||
|
let counter = Math.round((result.result[result.result.length -1 ].ts / 1000 - offSetTime) / maxX);
|
||||||
|
for (var i = 0; i < result.result.length; i++)
|
||||||
|
{
|
||||||
|
var time = Math.round(((result.result[i].ts / 1000) - offSetTime) / counter);
|
||||||
|
var value = Math.round(result.result[i].val * 10);
|
||||||
|
if ((value != null) && (value != 0)){
|
||||||
|
list.push(time + ":" + value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
coordinates = list.join("~");
|
||||||
|
cardLChartString = ticksAndLabels + '~' + coordinates
|
||||||
|
setState(targetDP, cardLChartString, true);
|
||||||
|
|
||||||
|
if (Debug) console.log(cardLChartString);
|
||||||
|
});
|
||||||
|
});
|
||||||
130
ioBroker/Blockly/CardLChart_Influx2.ts
Normal file
130
ioBroker/Blockly/CardLChart_Influx2.ts
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
/**
|
||||||
|
* Dieses Script fragt eine influxDb ab, um Daten für die cardLcart (Liniendiagramm) zuberechnen und im richtigen Format bereitzustellen.
|
||||||
|
* Es erstellt automatisch einen Datenpunkt.
|
||||||
|
* Die Abfrage muss ggf. angepasst werden. Aktuell ermittelt sie Werte der letzten 24h, zu Stundenwerten zusammengefasst.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const Debug = false; // true für erweiterte Ausgaben im Log
|
||||||
|
|
||||||
|
const NSPanel_Path = '0_userdata.0.NSPanel.';
|
||||||
|
const Path = NSPanel_Path + 'Influx2NSPanel.cardLChart.';
|
||||||
|
const InfluxInstance = 'influxdb.0';
|
||||||
|
const influxDbBucket = 'storage_short';
|
||||||
|
const numberOfHoursAgo = 24;
|
||||||
|
const xAxisTicksEveryM = 60;
|
||||||
|
const xAxisLabelEveryM = 240;
|
||||||
|
//
|
||||||
|
|
||||||
|
const sensors : Record<string, Record <string, string>> = {};
|
||||||
|
/**
|
||||||
|
* Hier werden die Sensoren festgelegt nach flogendem Schema
|
||||||
|
*
|
||||||
|
* sensors[‘Datenpunkt(kompletter Pfad) des Messwertes'] = {'taget': 'Name des Datenpunkt für die Chartwerte', 'measurement': 'genutzter Alias in der Influxdb für den Messwert'};
|
||||||
|
*
|
||||||
|
* Wenn der Wert in der Datenbank keinen Alias hat bleibt der Wert 'measurement': weg.
|
||||||
|
* Jeder Messwert bekommt einen eigenen sensors[...] = {'target':....}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
sensors['netatmo-crawler.0.stationData.1.temperature'] = {'target':'AussenTemp', 'measurement':'wetter.temperatur'};
|
||||||
|
|
||||||
|
// ##### ab hier keine Änderungen mehr nötig #####
|
||||||
|
|
||||||
|
// create data source for NsPanel on script startup
|
||||||
|
Object.keys(sensors).forEach(async id => {
|
||||||
|
await generateDateAsync(id);
|
||||||
|
});
|
||||||
|
|
||||||
|
// then listen to the sensors and update the data source states accordingly
|
||||||
|
on({ id: Object.keys(sensors), change: 'any' }, async function (obj) {
|
||||||
|
if (!obj.id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await generateDateAsync(obj.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
//__________________________
|
||||||
|
// Beschreibe diese Funktion: Daten generieren
|
||||||
|
async function generateDateAsync(sensorId: string) {
|
||||||
|
let idMeasurement = sensors[sensorId].measurement;
|
||||||
|
if (idMeasurement =='' ||idMeasurement == undefined) {idMeasurement = sensorId};
|
||||||
|
const dataPointId:string = Path + sensors[sensorId].target +'.ACTUAL';
|
||||||
|
if (Debug) log(`(f) generateDateAsync: ${sensorId} ${dataPointId} > ${idMeasurement}`);
|
||||||
|
|
||||||
|
const query =[
|
||||||
|
'from(bucket: "' + influxDbBucket + '")',
|
||||||
|
'|> range(start: -' + numberOfHoursAgo + 'h)',
|
||||||
|
'|> filter(fn: (r) => r["_measurement"] == "' + idMeasurement + '")',
|
||||||
|
'|> filter(fn: (r) => r["_field"] == "value")',
|
||||||
|
'|> drop(columns: ["from", "ack", "q"])',
|
||||||
|
'|> aggregateWindow(every: 1h, fn: last, createEmpty: false)',
|
||||||
|
'|> map(fn: (r) => ({ r with _rtime: int(v: r._time) - int(v: r._start)}))',
|
||||||
|
'|> yield(name: "_result")'].join('');
|
||||||
|
|
||||||
|
if (Debug) console.log('Query: ' + query);
|
||||||
|
|
||||||
|
const result : any = await sendToAsync(InfluxInstance, 'query', query);
|
||||||
|
if (result.error) {
|
||||||
|
console.error(result.error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Debug) console.log(JSON.stringify(result));
|
||||||
|
const numResults = result.result.length;
|
||||||
|
let coordinates : string = '';
|
||||||
|
for (let r = 0; r < numResults; r++)
|
||||||
|
{
|
||||||
|
const list : string[] = [];
|
||||||
|
const numValues = result.result[r].length;
|
||||||
|
|
||||||
|
for (let i = 0; i < numValues; i++)
|
||||||
|
{
|
||||||
|
const time = Math.round(result.result[r][i]._rtime/1000/1000/1000/60);
|
||||||
|
const value = Math.round(result.result[r][i]._value * 10);
|
||||||
|
list.push(time + ":" + value);
|
||||||
|
}
|
||||||
|
|
||||||
|
coordinates = list.join("~");
|
||||||
|
if (Debug) console.log(coordinates);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ticksAndLabelsList : string[] = []
|
||||||
|
const date = new Date();
|
||||||
|
date.setMinutes(0, 0, 0);
|
||||||
|
const ts = Math.round(date.getTime() / 1000);
|
||||||
|
const tsYesterday = ts - (numberOfHoursAgo * 3600);
|
||||||
|
if (Debug) console.log('Iterate from ' + tsYesterday + ' to ' + ts + ' stepsize=' + (xAxisTicksEveryM * 60));
|
||||||
|
for (let x = tsYesterday, i = 0; x < ts; x += (xAxisTicksEveryM * 60), i += xAxisTicksEveryM)
|
||||||
|
{
|
||||||
|
if ((i % xAxisLabelEveryM))
|
||||||
|
ticksAndLabelsList.push('' + i);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const currentDate = new Date(x * 1000);
|
||||||
|
// Hours part from the timestamp
|
||||||
|
const hours = "0" + String(currentDate.getHours());
|
||||||
|
// Minutes part from the timestamp
|
||||||
|
const minutes = "0" + String(currentDate.getMinutes());
|
||||||
|
const formattedTime = hours.slice(-2) + ':' + minutes.slice(-2);
|
||||||
|
|
||||||
|
ticksAndLabelsList.push(String(i) + "^" + formattedTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Debug) console.log('Ticks & Label: ' + ticksAndLabelsList);
|
||||||
|
if (Debug) console.log('Coordinates: ' + coordinates);
|
||||||
|
await setOrCreate(dataPointId, ticksAndLabelsList.join("+") + '~' + coordinates, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//__________________________
|
||||||
|
// Beschreibe diese Funktion: Datenpunkte anlegen bzw. schreiben
|
||||||
|
async function setOrCreate(id : string, value : any, ack : boolean) {
|
||||||
|
if (!(await existsStateAsync(id))) {
|
||||||
|
await createStateAsync(id, value, {
|
||||||
|
name: id.split('.').reverse()[0],
|
||||||
|
desc: 'Sensor Values [~<time>:<value>]*',
|
||||||
|
type: 'string',
|
||||||
|
role: 'value',
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
await setStateAsync(id, value, ack);
|
||||||
|
}
|
||||||
|
}
|
||||||
54
ioBroker/Blockly/CardPower.js
Normal file
54
ioBroker/Blockly/CardPower.js
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/**
|
||||||
|
* generate an JSON for display Power-Card on NSPanel
|
||||||
|
* Source: https://github.com/joBr99/nspanel-lovelace-ui/wiki/ioBroker-Card-Definitionen-(Seiten)#cardpower-ab-ts-script-v341
|
||||||
|
* Version: 0.1 - L4rs
|
||||||
|
*/
|
||||||
|
schedule("* * * * *", function () {
|
||||||
|
|
||||||
|
// Definition der Datenpunkte für das JSON der POWER-Card und der anzuzeigenden Leistungswerte
|
||||||
|
var powerCardJson = "0_userdata.0.NSPanel.Energie.PowerCard",
|
||||||
|
pwr1 = "", // Batterie
|
||||||
|
pwr2 = Math.round(getState("mqtt.0.SmartHome.Energie.PV.openDTU.114180710360.0.power").val), // Solar
|
||||||
|
pwr3 = "", // Wind
|
||||||
|
pwr4 = "", // Verbraucher
|
||||||
|
pwr5 = Math.round(getState("hm-rpc.0.MEQ0706303.1.POWER").val), // Stromnetz
|
||||||
|
pwr6 = 0, // Auto
|
||||||
|
pwrHome = Math.round(pwr5 - pwr2); // Berechnung des Energiefluss anstelle eines Datenpunktes
|
||||||
|
|
||||||
|
// Definition der Keys im JSON
|
||||||
|
var keys = ["id", "value", "unit", "icon", "iconColor", "speed"];
|
||||||
|
|
||||||
|
// Definition der "Kacheln", inkl. StandardIcon. Es können alle Icon aus dem Iconmapping genutzt werden.
|
||||||
|
// Kacheln die nicht genutzt werden sollen, müssen wie z.b. item1 formatiert sein
|
||||||
|
var home = [0, pwrHome, "W", "home-lightning-bolt-outline", 0]; // Icon home
|
||||||
|
var item1 = [1, pwr1, "", "", 0, ""]; // Icon battery-charging-60
|
||||||
|
var item2 = [2, pwr2, "W", "solar-power-variant-outline", 3, pwr2 > 0 ? -2 : 0]; // Icon solar-power-variant
|
||||||
|
var item3 = [3, pwr3, "", "", 0, ""]; // Icon wind-turbine
|
||||||
|
var item4 = [4, pwr4, "", "", 0, ""]; // Icon shape
|
||||||
|
var item5 = [5, pwr5, "W", "transmission-tower", 10, 10]; // Icon transmission-tower
|
||||||
|
var item6 = [6, pwr6, "kW", "car-electric-outline", 5, 0]; // Icon car
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JSON generieren und in den Datenpunkt schreiben,
|
||||||
|
*
|
||||||
|
* --- ab hier keine Änderungen mehr ---
|
||||||
|
*/
|
||||||
|
function func(tags, values) {
|
||||||
|
return Object.assign(
|
||||||
|
...tags.map((element, index) => ({ [element]: values[index] }))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
setState(
|
||||||
|
powerCardJson,
|
||||||
|
JSON.stringify([
|
||||||
|
func(keys, home),
|
||||||
|
func(keys, item1),
|
||||||
|
func(keys, item2),
|
||||||
|
func(keys, item3),
|
||||||
|
func(keys, item4),
|
||||||
|
func(keys, item5),
|
||||||
|
func(keys, item6),
|
||||||
|
])
|
||||||
|
);
|
||||||
|
});
|
||||||
File diff suppressed because it is too large
Load Diff
BIN
ioBroker/HMI/nspanel-us-l-v4.5.0.HMI
Normal file
BIN
ioBroker/HMI/nspanel-us-l-v4.5.0.HMI
Normal file
Binary file not shown.
BIN
ioBroker/HMI/nspanel-us-p-v4.5.0.HMI
Normal file
BIN
ioBroker/HMI/nspanel-us-p-v4.5.0.HMI
Normal file
Binary file not shown.
BIN
ioBroker/HMI/nspanel-v4.5.0.HMI
Normal file
BIN
ioBroker/HMI/nspanel-v4.5.0.HMI
Normal file
Binary file not shown.
14820
ioBroker/NsPanelTs.ts
14820
ioBroker/NsPanelTs.ts
File diff suppressed because it is too large
Load Diff
@@ -2564,7 +2564,11 @@
|
|||||||
"crossfade":{
|
"crossfade":{
|
||||||
"en-US":"Crossfade",
|
"en-US":"Crossfade",
|
||||||
"de-DE":"Überblenden"
|
"de-DE":"Überblenden"
|
||||||
},
|
},
|
||||||
|
"tools":{
|
||||||
|
"en-US":"Tools",
|
||||||
|
"de-DE":"Tools"
|
||||||
|
},
|
||||||
"speaker":{
|
"speaker":{
|
||||||
"en-US":"Speakerlist",
|
"en-US":"Speakerlist",
|
||||||
"de-DE":"Wiedergabegeräte",
|
"de-DE":"Wiedergabegeräte",
|
||||||
|
|||||||
@@ -2701,5 +2701,13 @@
|
|||||||
"scriptname":{
|
"scriptname":{
|
||||||
"en-US":"Script name",
|
"en-US":"Script name",
|
||||||
"de-DE":"Skriptname"
|
"de-DE":"Skriptname"
|
||||||
|
},
|
||||||
|
"hiddencards_offon":{
|
||||||
|
"en-US":"hidden Cards (on/off)",
|
||||||
|
"de-DE":"ausgeblendete Seiten (an/aus)"
|
||||||
|
},
|
||||||
|
"easyview_layout":{
|
||||||
|
"en-US":"Easyview Layout",
|
||||||
|
"de-DE":"Einfaches Layout"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ repo_name: jobr99/nspanel-lovelace-ui
|
|||||||
repo_url: https://github.com/jobr99/nspanel-lovelace-ui
|
repo_url: https://github.com/jobr99/nspanel-lovelace-ui
|
||||||
edit_uri: ""
|
edit_uri: ""
|
||||||
|
|
||||||
copyright: "Copyright © 2023 Johannes Braun"
|
copyright: "Copyright © 2026 Johannes Braun"
|
||||||
|
|
||||||
docs_dir: docs
|
docs_dir: docs
|
||||||
|
|
||||||
@@ -42,8 +42,6 @@ extra_css:
|
|||||||
extra:
|
extra:
|
||||||
analytics:
|
analytics:
|
||||||
provider: custom
|
provider: custom
|
||||||
version:
|
|
||||||
provider: mike
|
|
||||||
|
|
||||||
markdown_extensions:
|
markdown_extensions:
|
||||||
- admonition
|
- admonition
|
||||||
@@ -63,7 +61,6 @@ markdown_extensions:
|
|||||||
plugins:
|
plugins:
|
||||||
- search:
|
- search:
|
||||||
lang: en
|
lang: en
|
||||||
- mkdocs-video
|
|
||||||
|
|
||||||
nav:
|
nav:
|
||||||
- "Overview": index.md
|
- "Overview": index.md
|
||||||
@@ -75,6 +72,7 @@ nav:
|
|||||||
- "FAQ": faq.md
|
- "FAQ": faq.md
|
||||||
- "Configuration - apps.yaml (Home Assistant)":
|
- "Configuration - apps.yaml (Home Assistant)":
|
||||||
- "Overview": config-overview.md
|
- "Overview": config-overview.md
|
||||||
|
#- "Migration to Standalone Rewrite": config-migration-standalone.md
|
||||||
- "Screensaver": config-screensaver.md
|
- "Screensaver": config-screensaver.md
|
||||||
- "Cards":
|
- "Cards":
|
||||||
- "Entities Card": card-entities.md
|
- "Entities Card": card-entities.md
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config
|
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config
|
||||||
name: NSPanel Lovelace UI Addon
|
name: NSPanel Lovelace UI Addon
|
||||||
version: "4.7.74"
|
version: "4.7.85"
|
||||||
slug: nspanel-lovelace-ui
|
slug: nspanel-lovelace-ui
|
||||||
description: NSPanel Lovelace UI Addon
|
description: NSPanel Lovelace UI Addon
|
||||||
services:
|
services:
|
||||||
|
|||||||
@@ -209,11 +209,11 @@ class HAEntity(panel_cards.Entity):
|
|||||||
forecast = libs.home_assistant.execute_script(
|
forecast = libs.home_assistant.execute_script(
|
||||||
entity_name=self.entity_id,
|
entity_name=self.entity_id,
|
||||||
domain='weather',
|
domain='weather',
|
||||||
service="get_forecast",
|
service="get_forecasts",
|
||||||
service_data={
|
service_data={
|
||||||
'type': forecast_type
|
'type': forecast_type
|
||||||
}
|
}
|
||||||
).get("forecast", [])
|
).get(self.entity_id,{}).get("forecast", [])
|
||||||
if len(forecast) > pos:
|
if len(forecast) > pos:
|
||||||
forcast_pos = forecast[pos]
|
forcast_pos = forecast[pos]
|
||||||
forcast_condition = forcast_pos.get("condition", "")
|
forcast_condition = forcast_pos.get("condition", "")
|
||||||
@@ -475,7 +475,7 @@ class AlarmCard(HACard):
|
|||||||
main_entity = self.entities[0]
|
main_entity = self.entities[0]
|
||||||
main_entity.render()
|
main_entity.render()
|
||||||
|
|
||||||
print(main_entity.state)
|
logging.debug("Alarm card state for '%s': %s", main_entity.entity_id, main_entity.state)
|
||||||
|
|
||||||
icon = get_icon_char("shield-off")
|
icon = get_icon_char("shield-off")
|
||||||
color = rgb_dec565([255,255,255])
|
color = rgb_dec565([255,255,255])
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ def wait_for_ha_cache():
|
|||||||
while time.time() < mustend:
|
while time.time() < mustend:
|
||||||
if len(libs.home_assistant.home_assistant_entity_state_cache) == 0:
|
if len(libs.home_assistant.home_assistant_entity_state_cache) == 0:
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
if len(libs.home_assistant.home_assistant_entity_state_cache) == 0:
|
||||||
|
logging.warning("Home Assistant entity cache is still empty after waiting 5 seconds")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
def calculate_dim_values(sleepTracking, sleepTrackingZones, sleepBrightness, screenBrightness, sleepOverride, return_involved_entities=False):
|
def calculate_dim_values(sleepTracking, sleepTrackingZones, sleepBrightness, screenBrightness, sleepOverride, return_involved_entities=False):
|
||||||
@@ -20,27 +22,32 @@ def calculate_dim_values(sleepTracking, sleepTrackingZones, sleepBrightness, scr
|
|||||||
dimmode = sleepBrightness
|
dimmode = sleepBrightness
|
||||||
elif isinstance(sleepBrightness, list):
|
elif isinstance(sleepBrightness, list):
|
||||||
logging.error("list style config for sleepBrightness no longer supported")
|
logging.error("list style config for sleepBrightness no longer supported")
|
||||||
elif sleepBrightness.startswith("ha:"):
|
#elif sleepBrightness.startswith("ha:"):
|
||||||
time.sleep(1)
|
# time.sleep(1)
|
||||||
dimmode = int(float(libs.home_assistant.get_template(sleepBrightness)[3:]))
|
# dimmode = int(float(libs.home_assistant.get_template(sleepBrightness)[3:]))
|
||||||
involved_entities.extend(libs.home_assistant.get_template_listener_entities(sleepBrightness))
|
# involved_entities.extend(libs.home_assistant.get_template_listener_entities(sleepBrightness))
|
||||||
elif libs.home_assistant.is_existent(sleepBrightness):
|
elif libs.home_assistant.is_existent(sleepBrightness):
|
||||||
involved_entities.append(sleepBrightness)
|
involved_entities.append(sleepBrightness)
|
||||||
dimmode = int(float(libs.home_assistant.get_entity_data(sleepBrightness).get('state', 10)))
|
try:
|
||||||
|
dimmode = int(float(libs.home_assistant.get_entity_data(sleepBrightness).get('state', 10)))
|
||||||
|
except (TypeError, ValueError):
|
||||||
|
logging.exception("sleepBrightness entity '%s' has an invalid state value", sleepBrightness)
|
||||||
|
|
||||||
if screenBrightness:
|
if screenBrightness:
|
||||||
if isinstance(screenBrightness, int):
|
if isinstance(screenBrightness, int):
|
||||||
dimValueNormal = screenBrightness
|
dimValueNormal = screenBrightness
|
||||||
elif isinstance(screenBrightness, list):
|
elif isinstance(screenBrightness, list):
|
||||||
logging.error("list style config for screenBrightness no longer supported")
|
logging.error("list style config for screenBrightness no longer supported")
|
||||||
elif screenBrightness.startswith("ha:"):
|
#elif screenBrightness.startswith("ha:"):
|
||||||
time.sleep(1)
|
# time.sleep(1)
|
||||||
dimValueNormal = int(float(libs.home_assistant.get_template(screenBrightness)[3:]))
|
# dimValueNormal = int(float(libs.home_assistant.get_template(screenBrightness)[3:]))
|
||||||
involved_entities.extend(libs.home_assistant.get_template_listener_entities(screenBrightness))
|
# involved_entities.extend(libs.home_assistant.get_template_listener_entities(screenBrightness))
|
||||||
elif libs.home_assistant.is_existent(screenBrightness):
|
elif libs.home_assistant.is_existent(screenBrightness):
|
||||||
involved_entities.append(screenBrightness)
|
involved_entities.append(screenBrightness)
|
||||||
dimValueNormal = int(float(libs.home_assistant.get_entity_data(screenBrightness).get('state', 100)))
|
try:
|
||||||
|
dimValueNormal = int(float(libs.home_assistant.get_entity_data(screenBrightness).get('state', 100)))
|
||||||
|
except (TypeError, ValueError):
|
||||||
|
logging.exception("screenBrightness entity '%s' has an invalid state value", screenBrightness)
|
||||||
# force sleep brightness to zero in case sleepTracking is active
|
# force sleep brightness to zero in case sleepTracking is active
|
||||||
if sleepTracking:
|
if sleepTracking:
|
||||||
if libs.home_assistant.is_existent(sleepTracking):
|
if libs.home_assistant.is_existent(sleepTracking):
|
||||||
@@ -64,12 +71,13 @@ def calculate_dim_values(sleepTracking, sleepTrackingZones, sleepBrightness, scr
|
|||||||
else:
|
else:
|
||||||
return dimmode, dimValueNormal
|
return dimmode, dimValueNormal
|
||||||
|
|
||||||
def handle_buttons(entity_id, btype, value, entity_config=None):
|
def handle_buttons(entity_id, btype, value, entity_config=None, action_context=None):
|
||||||
|
action_context = action_context or {}
|
||||||
match btype:
|
match btype:
|
||||||
case 'button':
|
case 'button':
|
||||||
button_press(entity_id, value)
|
button_press(entity_id, value, action_context=action_context)
|
||||||
case 'OnOff':
|
case 'OnOff':
|
||||||
on_off(entity_id, value)
|
on_off(entity_id, value, action_context=action_context)
|
||||||
case 'number-set':
|
case 'number-set':
|
||||||
if entity_id.startswith('fan'):
|
if entity_id.startswith('fan'):
|
||||||
attr = libs.home_assistant.get_entity_data(entity_id).get('attributes', [])
|
attr = libs.home_assistant.get_entity_data(entity_id).get('attributes', [])
|
||||||
@@ -77,7 +85,7 @@ def handle_buttons(entity_id, btype, value, entity_config=None):
|
|||||||
service_data = {
|
service_data = {
|
||||||
"value": int(value)
|
"value": int(value)
|
||||||
}
|
}
|
||||||
call_ha_service(entity_id, "set_value", service_data=service_data)
|
call_ha_service(entity_id, "set_value", service_data=service_data, action_context=action_context)
|
||||||
case 'up' | 'stop' | 'down' | 'tiltOpen' | 'tiltStop' | 'tiltClose' | 'media-next' | 'media-back' | 'media-pause' | 'timer-cancel' | 'timer-pause' | 'timer-finish':
|
case 'up' | 'stop' | 'down' | 'tiltOpen' | 'tiltStop' | 'tiltClose' | 'media-next' | 'media-back' | 'media-pause' | 'timer-cancel' | 'timer-pause' | 'timer-finish':
|
||||||
action_service_mapping = {
|
action_service_mapping = {
|
||||||
'up': 'open_cover',
|
'up': 'open_cover',
|
||||||
@@ -94,37 +102,37 @@ def handle_buttons(entity_id, btype, value, entity_config=None):
|
|||||||
'timer-finish': 'finish',
|
'timer-finish': 'finish',
|
||||||
}
|
}
|
||||||
service = action_service_mapping[btype]
|
service = action_service_mapping[btype]
|
||||||
call_ha_service(entity_id, service)
|
call_ha_service(entity_id, service, action_context=action_context)
|
||||||
case 'timer-start':
|
case 'timer-start':
|
||||||
if value:
|
if value:
|
||||||
service_data = {
|
service_data = {
|
||||||
"duration": value
|
"duration": value
|
||||||
}
|
}
|
||||||
call_ha_service(entity_id, "start", service_data=service_data)
|
call_ha_service(entity_id, "start", service_data=service_data, action_context=action_context)
|
||||||
else:
|
else:
|
||||||
call_ha_service(entity_id, "start")
|
call_ha_service(entity_id, "start", action_context=action_context)
|
||||||
case 'positionSlider':
|
case 'positionSlider':
|
||||||
service_data = {
|
service_data = {
|
||||||
"position": int(value)
|
"position": int(value)
|
||||||
}
|
}
|
||||||
call_ha_service(entity_id, "set_cover_position", service_data=service_data)
|
call_ha_service(entity_id, "set_cover_position", service_data=service_data, action_context=action_context)
|
||||||
case 'tiltSlider':
|
case 'tiltSlider':
|
||||||
service_data = {
|
service_data = {
|
||||||
"tilt_position": int(value)
|
"tilt_position": int(value)
|
||||||
}
|
}
|
||||||
call_ha_service(entity_id, "set_cover_tilt_position", service_data=service_data)
|
call_ha_service(entity_id, "set_cover_tilt_position", service_data=service_data, action_context=action_context)
|
||||||
case 'media-OnOff':
|
case 'media-OnOff':
|
||||||
state = libs.home_assistant.get_entity_data(entity_id).get('state', '')
|
state = libs.home_assistant.get_entity_data(entity_id).get('state', '')
|
||||||
if state == "off":
|
if state == "off":
|
||||||
call_ha_service(entity_id, "turn_on")
|
call_ha_service(entity_id, "turn_on", action_context=action_context)
|
||||||
else:
|
else:
|
||||||
call_ha_service(entity_id, "turn_off")
|
call_ha_service(entity_id, "turn_off", action_context=action_context)
|
||||||
case 'media-shuffle':
|
case 'media-shuffle':
|
||||||
suffle = libs.home_assistant.get_entity_data(entity_id).get('attributes', []).get('shuffle')
|
suffle = libs.home_assistant.get_entity_data(entity_id).get('attributes', []).get('shuffle')
|
||||||
service_data = {
|
service_data = {
|
||||||
"shuffle": not suffle
|
"shuffle": not suffle
|
||||||
}
|
}
|
||||||
call_ha_service(entity_id, "set_value", service_data=service_data)
|
call_ha_service(entity_id, "set_value", service_data=service_data, action_context=action_context)
|
||||||
case 'volumeSlider':
|
case 'volumeSlider':
|
||||||
pos = int(value)
|
pos = int(value)
|
||||||
# HA wants to have this value between 0 and 1 as float
|
# HA wants to have this value between 0 and 1 as float
|
||||||
@@ -132,12 +140,12 @@ def handle_buttons(entity_id, btype, value, entity_config=None):
|
|||||||
service_data = {
|
service_data = {
|
||||||
"volume_level": pos
|
"volume_level": pos
|
||||||
}
|
}
|
||||||
call_ha_service(entity_id, "volume_set", service_data=service_data)
|
call_ha_service(entity_id, "volume_set", service_data=service_data, action_context=action_context)
|
||||||
case 'speaker-sel':
|
case 'speaker-sel':
|
||||||
service_data = {
|
service_data = {
|
||||||
"volume_level": value
|
"volume_level": value
|
||||||
}
|
}
|
||||||
call_ha_service(entity_id, "select_source", service_data=service_data)
|
call_ha_service(entity_id, "select_source", service_data=service_data, action_context=action_context)
|
||||||
# for light detail page
|
# for light detail page
|
||||||
case 'brightnessSlider':
|
case 'brightnessSlider':
|
||||||
# scale 0-100 to ha brightness range
|
# scale 0-100 to ha brightness range
|
||||||
@@ -145,7 +153,7 @@ def handle_buttons(entity_id, btype, value, entity_config=None):
|
|||||||
service_data = {
|
service_data = {
|
||||||
"brightness": brightness
|
"brightness": brightness
|
||||||
}
|
}
|
||||||
call_ha_service(entity_id, "turn_on", service_data=service_data)
|
call_ha_service(entity_id, "turn_on", service_data=service_data, action_context=action_context)
|
||||||
case 'colorTempSlider':
|
case 'colorTempSlider':
|
||||||
attr = libs.home_assistant.get_entity_data(entity_id).get('attributes', [])
|
attr = libs.home_assistant.get_entity_data(entity_id).get('attributes', [])
|
||||||
min_mireds = attr.get("min_mireds")
|
min_mireds = attr.get("min_mireds")
|
||||||
@@ -155,19 +163,19 @@ def handle_buttons(entity_id, btype, value, entity_config=None):
|
|||||||
service_data = {
|
service_data = {
|
||||||
"color_temp": color_val
|
"color_temp": color_val
|
||||||
}
|
}
|
||||||
call_ha_service(entity_id, "turn_on", service_data=service_data)
|
call_ha_service(entity_id, "turn_on", service_data=service_data, action_context=action_context)
|
||||||
case 'colorWheel':
|
case 'colorWheel':
|
||||||
value = value.split('|')
|
value = value.split('|')
|
||||||
color = pos_to_color(int(value[0]), int(value[1]), int(value[2]))
|
color = pos_to_color(int(value[0]), int(value[1]), int(value[2]))
|
||||||
service_data = {
|
service_data = {
|
||||||
"rgb_color": color
|
"rgb_color": color
|
||||||
}
|
}
|
||||||
call_ha_service(entity_id, "turn_on", service_data=service_data)
|
call_ha_service(entity_id, "turn_on", service_data=service_data, action_context=action_context)
|
||||||
case 'disarm' | 'arm_home' | 'arm_away' | 'arm_night' | 'arm_vacation':
|
case 'disarm' | 'arm_home' | 'arm_away' | 'arm_night' | 'arm_vacation':
|
||||||
service_data = {
|
service_data = {
|
||||||
"code": value
|
"code": value
|
||||||
}
|
}
|
||||||
call_ha_service(entity_id, f"alarm_{btype}", service_data=service_data)
|
call_ha_service(entity_id, f"alarm_{btype}", service_data=service_data, action_context=action_context)
|
||||||
case 'mode-preset_modes' | 'mode-swing_modes' | 'mode-fan_modes':
|
case 'mode-preset_modes' | 'mode-swing_modes' | 'mode-fan_modes':
|
||||||
attr = libs.home_assistant.get_entity_data(entity_id).get('attributes', [])
|
attr = libs.home_assistant.get_entity_data(entity_id).get('attributes', [])
|
||||||
mapping = {
|
mapping = {
|
||||||
@@ -182,7 +190,7 @@ def handle_buttons(entity_id, btype, value, entity_config=None):
|
|||||||
service_data = {
|
service_data = {
|
||||||
mapping[btype][:-1]: mode
|
mapping[btype][:-1]: mode
|
||||||
}
|
}
|
||||||
call_ha_service(entity_id, f"set_{mapping[btype][:-1]}", service_data=service_data)
|
call_ha_service(entity_id, f"set_{mapping[btype][:-1]}", service_data=service_data, action_context=action_context)
|
||||||
case 'mode-input_select' | 'mode-select':
|
case 'mode-input_select' | 'mode-select':
|
||||||
options = libs.home_assistant.get_entity_data(entity_id).get('attributes', []).get("options", [])
|
options = libs.home_assistant.get_entity_data(entity_id).get('attributes', []).get("options", [])
|
||||||
if options:
|
if options:
|
||||||
@@ -190,7 +198,7 @@ def handle_buttons(entity_id, btype, value, entity_config=None):
|
|||||||
service_data = {
|
service_data = {
|
||||||
"option": option
|
"option": option
|
||||||
}
|
}
|
||||||
call_ha_service(entity_id, "select_option", service_data=service_data)
|
call_ha_service(entity_id, "select_option", service_data=service_data, action_context=action_context)
|
||||||
case 'mode-media_player':
|
case 'mode-media_player':
|
||||||
options = libs.home_assistant.get_entity_data(entity_id).get('attributes', []).get("source_list", [])
|
options = libs.home_assistant.get_entity_data(entity_id).get('attributes', []).get("source_list", [])
|
||||||
if options:
|
if options:
|
||||||
@@ -198,7 +206,7 @@ def handle_buttons(entity_id, btype, value, entity_config=None):
|
|||||||
service_data = {
|
service_data = {
|
||||||
"source": option
|
"source": option
|
||||||
}
|
}
|
||||||
call_ha_service(entity_id, "select_source", service_data=service_data)
|
call_ha_service(entity_id, "select_source", service_data=service_data, action_context=action_context)
|
||||||
case 'mode-light':
|
case 'mode-light':
|
||||||
options = entity_config.get("effectList", libs.home_assistant.get_entity_data(entity_id).get('attributes', []).get("effect_list", []))
|
options = entity_config.get("effectList", libs.home_assistant.get_entity_data(entity_id).get('attributes', []).get("effect_list", []))
|
||||||
if options:
|
if options:
|
||||||
@@ -206,13 +214,13 @@ def handle_buttons(entity_id, btype, value, entity_config=None):
|
|||||||
service_data = {
|
service_data = {
|
||||||
"effect": option
|
"effect": option
|
||||||
}
|
}
|
||||||
call_ha_service(entity_id, "turn_on", service_data=service_data)
|
call_ha_service(entity_id, "turn_on", service_data=service_data, action_context=action_context)
|
||||||
case 'tempUpd':
|
case 'tempUpd':
|
||||||
temp = int(value)/10
|
temp = int(value)/10
|
||||||
service_data = {
|
service_data = {
|
||||||
"temperature": temp
|
"temperature": temp
|
||||||
}
|
}
|
||||||
call_ha_service(entity_id, "set_temperature", service_data=service_data)
|
call_ha_service(entity_id, "set_temperature", service_data=service_data, action_context=action_context)
|
||||||
case 'tempUpdHighLow':
|
case 'tempUpdHighLow':
|
||||||
value = value.split("|")
|
value = value.split("|")
|
||||||
temp_high = int(value[0])/10
|
temp_high = int(value[0])/10
|
||||||
@@ -221,47 +229,67 @@ def handle_buttons(entity_id, btype, value, entity_config=None):
|
|||||||
"target_temp_high": temp_high,
|
"target_temp_high": temp_high,
|
||||||
"target_temp_low": temp_low,
|
"target_temp_low": temp_low,
|
||||||
}
|
}
|
||||||
call_ha_service(entity_id, "set_temperature", service_data=service_data)
|
call_ha_service(entity_id, "set_temperature", service_data=service_data, action_context=action_context)
|
||||||
case 'hvac_action':
|
case 'hvac_action':
|
||||||
service_data = {
|
service_data = {
|
||||||
"hvac_mode": value
|
"hvac_mode": value
|
||||||
}
|
}
|
||||||
call_ha_service(entity_id, "set_hvac_mode", service_data=service_data)
|
call_ha_service(entity_id, "set_hvac_mode", service_data=service_data, action_context=action_context)
|
||||||
case _:
|
case _:
|
||||||
logging.error("Not implemented: %s", btype)
|
logging.error("Not implemented: %s", btype)
|
||||||
|
|
||||||
def call_ha_service(entity_id, service, service_data = {}):
|
def call_ha_service(entity_id, service, service_data=None, action_context=None):
|
||||||
|
if service_data is None:
|
||||||
|
service_data = {}
|
||||||
|
action_context = action_context or {}
|
||||||
etype = entity_id.split(".")[0]
|
etype = entity_id.split(".")[0]
|
||||||
libs.home_assistant.call_service(
|
ok = libs.home_assistant.call_service(
|
||||||
entity_name=entity_id,
|
entity_name=entity_id,
|
||||||
domain=etype,
|
domain=etype,
|
||||||
service=service,
|
service=service,
|
||||||
service_data=service_data
|
service_data=service_data
|
||||||
)
|
)
|
||||||
|
if ok:
|
||||||
|
logging.info(
|
||||||
|
"Panel action forwarded to Home Assistant: panel='%s', action='%s', value='%s', entity='%s', service='%s', data=%s",
|
||||||
|
action_context.get("panel", "unknown"),
|
||||||
|
action_context.get("btype", "unknown"),
|
||||||
|
action_context.get("value"),
|
||||||
|
entity_id,
|
||||||
|
service,
|
||||||
|
service_data,
|
||||||
|
)
|
||||||
|
if not ok:
|
||||||
|
logging.error(
|
||||||
|
"Home Assistant service call failed: entity='%s', service='%s', data=%s",
|
||||||
|
entity_id,
|
||||||
|
service,
|
||||||
|
service_data,
|
||||||
|
)
|
||||||
|
|
||||||
def button_press(entity_id, value):
|
def button_press(entity_id, value, action_context=None):
|
||||||
etype = entity_id.split(".")[0]
|
etype = entity_id.split(".")[0]
|
||||||
match etype:
|
match etype:
|
||||||
case 'scene' | 'script':
|
case 'scene' | 'script':
|
||||||
call_ha_service(entity_id, "turn_on")
|
call_ha_service(entity_id, "turn_on", action_context=action_context)
|
||||||
case 'light' | 'switch' | 'input_boolean' | 'automation' | 'fan':
|
case 'light' | 'switch' | 'input_boolean' | 'automation' | 'fan':
|
||||||
call_ha_service(entity_id, "toggle")
|
call_ha_service(entity_id, "toggle", action_context=action_context)
|
||||||
case 'lock':
|
case 'lock':
|
||||||
state = libs.home_assistant.get_entity_data(entity_id).get('state', '')
|
state = libs.home_assistant.get_entity_data(entity_id).get('state', '')
|
||||||
if state == "locked":
|
if state == "locked":
|
||||||
call_ha_service(entity_id, "unlock")
|
call_ha_service(entity_id, "unlock", action_context=action_context)
|
||||||
else:
|
else:
|
||||||
call_ha_service(entity_id, "lock")
|
call_ha_service(entity_id, "lock", action_context=action_context)
|
||||||
case 'button' | 'input_button':
|
case 'button' | 'input_button':
|
||||||
call_ha_service(entity_id, "press")
|
call_ha_service(entity_id, "press", action_context=action_context)
|
||||||
case 'input_select' | 'select':
|
case 'input_select' | 'select':
|
||||||
call_ha_service(entity_id, "select_next")
|
call_ha_service(entity_id, "select_next", action_context=action_context)
|
||||||
case 'vacuum':
|
case 'vacuum':
|
||||||
state = libs.home_assistant.get_entity_data(entity_id).get('state', '')
|
state = libs.home_assistant.get_entity_data(entity_id).get('state', '')
|
||||||
if state == "docked":
|
if state == "docked":
|
||||||
call_ha_service(entity_id, "start")
|
call_ha_service(entity_id, "start", action_context=action_context)
|
||||||
else:
|
else:
|
||||||
call_ha_service(entity_id, "return_to_base")
|
call_ha_service(entity_id, "return_to_base", action_context=action_context)
|
||||||
case _:
|
case _:
|
||||||
logging.error("buttonpress for entity type %s not implemented", etype)
|
logging.error("buttonpress for entity type %s not implemented", etype)
|
||||||
|
|
||||||
@@ -269,14 +297,14 @@ def button_press(entity_id, value):
|
|||||||
# apis.ha_api.call_service(entity_id.replace(
|
# apis.ha_api.call_service(entity_id.replace(
|
||||||
# 'service.', '', 1).replace('.', '/', 1), **entity_config.data)
|
# 'service.', '', 1).replace('.', '/', 1), **entity_config.data)
|
||||||
|
|
||||||
def on_off(entity_id, value):
|
def on_off(entity_id, value, action_context=None):
|
||||||
etype = entity_id.split(".")[0]
|
etype = entity_id.split(".")[0]
|
||||||
match etype:
|
match etype:
|
||||||
case 'light' | 'switch' | 'input_boolean' | 'automation' | 'fan':
|
case 'light' | 'switch' | 'input_boolean' | 'automation' | 'fan':
|
||||||
service = "turn_off"
|
service = "turn_off"
|
||||||
if value == "1":
|
if value == "1":
|
||||||
service = "turn_on"
|
service = "turn_on"
|
||||||
call_ha_service(entity_id, service)
|
call_ha_service(entity_id, service, action_context=action_context)
|
||||||
case _:
|
case _:
|
||||||
logging.error(
|
logging.error(
|
||||||
"Control action on_off not implemented for %s", entity_id)
|
"Control action on_off not implemented for %s", entity_id)
|
||||||
|
|||||||
@@ -14,8 +14,9 @@ next_id = 0
|
|||||||
request_all_states_id = 0
|
request_all_states_id = 0
|
||||||
ws_connected = False
|
ws_connected = False
|
||||||
home_assistant_entity_state_cache = {}
|
home_assistant_entity_state_cache = {}
|
||||||
template_cache = {}
|
template_cache = {}
|
||||||
response_buffer = {}
|
response_buffer = {}
|
||||||
|
nspanel_event_handler = None
|
||||||
|
|
||||||
|
|
||||||
ON_CONNECT_HANDLER = None
|
ON_CONNECT_HANDLER = None
|
||||||
@@ -44,47 +45,64 @@ def register_on_disconnect_handler(handler):
|
|||||||
ON_DISCONNECT_HANDLER = handler
|
ON_DISCONNECT_HANDLER = handler
|
||||||
|
|
||||||
|
|
||||||
def on_message(ws, message):
|
def on_message(ws, message):
|
||||||
global auth_ok, request_all_states_id, home_assistant_entity_state_cache, response_buffer, template_cache
|
global auth_ok, request_all_states_id, home_assistant_entity_state_cache, response_buffer, template_cache
|
||||||
json_msg = json.loads(message)
|
try:
|
||||||
if json_msg["type"] == "auth_required":
|
json_msg = json.loads(message)
|
||||||
authenticate_client()
|
except json.JSONDecodeError:
|
||||||
elif json_msg["type"] == "auth_ok":
|
logging.exception("Failed to parse Home Assistant websocket message as JSON")
|
||||||
auth_ok = True
|
return
|
||||||
logging.info("Home Assistant auth OK. Requesting existing states.")
|
|
||||||
subscribe_to_events()
|
message_type = json_msg.get("type")
|
||||||
_get_all_states()
|
if message_type == "auth_required":
|
||||||
if ON_CONNECT_HANDLER is not None:
|
authenticate_client()
|
||||||
ON_CONNECT_HANDLER()
|
elif message_type == "auth_ok":
|
||||||
# for templates
|
auth_ok = True
|
||||||
elif json_msg["type"] == "event" and json_msg["id"] in response_buffer:
|
logging.info("Home Assistant auth OK. Requesting existing states.")
|
||||||
template_cache[response_buffer[json_msg["id"]]] = {
|
subscribe_to_events()
|
||||||
"result": json_msg["event"]["result"],
|
_get_all_states()
|
||||||
"listener-entities": json_msg["event"]["listeners"]["entities"]
|
if ON_CONNECT_HANDLER is not None:
|
||||||
}
|
ON_CONNECT_HANDLER()
|
||||||
elif json_msg["type"] == "event" and json_msg["event"]["event_type"] == "state_changed":
|
# for templates
|
||||||
entity_id = json_msg["event"]["data"]["entity_id"]
|
elif message_type == "event" and json_msg.get("id") in response_buffer:
|
||||||
home_assistant_entity_state_cache[entity_id] = json_msg["event"]["data"]["new_state"]
|
event = json_msg.get("event", {})
|
||||||
send_entity_update(entity_id)
|
listeners = event.get("listeners", {})
|
||||||
# rerender template
|
template_cache[response_buffer[json_msg["id"]]] = {
|
||||||
for template, template_cache_entry in template_cache.items():
|
"result": event.get("result"),
|
||||||
if entity_id in template_cache_entry.get("listener-entities", []):
|
"listener-entities": listeners.get("entities", [])
|
||||||
cache_template(template)
|
}
|
||||||
elif json_msg["type"] == "event" and json_msg["event"]["event_type"] == "esphome.nspanel.data":
|
elif message_type == "event" and json_msg.get("event", {}).get("event_type") == "state_changed":
|
||||||
nspanel_data_callback(json_msg["event"]["data"]["device_id"], json_msg["event"]["data"]["CustomRecv"])
|
event_data = json_msg.get("event", {}).get("data", {})
|
||||||
elif json_msg["type"] == "result" and not json_msg["success"]:
|
entity_id = event_data.get("entity_id")
|
||||||
logging.error("Failed result: ")
|
if not entity_id:
|
||||||
logging.error(json_msg)
|
logging.debug("Received state_changed event without entity_id")
|
||||||
elif json_msg["type"] == "result" and json_msg["success"]:
|
return
|
||||||
if json_msg["id"] == request_all_states_id:
|
home_assistant_entity_state_cache[entity_id] = event_data.get("new_state")
|
||||||
for entity in json_msg["result"]:
|
send_entity_update(entity_id)
|
||||||
home_assistant_entity_state_cache[entity["entity_id"]] = entity
|
# rerender template
|
||||||
else:
|
for template, template_cache_entry in template_cache.items():
|
||||||
if json_msg["id"] in response_buffer and json_msg.get("result"):
|
if entity_id in template_cache_entry.get("listener-entities", []):
|
||||||
response_buffer[json_msg["id"]] = json_msg["result"]
|
cache_template(template)
|
||||||
return None # Ignore success result messages
|
elif message_type == "event" and json_msg.get("event", {}).get("event_type") == "esphome.nspanel.data":
|
||||||
else:
|
event_data = json_msg.get("event", {}).get("data", {})
|
||||||
logging.debug(message)
|
device_id = event_data.get("device_id")
|
||||||
|
custom_recv = event_data.get("CustomRecv")
|
||||||
|
if nspanel_event_handler is None:
|
||||||
|
logging.debug("No NsPanel event handler registered; dropping event for device '%s'", device_id)
|
||||||
|
return
|
||||||
|
nspanel_event_handler(device_id, custom_recv)
|
||||||
|
elif message_type == "result" and not json_msg.get("success"):
|
||||||
|
logging.error("Home Assistant request failed: %s", json_msg)
|
||||||
|
elif message_type == "result" and json_msg.get("success"):
|
||||||
|
if json_msg.get("id") == request_all_states_id:
|
||||||
|
for entity in json_msg.get("result", []):
|
||||||
|
home_assistant_entity_state_cache[entity["entity_id"]] = entity
|
||||||
|
else:
|
||||||
|
if json_msg.get("id") in response_buffer and json_msg.get("result"):
|
||||||
|
response_buffer[json_msg["id"]] = json_msg["result"]
|
||||||
|
return None # Ignore success result messages
|
||||||
|
else:
|
||||||
|
logging.debug(message)
|
||||||
|
|
||||||
|
|
||||||
def _ws_connection_open(ws):
|
def _ws_connection_open(ws):
|
||||||
@@ -95,20 +113,24 @@ def _ws_connection_open(ws):
|
|||||||
ON_CONNECT_HANDLER()
|
ON_CONNECT_HANDLER()
|
||||||
|
|
||||||
|
|
||||||
def _ws_connection_close(ws, close_status_code, close_msg):
|
def _ws_connection_close(ws, close_status_code, close_msg):
|
||||||
global ws_connected
|
global ws_connected
|
||||||
ws_connected = False
|
ws_connected = False
|
||||||
logging.error("WebSocket connection closed!")
|
logging.error(
|
||||||
if ON_DISCONNECT_HANDLER is not None:
|
"WebSocket connection closed (status=%s, message=%s)",
|
||||||
ON_DISCONNECT_HANDLER()
|
close_status_code,
|
||||||
|
close_msg,
|
||||||
|
)
|
||||||
|
if ON_DISCONNECT_HANDLER is not None:
|
||||||
|
ON_DISCONNECT_HANDLER()
|
||||||
|
|
||||||
|
|
||||||
def connect():
|
def connect():
|
||||||
Thread(target=_do_connection, daemon=True).start()
|
Thread(target=_do_connection, daemon=True).start()
|
||||||
|
|
||||||
|
|
||||||
def _do_connection():
|
def _do_connection():
|
||||||
global home_assistant_url, ws, settings
|
global home_assistant_url, ws, settings
|
||||||
ws_url = home_assistant_url.replace(
|
ws_url = home_assistant_url.replace(
|
||||||
"https://", "wss://").replace("http://", "ws://")
|
"https://", "wss://").replace("http://", "ws://")
|
||||||
if settings["is_addon"]:
|
if settings["is_addon"]:
|
||||||
@@ -117,12 +139,15 @@ def _do_connection():
|
|||||||
ws_url += "/api/websocket"
|
ws_url += "/api/websocket"
|
||||||
ws = websocket.WebSocketApp(F"{ws_url}", on_message=on_message,
|
ws = websocket.WebSocketApp(F"{ws_url}", on_message=on_message,
|
||||||
on_open=_ws_connection_open, on_close=_ws_connection_close)
|
on_open=_ws_connection_open, on_close=_ws_connection_close)
|
||||||
while True:
|
while True:
|
||||||
logging.info(F"Connecting to Home Assistant at {ws_url}")
|
logging.info(F"Connecting to Home Assistant at {ws_url}")
|
||||||
ws.close()
|
try:
|
||||||
time.sleep(1)
|
ws.close()
|
||||||
ws.run_forever(sslopt={"cert_reqs": ssl.CERT_NONE})
|
time.sleep(1)
|
||||||
time.sleep(10)
|
ws.run_forever(sslopt={"cert_reqs": ssl.CERT_NONE})
|
||||||
|
except Exception:
|
||||||
|
logging.exception("WebSocket connection loop failed")
|
||||||
|
time.sleep(10)
|
||||||
|
|
||||||
|
|
||||||
def authenticate_client():
|
def authenticate_client():
|
||||||
@@ -144,9 +169,9 @@ def subscribe_to_events():
|
|||||||
}
|
}
|
||||||
send_message(json.dumps(msg))
|
send_message(json.dumps(msg))
|
||||||
|
|
||||||
def subscribe_to_nspanel_events(nsp_callback):
|
def subscribe_to_nspanel_events(nsp_callback):
|
||||||
global next_id, nspanel_data_callback
|
global next_id, nspanel_event_handler
|
||||||
nspanel_data_callback = nsp_callback
|
nspanel_event_handler = nsp_callback
|
||||||
msg = {
|
msg = {
|
||||||
"id": next_id,
|
"id": next_id,
|
||||||
"type": "subscribe_events",
|
"type": "subscribe_events",
|
||||||
@@ -168,11 +193,13 @@ def send_entity_update(entity_id):
|
|||||||
global on_ha_update
|
global on_ha_update
|
||||||
on_ha_update(entity_id)
|
on_ha_update(entity_id)
|
||||||
|
|
||||||
def nspanel_data_callback(device_id, msg):
|
def nspanel_data_callback(device_id, msg):
|
||||||
global nspanel_data_callback
|
if nspanel_event_handler is None:
|
||||||
nspanel_data_callback(device_id, msg)
|
logging.debug("NsPanel callback invoked before handler was registered")
|
||||||
|
return
|
||||||
|
nspanel_event_handler(device_id, msg)
|
||||||
|
|
||||||
def call_service(entity_name: str, domain: str, service: str, service_data: dict) -> bool:
|
def call_service(entity_name: str, domain: str, service: str, service_data: dict) -> bool:
|
||||||
global next_id
|
global next_id
|
||||||
try:
|
try:
|
||||||
msg = {
|
msg = {
|
||||||
@@ -187,9 +214,12 @@ def call_service(entity_name: str, domain: str, service: str, service_data: dict
|
|||||||
}
|
}
|
||||||
send_message(json.dumps(msg))
|
send_message(json.dumps(msg))
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception:
|
||||||
logging.exception("Failed to call Home Assisatant service.")
|
logging.exception(
|
||||||
return False
|
"Failed to call Home Assistant service: %s.%s for %s",
|
||||||
|
domain, service, entity_name
|
||||||
|
)
|
||||||
|
return False
|
||||||
|
|
||||||
def send_msg_to_panel(service: str, service_data: dict) -> bool:
|
def send_msg_to_panel(service: str, service_data: dict) -> bool:
|
||||||
global next_id
|
global next_id
|
||||||
@@ -203,9 +233,9 @@ def send_msg_to_panel(service: str, service_data: dict) -> bool:
|
|||||||
}
|
}
|
||||||
send_message(json.dumps(msg))
|
send_message(json.dumps(msg))
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception:
|
||||||
logging.exception("Failed to call Home Assisatant service.")
|
logging.exception("Failed to call Home Assistant panel service: %s", service)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def execute_script(entity_name: str, domain: str, service: str, service_data: dict) -> str:
|
def execute_script(entity_name: str, domain: str, service: str, service_data: dict) -> str:
|
||||||
global next_id, response_buffer
|
global next_id, response_buffer
|
||||||
@@ -241,13 +271,13 @@ def execute_script(entity_name: str, domain: str, service: str, service_data: di
|
|||||||
else:
|
else:
|
||||||
return response_buffer[call_id]["response"]
|
return response_buffer[call_id]["response"]
|
||||||
raise TimeoutError("Did not recive respose in time to HA script call")
|
raise TimeoutError("Did not recive respose in time to HA script call")
|
||||||
except Exception as e:
|
except Exception:
|
||||||
logging.exception("Failed to call Home Assisatant script.")
|
logging.exception("Failed to call Home Assistant script: %s.%s", domain, service)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def cache_template(template):
|
def cache_template(template):
|
||||||
if not template:
|
if not template:
|
||||||
raise Exception("Invalid template")
|
raise ValueError("Invalid template")
|
||||||
global next_id, response_buffer
|
global next_id, response_buffer
|
||||||
try:
|
try:
|
||||||
call_id = next_id
|
call_id = next_id
|
||||||
@@ -259,9 +289,9 @@ def cache_template(template):
|
|||||||
}
|
}
|
||||||
send_message(json.dumps(msg))
|
send_message(json.dumps(msg))
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception:
|
||||||
logging.exception("Failed to render template.")
|
logging.exception("Failed to render template.")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def get_template(template):
|
def get_template(template):
|
||||||
global template_cache
|
global template_cache
|
||||||
@@ -299,7 +329,12 @@ def is_existent(entity_id: str):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def send_message(message):
|
def send_message(message):
|
||||||
global ws, next_id
|
global ws, next_id
|
||||||
next_id += 1
|
try:
|
||||||
ws.send(message)
|
next_id += 1
|
||||||
|
ws.send(message)
|
||||||
|
except NameError:
|
||||||
|
logging.error("WebSocket client is not initialized; dropping outgoing message")
|
||||||
|
except Exception:
|
||||||
|
logging.exception("Failed sending websocket message to Home Assistant")
|
||||||
|
|||||||
@@ -25,53 +25,76 @@ last_settings_file_mtime = 0
|
|||||||
mqtt_connect_time = 0
|
mqtt_connect_time = 0
|
||||||
has_sent_reload_command = False
|
has_sent_reload_command = False
|
||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
log_level_name = os.getenv("LOGLEVEL", "DEBUG").upper()
|
||||||
|
log_level = getattr(logging, log_level_name, None)
|
||||||
|
invalid_log_level = not isinstance(log_level, int)
|
||||||
|
if invalid_log_level:
|
||||||
|
log_level = logging.DEBUG
|
||||||
|
|
||||||
|
logging.basicConfig(
|
||||||
|
level=log_level,
|
||||||
|
format="%(asctime)s %(levelname)s [%(threadName)s] %(name)s: %(message)s",
|
||||||
|
)
|
||||||
|
if invalid_log_level:
|
||||||
|
logging.warning("Invalid loglevel '%s', defaulting to DEBUG", log_level_name)
|
||||||
|
|
||||||
def on_ha_update(entity_id):
|
def on_ha_update(entity_id):
|
||||||
global panel_in_queues
|
global panel_in_queues
|
||||||
# send HA updates to all panels
|
# send HA updates to all panels
|
||||||
for queue in panel_in_queues.values():
|
for queue in panel_in_queues.values():
|
||||||
queue.put(("HA:", entity_id))
|
try:
|
||||||
|
queue.put(("HA:", entity_id))
|
||||||
|
except Exception:
|
||||||
|
logging.exception("Failed to enqueue HA update for entity '%s'", entity_id)
|
||||||
|
|
||||||
def on_ha_panel_event(device_id, msg):
|
def on_ha_panel_event(device_id, msg):
|
||||||
global panel_in_queues
|
global panel_in_queues
|
||||||
|
|
||||||
if device_id in panel_in_queues.keys():
|
if device_id in panel_in_queues.keys():
|
||||||
queue = panel_in_queues[device_id]
|
queue = panel_in_queues[device_id]
|
||||||
queue.put(("MQTT:", msg))
|
try:
|
||||||
|
queue.put(("MQTT:", msg))
|
||||||
|
except Exception:
|
||||||
|
logging.exception("Failed to enqueue panel event for device '%s'", device_id)
|
||||||
|
|
||||||
def process_output_to_panel():
|
def process_output_to_panel():
|
||||||
while True:
|
while True:
|
||||||
msg = panel_out_queue.get()
|
try:
|
||||||
|
msg = panel_out_queue.get()
|
||||||
#client.publish(msg[0], msg[1])
|
service = msg[0] + "_nspanelui_api_call"
|
||||||
#apis.ha_api.call_service(service="esphome/" + self._api_panel_name + "_nspanelui_api_call", command=2, data=msg)
|
service_data = {
|
||||||
service = msg[0] + "_nspanelui_api_call"
|
"data": msg[1],
|
||||||
service_data = {
|
"command": 2
|
||||||
"data": msg[1],
|
|
||||||
"command":2
|
|
||||||
}
|
}
|
||||||
libs.home_assistant.send_msg_to_panel(
|
libs.home_assistant.send_msg_to_panel(
|
||||||
service = service,
|
service=service,
|
||||||
service_data = service_data
|
service_data=service_data
|
||||||
)
|
)
|
||||||
|
except Exception:
|
||||||
|
logging.exception("Failed to process outgoing panel message")
|
||||||
|
|
||||||
|
|
||||||
def connect():
|
def connect():
|
||||||
global settings, panel_out_queue
|
global settings, panel_out_queue
|
||||||
|
ha_is_configured = settings["home_assistant_address"] != "" and settings["home_assistant_token"] != ""
|
||||||
if "mqtt_server" in settings and not "use_ha_api" in settings:
|
if "mqtt_server" in settings and not "use_ha_api" in settings:
|
||||||
MqttManager(settings, panel_out_queue, panel_in_queues)
|
MqttManager(settings, panel_out_queue, panel_in_queues)
|
||||||
else:
|
else:
|
||||||
logging.info("MQTT values not configured, will not connect.")
|
logging.info("MQTT values not configured, will not connect.")
|
||||||
|
|
||||||
# MQTT Connected, start APIs if configured
|
# MQTT Connected, start APIs if configured
|
||||||
if settings["home_assistant_address"] != "" and settings["home_assistant_token"] != "":
|
if ha_is_configured:
|
||||||
libs.home_assistant.init(settings, on_ha_update)
|
libs.home_assistant.init(settings, on_ha_update)
|
||||||
libs.home_assistant.connect()
|
libs.home_assistant.connect()
|
||||||
else:
|
else:
|
||||||
logging.info("Home Assistant values not configured, will not connect.")
|
logging.info("Home Assistant values not configured, will not connect.")
|
||||||
|
return
|
||||||
|
|
||||||
|
wait_seconds = 0
|
||||||
while not libs.home_assistant.ws_connected:
|
while not libs.home_assistant.ws_connected:
|
||||||
|
wait_seconds += 1
|
||||||
|
if wait_seconds % 10 == 0:
|
||||||
|
logging.info("Waiting for Home Assistant websocket connection... (%ss)", wait_seconds)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
if settings.get("use_ha_api"):
|
if settings.get("use_ha_api"):
|
||||||
libs.home_assistant.subscribe_to_nspanel_events(on_ha_panel_event)
|
libs.home_assistant.subscribe_to_nspanel_events(on_ha_panel_event)
|
||||||
@@ -97,13 +120,20 @@ def setup_panels():
|
|||||||
panel_thread.start()
|
panel_thread.start()
|
||||||
|
|
||||||
def panel_thread_target(queue_in, name, settings_panel, queue_out):
|
def panel_thread_target(queue_in, name, settings_panel, queue_out):
|
||||||
panel = LovelaceUIPanel(name, settings_panel, queue_out)
|
try:
|
||||||
|
panel = LovelaceUIPanel(name, settings_panel, queue_out)
|
||||||
|
except Exception:
|
||||||
|
logging.exception("Failed to initialize panel thread for '%s'", name)
|
||||||
|
return
|
||||||
while True:
|
while True:
|
||||||
msg = queue_in.get()
|
try:
|
||||||
if msg[0] == "MQTT:":
|
msg = queue_in.get()
|
||||||
panel.customrecv_event_callback(msg[1])
|
if msg[0] == "MQTT:":
|
||||||
elif msg[0] == "HA:":
|
panel.customrecv_event_callback(msg[1])
|
||||||
panel.ha_event_callback(msg[1])
|
elif msg[0] == "HA:":
|
||||||
|
panel.ha_event_callback(msg[1])
|
||||||
|
except Exception:
|
||||||
|
logging.exception("Panel thread '%s' failed while handling queue message", name)
|
||||||
|
|
||||||
def get_config_file():
|
def get_config_file():
|
||||||
CONFIG_FILE = os.getenv('CONFIG_FILE')
|
CONFIG_FILE = os.getenv('CONFIG_FILE')
|
||||||
@@ -117,18 +147,27 @@ def get_config(file):
|
|||||||
try:
|
try:
|
||||||
with open(file, 'r', encoding="utf8") as file:
|
with open(file, 'r', encoding="utf8") as file:
|
||||||
settings = yaml.safe_load(file)
|
settings = yaml.safe_load(file)
|
||||||
|
except FileNotFoundError:
|
||||||
|
logging.error("Config file not found: %s", file)
|
||||||
|
return False
|
||||||
|
except OSError:
|
||||||
|
logging.exception("Failed reading config file: %s", file)
|
||||||
|
return False
|
||||||
except yaml.YAMLError as exc:
|
except yaml.YAMLError as exc:
|
||||||
print ("Error while parsing YAML file:")
|
logging.error("Error while parsing YAML file: %s", file)
|
||||||
if hasattr(exc, 'problem_mark'):
|
if hasattr(exc, 'problem_mark'):
|
||||||
if exc.context != None:
|
if exc.context != None:
|
||||||
print (' parser says\n' + str(exc.problem_mark) + '\n ' +
|
logging.error(
|
||||||
str(exc.problem) + ' ' + str(exc.context) +
|
"Parser says\n%s\n%s %s\nPlease correct data and retry.",
|
||||||
'\nPlease correct data and retry.')
|
str(exc.problem_mark), str(exc.problem), str(exc.context)
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
print (' parser says\n' + str(exc.problem_mark) + '\n ' +
|
logging.error(
|
||||||
str(exc.problem) + '\nPlease correct data and retry.')
|
"Parser says\n%s\n%s\nPlease correct data and retry.",
|
||||||
|
str(exc.problem_mark), str(exc.problem)
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
print ("Something went wrong while parsing yaml file")
|
logging.exception("Something went wrong while parsing yaml file")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if not settings.get("mqtt_username"):
|
if not settings.get("mqtt_username"):
|
||||||
@@ -172,10 +211,14 @@ def config_watch():
|
|||||||
project_files.append(get_config_file())
|
project_files.append(get_config_file())
|
||||||
handler = ConfigChangeEventHandler(project_files)
|
handler = ConfigChangeEventHandler(project_files)
|
||||||
observer = Observer()
|
observer = Observer()
|
||||||
observer.schedule(handler, path=os.path.dirname(get_config_file()), recursive=True)
|
watch_path = os.path.dirname(get_config_file()) or "."
|
||||||
|
observer.schedule(handler, path=watch_path, recursive=True)
|
||||||
observer.start()
|
observer.start()
|
||||||
while True:
|
while True:
|
||||||
time.sleep(1)
|
try:
|
||||||
|
time.sleep(1)
|
||||||
|
except Exception:
|
||||||
|
logging.exception("Config watch loop failed")
|
||||||
|
|
||||||
def signal_handler(signum, frame):
|
def signal_handler(signum, frame):
|
||||||
logging.info(f"Received signal {signum}. Initiating restart...")
|
logging.info(f"Received signal {signum}. Initiating restart...")
|
||||||
@@ -194,4 +237,5 @@ if __name__ == '__main__':
|
|||||||
time.sleep(100)
|
time.sleep(100)
|
||||||
else:
|
else:
|
||||||
while True:
|
while True:
|
||||||
time.sleep(100)
|
|
||||||
|
time.sleep(100)
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ class MqttManager:
|
|||||||
self.client.username_pw_set(
|
self.client.username_pw_set(
|
||||||
settings["mqtt_username"], settings["mqtt_password"])
|
settings["mqtt_username"], settings["mqtt_password"])
|
||||||
# Wait for connection
|
# Wait for connection
|
||||||
connection_return_code = 0
|
|
||||||
mqtt_server = settings["mqtt_server"]
|
mqtt_server = settings["mqtt_server"]
|
||||||
mqtt_port = int(settings["mqtt_port"])
|
mqtt_port = int(settings["mqtt_port"])
|
||||||
logging.info("Connecting to %s:%i as %s",
|
logging.info("Connecting to %s:%i as %s",
|
||||||
@@ -28,9 +27,12 @@ class MqttManager:
|
|||||||
try:
|
try:
|
||||||
self.client.connect(mqtt_server, mqtt_port, 5)
|
self.client.connect(mqtt_server, mqtt_port, 5)
|
||||||
break # Connection call did not raise exception, connection is sucessfull
|
break # Connection call did not raise exception, connection is sucessfull
|
||||||
except: # pylint: disable=bare-except
|
except Exception: # pylint: disable=broad-exception-caught
|
||||||
logging.exception(
|
logging.exception(
|
||||||
"Failed to connect to MQTT %s:%i. Will try again in 10 seconds. Code: %s", mqtt_server, mqtt_port, connection_return_code)
|
"Failed to connect to MQTT %s:%i. Will try again in 10 seconds.",
|
||||||
|
mqtt_server,
|
||||||
|
mqtt_port,
|
||||||
|
)
|
||||||
time.sleep(10.)
|
time.sleep(10.)
|
||||||
self.client.loop_start()
|
self.client.loop_start()
|
||||||
process_thread = threading.Thread(target=self.process_in_queue, args=(self.client, self.msg_in_queue))
|
process_thread = threading.Thread(target=self.process_in_queue, args=(self.client, self.msg_in_queue))
|
||||||
@@ -38,31 +40,52 @@ class MqttManager:
|
|||||||
process_thread.start()
|
process_thread.start()
|
||||||
|
|
||||||
def on_mqtt_connect(self, client, userdata, flags, rc):
|
def on_mqtt_connect(self, client, userdata, flags, rc):
|
||||||
|
if rc != 0:
|
||||||
|
logging.error("MQTT connection failed with return code: %s", rc)
|
||||||
|
return
|
||||||
logging.info("Connected to MQTT Server")
|
logging.info("Connected to MQTT Server")
|
||||||
# subscribe to panelRecvTopic of each panel
|
# subscribe to panelRecvTopic of each panel
|
||||||
for settings_panel in self.settings["nspanels"].values():
|
for settings_panel in self.settings["nspanels"].values():
|
||||||
client.subscribe(settings_panel["panelRecvTopic"])
|
topic = settings_panel["panelRecvTopic"]
|
||||||
|
result, _ = client.subscribe(topic)
|
||||||
|
if result == mqtt.MQTT_ERR_SUCCESS:
|
||||||
|
logging.debug("Subscribed to panel topic: %s", topic)
|
||||||
|
else:
|
||||||
|
logging.error("Failed to subscribe to panel topic '%s' (result=%s)", topic, result)
|
||||||
|
|
||||||
def on_mqtt_message(self, client, userdata, msg):
|
def on_mqtt_message(self, client, userdata, msg):
|
||||||
try:
|
try:
|
||||||
if msg.payload.decode() == "":
|
payload_text = msg.payload.decode('utf-8')
|
||||||
|
if payload_text == "":
|
||||||
|
logging.debug("Ignoring empty MQTT payload on topic: %s", msg.topic)
|
||||||
return
|
return
|
||||||
if msg.topic in self.msg_out_queue_list.keys():
|
if msg.topic in self.msg_out_queue_list.keys():
|
||||||
data = json.loads(msg.payload.decode('utf-8'))
|
data = json.loads(payload_text)
|
||||||
if "CustomRecv" in data:
|
if "CustomRecv" in data:
|
||||||
queue = self.msg_out_queue_list[msg.topic]
|
queue = self.msg_out_queue_list[msg.topic]
|
||||||
queue.put(("MQTT:", data["CustomRecv"]))
|
queue.put(("MQTT:", data["CustomRecv"]))
|
||||||
|
else:
|
||||||
|
logging.debug("JSON payload on topic '%s' has no 'CustomRecv' key", msg.topic)
|
||||||
else:
|
else:
|
||||||
logging.debug("Received unhandled message on topic: %s", msg.topic)
|
logging.debug("Received unhandled message on topic: %s", msg.topic)
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
logging.exception("Failed to decode MQTT payload as UTF-8 on topic: %s", msg.topic)
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
logging.exception("Failed to parse MQTT JSON payload on topic: %s", msg.topic)
|
||||||
except Exception: # pylint: disable=broad-exception-caught
|
except Exception: # pylint: disable=broad-exception-caught
|
||||||
logging.exception("Something went wrong during processing of message:")
|
logging.exception("Unexpected error while processing MQTT message on topic: %s", msg.topic)
|
||||||
try:
|
try:
|
||||||
logging.error(msg.payload.decode('utf-8'))
|
logging.error(msg.payload.decode('utf-8'))
|
||||||
except: # pylint: disable=bare-except
|
except Exception: # pylint: disable=broad-exception-caught
|
||||||
logging.error(
|
logging.error(
|
||||||
"Something went wrong when processing the exception message, couldn't decode payload to utf-8.")
|
"Something went wrong when processing the exception message, couldn't decode payload to utf-8.")
|
||||||
|
|
||||||
def process_in_queue(self, client, msg_in_queue):
|
def process_in_queue(self, client, msg_in_queue):
|
||||||
while True:
|
while True:
|
||||||
msg = msg_in_queue.get()
|
try:
|
||||||
client.publish(msg[0], msg[1])
|
msg = msg_in_queue.get()
|
||||||
|
result = client.publish(msg[0], msg[1])
|
||||||
|
if result.rc != mqtt.MQTT_ERR_SUCCESS:
|
||||||
|
logging.error("Failed publishing message to topic '%s' (rc=%s)", msg[0], result.rc)
|
||||||
|
except Exception: # pylint: disable=broad-exception-caught
|
||||||
|
logging.exception("Failed processing outgoing MQTT queue message")
|
||||||
|
|||||||
@@ -103,10 +103,13 @@ class LovelaceUIPanel:
|
|||||||
libs.panel_cmd.page_type(self.msg_out_queue, self.sendTopic, "pageStartup")
|
libs.panel_cmd.page_type(self.msg_out_queue, self.sendTopic, "pageStartup")
|
||||||
|
|
||||||
|
|
||||||
def schedule_thread_target(self):
|
def schedule_thread_target(self):
|
||||||
while True:
|
while True:
|
||||||
self.schedule.exec_jobs()
|
try:
|
||||||
time.sleep(1)
|
self.schedule.exec_jobs()
|
||||||
|
except Exception:
|
||||||
|
logging.exception("Scheduler execution failed for panel '%s'", self.name)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
def update_time(self):
|
def update_time(self):
|
||||||
use_timezone = tz.gettz(self.settings["timeZone"])
|
use_timezone = tz.gettz(self.settings["timeZone"])
|
||||||
@@ -200,12 +203,15 @@ class LovelaceUIPanel:
|
|||||||
return card
|
return card
|
||||||
return list(self.cards.values())[0]
|
return list(self.cards.values())[0]
|
||||||
|
|
||||||
def customrecv_event_callback(self, msg):
|
def customrecv_event_callback(self, msg):
|
||||||
logging.debug("Recv Message from NsPanel (%s): %s", self.name, msg)
|
logging.debug("Recv Message from NsPanel (%s): %s", self.name, msg)
|
||||||
msg = msg.split(",")
|
msg = msg.split(",")
|
||||||
# run action based on received command
|
if len(msg) < 2:
|
||||||
if msg[0] == "event":
|
logging.error("Malformed panel message on '%s': %s", self.name, msg)
|
||||||
if msg[1] == "startup":
|
return
|
||||||
|
# run action based on received command
|
||||||
|
if msg[0] == "event":
|
||||||
|
if msg[1] == "startup":
|
||||||
# TODO: Handle Update Messages
|
# TODO: Handle Update Messages
|
||||||
self.update_date()
|
self.update_date()
|
||||||
self.update_time()
|
self.update_time()
|
||||||
@@ -226,13 +232,24 @@ class LovelaceUIPanel:
|
|||||||
self.render_current_page(switchPages=True)
|
self.render_current_page(switchPages=True)
|
||||||
if msg[1] == "renderCurrentPage":
|
if msg[1] == "renderCurrentPage":
|
||||||
self.render_current_page(requested=True)
|
self.render_current_page(requested=True)
|
||||||
if msg[1] == "buttonPress2":
|
if msg[1] == "buttonPress2":
|
||||||
entity_id = msg[2]
|
if len(msg) < 4:
|
||||||
btype = msg[3]
|
logging.error("Malformed buttonPress2 payload on '%s': %s", self.name, msg)
|
||||||
value = msg[4] if len(msg) > 4 else None
|
return
|
||||||
if btype == "bExit":
|
entity_id = msg[2]
|
||||||
if entity_id in ["screensaver", "screensaver2"] and self.settings.get("screensaver").get("doubleTapToUnlock") and value == "1":
|
if entity_id == "":
|
||||||
return
|
return
|
||||||
|
btype = msg[3]
|
||||||
|
value = msg[4] if len(msg) > 4 else None
|
||||||
|
entity_config = {}
|
||||||
|
action_context = {
|
||||||
|
"panel": self.name,
|
||||||
|
"btype": btype,
|
||||||
|
"value": value,
|
||||||
|
}
|
||||||
|
if btype == "bExit":
|
||||||
|
if entity_id in ["screensaver", "screensaver2"] and self.settings.get("screensaver").get("doubleTapToUnlock") and value == "1":
|
||||||
|
return
|
||||||
|
|
||||||
# in case privious_cards is empty add a default card
|
# in case privious_cards is empty add a default card
|
||||||
if len(self.privious_cards) == 0:
|
if len(self.privious_cards) == 0:
|
||||||
@@ -247,12 +264,12 @@ class LovelaceUIPanel:
|
|||||||
return
|
return
|
||||||
|
|
||||||
# replace iid with real entity id
|
# replace iid with real entity id
|
||||||
if entity_id.startswith("iid."):
|
if entity_id.startswith("iid."):
|
||||||
iid = entity_id.split(".")[1]
|
iid = entity_id.split(".")[1]
|
||||||
for e in self.current_card.entities:
|
for e in self.current_card.entities:
|
||||||
if e.iid == iid:
|
if e.iid == iid:
|
||||||
entity_id = e.entity_id
|
entity_id = e.entity_id
|
||||||
entity_config = e.config
|
entity_config = e.config
|
||||||
|
|
||||||
match btype:
|
match btype:
|
||||||
case 'button':
|
case 'button':
|
||||||
@@ -269,29 +286,51 @@ class LovelaceUIPanel:
|
|||||||
self.privious_cards.append(self.current_card)
|
self.privious_cards.append(self.current_card)
|
||||||
self.current_card = self.searchCard(card_iid)
|
self.current_card = self.searchCard(card_iid)
|
||||||
self.render_current_page(switchPages=True)
|
self.render_current_page(switchPages=True)
|
||||||
# send ha stuff to ha
|
# send ha stuff to ha
|
||||||
case _:
|
case _:
|
||||||
ha_control.handle_buttons(entity_id, btype, value, entity_config=entity_config)
|
ha_control.handle_buttons(
|
||||||
|
entity_id,
|
||||||
|
btype,
|
||||||
|
value,
|
||||||
|
entity_config=entity_config,
|
||||||
|
action_context=action_context,
|
||||||
|
)
|
||||||
case 'cardUnlock-unlock':
|
case 'cardUnlock-unlock':
|
||||||
card_iid = entity_id.split(".")[1]
|
card_iid = entity_id.split(".")[1]
|
||||||
if int(self.current_card.config.get("pin")) == int(value):
|
if int(self.current_card.config.get("pin")) == int(value):
|
||||||
self.privious_cards.append(self.current_card)
|
self.privious_cards.append(self.current_card)
|
||||||
self.current_card = self.searchCard(card_iid)
|
self.current_card = self.searchCard(card_iid)
|
||||||
self.render_current_page(switchPages=True)
|
self.render_current_page(switchPages=True)
|
||||||
case _:
|
case 'mode-light':
|
||||||
ha_control.handle_buttons(entity_id, btype, value)
|
ha_control.handle_buttons(
|
||||||
|
entity_id,
|
||||||
|
btype,
|
||||||
|
value,
|
||||||
|
entity_config=entity_config,
|
||||||
|
action_context=action_context,
|
||||||
|
)
|
||||||
|
case _:
|
||||||
|
ha_control.handle_buttons(
|
||||||
|
entity_id,
|
||||||
|
btype,
|
||||||
|
value,
|
||||||
|
action_context=action_context,
|
||||||
|
)
|
||||||
|
|
||||||
if msg[1] == "pageOpenDetail":
|
if msg[1] == "pageOpenDetail":
|
||||||
entity_id = msg[3]
|
if len(msg) < 4:
|
||||||
# replace iid with real entity id
|
logging.error("Malformed pageOpenDetail payload on '%s': %s", self.name, msg)
|
||||||
if entity_id.startswith("iid."):
|
return
|
||||||
iid = entity_id.split(".")[1]
|
entity_id = msg[3]
|
||||||
for e in self.current_card.entities:
|
effectList = None
|
||||||
if e.iid == iid:
|
# replace iid with real entity id
|
||||||
entity_id = e.entity_id
|
if entity_id.startswith("iid."):
|
||||||
effectList = None
|
iid = entity_id.split(".")[1]
|
||||||
if entity_id.startswith("light"):
|
for e in self.current_card.entities:
|
||||||
effectList = e.config.get("effectList")
|
if e.iid == iid:
|
||||||
|
entity_id = e.entity_id
|
||||||
|
if entity_id.startswith("light"):
|
||||||
|
effectList = e.config.get("effectList")
|
||||||
if msg[2] == "popupInSel": #entity_id.split(".")[0] in ['input_select', 'media_player']:
|
if msg[2] == "popupInSel": #entity_id.split(".")[0] in ['input_select', 'media_player']:
|
||||||
libs.panel_cmd.entityUpdateDetail2(self.msg_out_queue, self.sendTopic, detail_open(self.settings["locale"], msg[2], entity_id, msg[3], self.msg_out_queue, sendTopic=self.sendTopic, options_list=effectList))
|
libs.panel_cmd.entityUpdateDetail2(self.msg_out_queue, self.sendTopic, detail_open(self.settings["locale"], msg[2], entity_id, msg[3], self.msg_out_queue, sendTopic=self.sendTopic, options_list=effectList))
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
paho-mqtt
|
paho-mqtt==1.6.1
|
||||||
pyyaml
|
pyyaml
|
||||||
websockets
|
websockets
|
||||||
websocket-client
|
websocket-client
|
||||||
@@ -7,4 +7,4 @@ python-dateutil
|
|||||||
scheduler
|
scheduler
|
||||||
babel
|
babel
|
||||||
watchdog
|
watchdog
|
||||||
jinja2
|
jinja2
|
||||||
|
|||||||
Reference in New Issue
Block a user