Compare commits

...

138 Commits
v4.7.0 ... main

Author SHA1 Message Date
Johannes
d745d63def Update copyright year to 2026 2026-02-22 01:20:16 +01:00
Johannes Braun
101e69bbde add migration page 2026-02-22 01:15:08 +01:00
Johannes Braun
d55a63b07c fix css 2026-02-22 01:08:16 +01:00
Johannes Braun
52a041521d fix3 2026-02-22 01:01:31 +01:00
Johannes Braun
f7fa1653c6 fix2 2026-02-22 00:57:18 +01:00
Johannes Braun
b925ea8a2d fix 2026-02-22 00:55:20 +01:00
Johannes Braun
da095b1591 migration mkdocs 2026-02-22 00:53:27 +01:00
Johannes Braun
ca6e271a54 add documentation for standalone version 2026-02-22 00:45:35 +01:00
Johannes
698ad7c771 Update .gitignore to include stuff for macos 2026-02-22 00:44:10 +01:00
Johannes
b0f40a1a87 Bump version to 4.7.85 2026-02-22 00:05:12 +01:00
Johannes
2cf7bcb63e fix loglevel 2026-02-22 00:04:34 +01:00
Johannes
05d9ff52ca Update project maintenance badge year to 2026 2026-02-21 19:37:24 +01:00
Johannes Braun
bb79cd8f85 read loglevel from env 2026-02-21 19:31:31 +01:00
Johannes Braun
00f7119cd2 added info logging for actions from panels 2026-02-21 18:52:54 +01:00
Johannes Braun
8e6f923839 bump version 2026-02-21 18:44:56 +01:00
Johannes Braun
cf396b0259 added error handling and improved logging 2026-02-21 18:44:23 +01:00
Johannes
42c27a3794 Bump version to 4.7.81 2026-02-21 14:42:01 +01:00
Johannes
c65f1935e5 Enhance button press logging with resolved entity ID
Log the resolved entity ID along with the button press event details.
2026-02-21 14:38:37 +01:00
Armilar
17284d83ca v5.1.1.4 - Update print statement from 'Hello' to 'Goodbye'
see Release Notes from 5.0.2.1 no 5.1.1.4
2026-02-17 23:56:37 +01:00
Armilar
2853073a59 Merge pull request #1421 from lubepi/patch-1
Fix: Display waking from screensaver on entity changes after thermostat interaction
2026-02-17 23:51:23 +01:00
Armilar
8de034adf9 Update script version to v5.1.1.4 2026-02-17 23:47:57 +01:00
Armilar
330fa9bfd4 Refactor power subscription handling in NSPanelTs
Refactor subscribePowerSubscriptions to use a subscription key for better management of subscriptions.
2026-02-17 23:43:00 +01:00
lubepi
ec971f5f3e Fix: Display waking from screensaver on entity changes after thermostat interaction
The subscribePowerSubscriptions() function was creating subscriptions via on()
without storing the subscription ID in the subscriptions object. This caused
UnsubscribeWatcher() to be unable to remove the subscription when the screensaver
activated, leaving it active and triggering GeneratePage() on any entity change.

Changes:
- Store subscription in subscriptions object with key 'power_<id>.ACTUAL'
- Add hasOwnProperty check to prevent duplicate subscriptions
2026-02-11 19:10:24 +01:00
dependabot[bot]
41f4062ab8 Bump docker/login-action from 3.6.0 to 3.7.0 (#1418)
Bumps [docker/login-action](https://github.com/docker/login-action) from 3.6.0 to 3.7.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v3.6.0...v3.7.0)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-version: 3.7.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-02 17:24:35 +01:00
dependabot[bot]
f3fffe7b70 Bump github/codeql-action from 3 to 4 (#1411)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3 to 4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-30 13:55:10 +01:00
dependabot[bot]
c4b6a8bd8a Bump frenck/action-addon-linter from 2.18 to 2.21 (#1410)
Bumps [frenck/action-addon-linter](https://github.com/frenck/action-addon-linter) from 2.18 to 2.21.
- [Release notes](https://github.com/frenck/action-addon-linter/releases)
- [Commits](https://github.com/frenck/action-addon-linter/compare/v2.18...v2.21)

---
updated-dependencies:
- dependency-name: frenck/action-addon-linter
  dependency-version: '2.21'
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-30 13:54:58 +01:00
dependabot[bot]
81d876b53b Bump actions/checkout from 5 to 6 (#1413)
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-30 13:54:20 +01:00
Thomas
d15cb218ce Merge pull request #1414 from tt-tom17/main
fix slider and volume
2025-12-29 16:56:05 +01:00
tt-tom17
114f630b8a fix slider and volume 2025-12-29 16:09:02 +01:00
tt-tom17
53b627be88 fix Mute 2025-12-29 16:06:54 +01:00
tt-tom17
f2e1a7263d fix slider and volume 2025-12-29 15:52:34 +01:00
Armilar
1e2f89ed1d Update TypeScript version and fix slider functionality 2025-12-29 13:56:43 +01:00
joBr99
b6f36d4eac Bump actions/checkout from 4 to 5 (#1378) (add nextion2text) 2025-12-26 19:43:33 +00:00
dependabot[bot]
fa239f8bf0 Bump actions/checkout from 4 to 5 (#1378)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-26 20:41:01 +01:00
dependabot[bot]
2d1719673c Bump actions/setup-python from 5 to 6 (#1382)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5 to 6.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-26 20:40:18 +01:00
dependabot[bot]
e9c275216c Bump home-assistant/builder from 2025.03.0 to 2025.09.0 (#1383)
Bumps [home-assistant/builder](https://github.com/home-assistant/builder) from 2025.03.0 to 2025.09.0.
- [Release notes](https://github.com/home-assistant/builder/releases)
- [Commits](https://github.com/home-assistant/builder/compare/2025.03.0...2025.09.0)

---
updated-dependencies:
- dependency-name: home-assistant/builder
  dependency-version: 2025.09.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-26 20:40:07 +01:00
dependabot[bot]
b226b61281 Bump docker/login-action from 3.5.0 to 3.6.0 (#1388)
Bumps [docker/login-action](https://github.com/docker/login-action) from 3.5.0 to 3.6.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v3.5.0...v3.6.0)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-version: 3.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-26 20:39:45 +01:00
dependabot[bot]
056d8f95c2 Bump stefanzweifel/git-auto-commit-action from 5 to 7 (#1391)
Bumps [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action) from 5 to 7.
- [Release notes](https://github.com/stefanzweifel/git-auto-commit-action/releases)
- [Changelog](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stefanzweifel/git-auto-commit-action/compare/v5...v7)

---
updated-dependencies:
- dependency-name: stefanzweifel/git-auto-commit-action
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-26 20:39:34 +01:00
Armilar
52c695cf1c Update script version to v5.1.1.2 and fix screensaver logic 2025-12-21 15:33:31 +01:00
Johannes
8805e2189c Remove Tasmota downgrade instructions
Removed instructions for downgrading Tasmota to version 15.0.1.
2025-12-12 17:20:06 +01:00
Nigel Rook
341cdb47ab Fix weather entities reverting to daily forecast (#1402) 2025-11-29 16:47:04 +01:00
Stephen Wesche
3b25d47bc7 Improve clarity and formatting in prepare_nspanel.md (#1400)
Updated formatting and corrected typos in the NSPanel flashing guide.
2025-11-29 15:55:14 +01:00
jacekowski
a721d4ccd7 deduplicate registed callbacks (#1401) 2025-11-29 15:43:57 +01:00
Armilar
044abda65b Add check for ACTUAL state existence before SET 2025-11-21 23:33:54 +01:00
Armilar
155b08d6d5 Change subscription change type from 'any' to 'ne' 2025-11-21 23:19:57 +01:00
Armilar
c038745d1b Update NSPanel DEV TypeScript version to 5.1.1.1 2025-11-21 23:07:35 +01:00
Thomas
154c9aced1 v5.1.0.3 DEV - Fix QR-Code Generation cardQR
v5.1.0.3 DEV -  Fix QR-Code Generation cardQR
2025-11-18 14:47:02 +01:00
tt-tom17
f5119f86ac v5.1.0.3 DEV - Fix QR-Code Generation cardQR 2025-11-18 14:16:09 +01:00
Armilar
77b7400b04 v5.1.0.2 DEV - Update TFT compatibility from 60 to 61
Updated compatibility notes for TFT version.
2025-11-16 12:41:44 +01:00
Armilar
995e7eebd2 Update script version to v5.1.0.2
Add Swiss-Weather-API Adapter by starwarsfan (many ThanX)
2025-11-16 12:36:26 +01:00
Armilar
c91ca0912a Merge pull request #1397 from starwarsfan/feature/swiss-weather-api
Add Swiss-Weather-API Adapter
2025-11-16 11:38:25 +01:00
Armilar
a6742f88c8 Merge pull request #1396 from starwarsfan/feature/fixTrailingWhitespaces
Feature/fix trailing whitespaces
2025-11-16 11:37:40 +01:00
Yves Schumann
9f146ec8b3 Add Swiss-Weather-API Adapter 2025-11-15 23:08:55 +01:00
Yves Schumann
0cccfac4a6 Fix trailing whitespaces on dev version 2025-11-15 22:56:44 +01:00
Yves Schumann
fbe5f9658e Fix trailing whitespaces 2025-11-15 22:42:34 +01:00
Armilar
603d207e12 Update script version to v5.1.0.1 and fix icons
Better Weather for Brightsky
2025-11-12 17:56:24 +01:00
Armilar
338c3af940 Update NSPanel TypeScript to version 5.1.0.0
Breaking Change in TFT 5.1.0 
- popupNotify with 3 Buttons
- Change Return Values from
    - no to button1
    - yes to button3
    - add button2 (centered)
2025-11-12 12:49:07 +01:00
Johannes
ce6ff734d1 Add downgrade instructions for Tasmota
Added instructions for downgrading Tasmota to version 15.0.1.
2025-10-30 16:49:45 +01:00
Armilar
4308c12508 v5.0.2.1 - Fix syntax error in Magenta color definition 2025-10-19 21:59:48 +02:00
Armilar
ea0f3cc411 Fix syntax error in Magenta color definition 2025-10-19 21:58:18 +02:00
Armilar
2b4c8d3b94 v5.0.2.1 - Update TypeScript version and fix URLs in comments 2025-10-19 10:56:08 +02:00
Armilar
ff25f07b8f Enhance comments for Tasmota32 version configuration
Added German and English comments for clarity on Tasmota version settings.
2025-10-19 10:48:02 +02:00
Armilar
59efd21251 Update TypeScript version and URLs in NSPanelTs.ts 2025-10-19 10:43:05 +02:00
Thomas
20ae492cf3 fix useValue 2025-09-29 16:37:01 +02:00
Armilar
512a89b7d6 Merge pull request #1385 from tt-tom17/main
Erweitere die CreateEntity-Funktion
2025-09-29 17:33:41 +03:00
tt-tom17
a6c366ed41 Erweitere die CreateEntity-Funktion um die Unterstützung für useValue und COLORDEC bei Rolle info 2025-09-29 16:28:17 +02:00
Armilar
e13d1aaecb v5.0.0.2 - DEV Update NSPanelTs.ts
Remove Startup Schedule at 3:30am
2025-09-19 10:26:13 +02:00
Armilar
3b6d53c78c Update NSPanelTs.ts 2025-09-19 10:24:27 +02:00
Armilar
f789e33fe5 v5.0.0.2 - DEV Update NSPanelTs.ts
Remove Startup Schedule at 3:30am
2025-09-19 10:14:47 +02:00
Armilar
22455546f6 Update NSPanelTs.ts
Remove Startup at 3:30
2025-09-19 10:11:47 +02:00
Armilar
e0e9815911 v5.0.0.1 - Update NsPanelTs.ts 2025-09-08 20:18:09 +02:00
Armilar
3e0d0e8854 v5.0.0.1 - Update NSPanelTs.ts 2025-09-08 20:17:14 +02:00
Armilar
98f70b20f0 Merge pull request #1375 from ticaki/main
update sliderItems types
2025-08-26 22:47:15 +02:00
Armilar
4c02b5bc26 v4.9.5.2 - DEV Update NSPanelTs.ts
Add Bright Sky Weather Adapter
2025-08-21 11:45:31 +02:00
Armilar
fb841abf45 v4.9.5.1 - Update NsPanelTs.ts
- Add USERICONS and colorScale to Alias-Channel Slider
- Prevent version search to the old directory path (Berry-Driver) 
- Add cardThermo2 to Script
- Add Pirate-Weather Adapter
- TFT 58 / 4.9.5 - Add cardThermo2 (eu/us-l/us-p) to HMI (TFT)
2025-08-14 09:46:42 +02:00
Armilar
bff89f0364 v4.9.5 - DEV Update NSPanelTs.ts 2025-08-14 09:39:33 +02:00
dependabot[bot]
27ccc0cfe7 Bump docker/login-action from 3.4.0 to 3.5.0 (#1377)
Bumps [docker/login-action](https://github.com/docker/login-action) from 3.4.0 to 3.5.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v3.4.0...v3.5.0)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-version: 3.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-13 22:12:20 +02:00
Armilar
22a54c88c8 v4.9.5.1 - DEV Update NSPanelTs.ts 2025-08-12 15:39:34 +02:00
Armilar
87c58cc62d v4.9.5.1 - DEV Update NSPanelTs.ts
Small fixes
2025-08-12 13:05:04 +02:00
Armilar
1ee19213bd v4.9.5.1 - DEV Update NSPanelTs.ts
Add cardThermo2
2025-08-11 22:14:21 +02:00
Armilar
0c3d173f40 v4.9.4.3 - DEV Update NSPanelTs.ts 2025-08-10 11:32:14 +02:00
Armilar
cc201fb7fe v4.9.4.3 - DEV Update NSPanelTs.ts 2025-08-10 11:31:10 +02:00
ticaki
44d2c6fbfc update sliderItems types 2025-08-06 17:03:59 +02:00
Armilar
9cd2f6a464 v4.9.4.2 - DEV Update NSPanelTs.ts
Update TFT US Versions
2025-08-05 17:16:03 +02:00
Armilar
7473d13762 v4.9.4.2 - DEV Update NSPanelTs.ts
* New Berry Update Path (RAW)
2025-08-05 14:14:53 +02:00
Armilar
f57b3fe8e4 v4.9.4.2 - DEV Update NSPanelTs.ts
Prevent version search to the old directory path (Berry-Driver)
2025-08-05 14:04:00 +02:00
Armilar
9b1558c9a6 v4.9.4.1 - DEV Update NSPanelTs.ts 2025-08-05 13:08:24 +02:00
Armilar
6181dec958 v4.49.4.1 - DEV Update NSPanelTs.ts
* Fix cardEntities Sliders in HMI
* Fix Sliders
* Add USERICONS and  colorScale to Alias-Channel slider
2025-08-05 13:05:53 +02:00
Johannes
a94cf0cef3 fixes #1373 2025-08-02 21:22:31 +02:00
Johannes
d01ccede57 Update nspanel-lovelace-ui.py 2025-07-31 20:39:04 +02:00
Johannes
65be5ffeb0 implements #1351 2025-07-31 20:37:31 +02:00
Johannes
d53afb0b20 fixes #1369 2025-07-31 20:11:02 +02:00
Armilar
9822870fc9 v4.9.3 - EU, US-L, US-P - Update NsPanelTs.ts 2025-07-31 17:54:36 +02:00
Armilar
8a54d1422c v4.9.3 - EU, US-p, US-l - Update NSPanelTs.ts 2025-07-31 17:52:14 +02:00
Armilar
3f573557f0 Merge pull request #1370 from ticaki/main
ready for 9.0.11
2025-07-30 22:06:08 +02:00
ticaki
c2ca3b26d1 fix 2025-07-30 21:59:16 +02:00
ticaki
476a252a92 ready for 9.0.11 2025-07-30 21:52:36 +02:00
Armilar
0af779973b v4.9.3 - DEV Update NSPanelTs.ts
popupShutter2 Changes (new Parameter shutterZeroIsClosed changing Direction of %-Value in HMI (0 <--> 100))
2025-07-30 14:01:04 +02:00
Armilar
8e0609a781 v4.9.3 - DEV Update NSPanelTs.ts
Some Shutter2 Changes
2025-07-30 13:59:25 +02:00
Armilar
5dab816259 v4.9.2.2 - Update NsPanelTs.ts 2025-07-28 14:11:29 +02:00
Armilar
5f8409f5f1 v4.9.2.3 - DEV Update NSPanelTs.ts
- 28.07.2025 - v4.9.2.3  Quick-Fix Errors with TypeScript in JS > 9.X (by ticaki)
2025-07-28 14:10:24 +02:00
Armilar
3d85e86a95 v4.9.2.3 - Update NsPanelTs.ts
Quick-Fix Errors with TypeScript (Bugs in JavaScript > 9.X) by ticaki
2025-07-28 10:17:57 +02:00
Armilar
85de880cda Merge pull request #1368 from ticaki/main
fix/ignore typescript errors
2025-07-28 00:15:53 +02:00
ticaki
98269b19aa fix/ignore typescript errors 2025-07-28 00:10:22 +02:00
Armilar
d77382ee88 v4.9.2.2 - Update NsPanelTs.ts
* Add Weather-Adapter OpenWeatherMap
* Accuweather deprecated
2025-07-25 21:49:57 +02:00
Armilar
e925d133d2 v4.9.2.2 - DEV Update NSPanelTs.ts
* Fix Examples
* Fix OpenWeatherMap fewclouds night
2025-07-25 21:43:23 +02:00
Armilar
5ef3e8132b v4.9.2.2 - DEV Update NSPanelTs.ts
* AccuWeather deprecated
* Add OpenWeatherMap
2025-07-25 16:03:06 +02:00
Armilar
662b79a389 v4.9.2 - DEV - Update NSPanelTs.ts 2025-07-24 14:11:30 +02:00
Armilar
c984ff53a3 v4.8.0 - Update NsPanelTs.ts
* Add popupShutter2
* Add popupLight2
* Add popupSlider (cardMedia EQ)
* Fix Demomodus cardPower
* Small Fixes
2025-06-30 12:40:43 +02:00
Armilar
f8b748a418 Merge pull request #1360 from ticaki/main
Types and variables for popupShutter2 changed.
2025-06-30 12:13:09 +02:00
Armilar
bc31670760 v4.9.0.1 - DEV Update NSPanelTs.ts
Small Fixes
2025-06-30 12:06:11 +02:00
Armilar
cbf6abf4dd v4.9.0 - DEV Update NSPanelTs.ts
Small Fixes
2025-06-30 12:02:17 +02:00
Armilar
5c85e4a6e1 Update NSPanelTs.ts
Change Release
2025-06-30 11:58:08 +02:00
Armilar
cbede2412e v4.9.0 - DEV Update NSPanelTs.ts
New Beta
2025-06-30 11:57:26 +02:00
ticaki
82d22743cc rename customIcons for shutter 2025-06-29 16:08:32 +02:00
ticaki
640d0dfa14 check customIcons 2025-06-29 15:43:19 +02:00
ticaki
ccc62d1e6a Types and variables for popupShutter2 changed. 2025-06-29 15:35:04 +02:00
Armilar
6cec0245a3 v4.7.5 - DEV Update NSPanelTs.ts
Add TFT US-P v4.7.5
2025-06-26 13:01:27 +02:00
Armilar
f3c98adf06 v4.7.5.1 - DEV Update NSPanelTs.ts 2025-06-25 23:48:29 +02:00
Armilar
f4487e4285 v4.7.5.1 - DEV Update NSPanelTs.ts
TFT EU + US-P
2025-06-25 23:46:34 +02:00
Armilar
8e2780b2cb Update NSPanelTs.ts DEV 4.7.5.1
Add popupLight2
2025-06-25 14:21:25 +02:00
Armilar
0372221973 Update NSPanelTs.ts DEV 4.7.4.1
- Add popupShutter2
2025-06-25 00:20:01 +02:00
Johannes
947ef2d592 Update pages.py 2025-06-24 20:28:23 +02:00
Johannes
a1f39236c4 implements #1350 2025-06-23 22:38:20 +02:00
Thomas
4cdd1ed586 Merge pull request #1357 from tt-tom17/main
v4.7.2.4 - DEV-Update NSPanel.ts
2025-06-21 12:28:25 +02:00
tt-tom17
1836d29931 v4.7.2.4 - DEV-Update NSPanel.ts
- fix DEMO mode check of Powerpage
2025-06-21 12:22:07 +02:00
tt-tom17
fca29cfbd8 v4.7.2.4 - DEV-Update NSPanel.ts
- fix DEMO mode check of Powerpage
2025-06-21 12:18:14 +02:00
Armilar
b27910c1af Merge pull request #1354 from ticaki/main
IconSelect left and indicatorScreensaverEntity added
2025-06-20 10:35:21 +02:00
ticaki
f046ae6031 IconSelect left and indicatorScreensaverEntity added 2025-06-20 10:28:46 +02:00
Thomas
4475ab1277 Merge pull request #1348 from ticaki/main
States only respond to any if ack = false
2025-06-13 00:23:53 +02:00
dependabot[bot]
9afdb71a7c Bump home-assistant/builder from 2024.08.2 to 2025.03.0 (#1317)
Bumps [home-assistant/builder](https://github.com/home-assistant/builder) from 2024.08.2 to 2025.03.0.
- [Release notes](https://github.com/home-assistant/builder/releases)
- [Commits](https://github.com/home-assistant/builder/compare/2024.08.2...2025.03.0)

---
updated-dependencies:
- dependency-name: home-assistant/builder
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-12 20:08:47 +02:00
dependabot[bot]
c84d78551f Bump docker/login-action from 3.3.0 to 3.4.0 (#1316)
Bumps [docker/login-action](https://github.com/docker/login-action) from 3.3.0 to 3.4.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v3.3.0...v3.4.0)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-12 20:08:35 +02:00
Johannes
5e2a4b17ae Update prepare_ha.md 2025-06-12 20:07:00 +02:00
Paweł Zubrycki
acdba468b3 Add weather service call functionality and fix weather forecast assignment (#1349) 2025-06-12 18:40:55 +02:00
ticaki
5803a489f5 States only respond to any if ack = false 2025-06-12 15:29:17 +02:00
patricknitsch
54c8d302a8 Add Entity Type "Valve" (#1347)
* Update pages.py

* Update controller.py

* Update pages.py

* Update pages.py
2025-06-06 19:24:56 +02:00
mikosoft83
8059905579 Update icons.py (#1343)
Climate icons improvement
2025-06-02 23:15:30 +02:00
Johannes
4dc39c1b79 Should fix #1336 2025-05-30 09:00:29 +02:00
40 changed files with 6651 additions and 1975 deletions

View File

@@ -21,7 +21,7 @@ jobs:
changed: ${{ steps.changed_addons.outputs.changed }}
steps:
- name: Check out the repository
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Get changed files
id: changed_files
@@ -68,7 +68,7 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Get information
id: info
@@ -92,7 +92,7 @@ jobs:
- name: Login to GitHub Container Registry
if: env.BUILD_ARGS != '--test'
uses: docker/login-action@v3.3.0
uses: docker/login-action@v3.7.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
@@ -100,7 +100,7 @@ jobs:
- name: Build ${{ matrix.addon }} add-on
if: steps.check.outputs.build_arch == 'true'
uses: home-assistant/builder@2024.08.2
uses: home-assistant/builder@2025.09.0
with:
args: |
${{ env.BUILD_ARGS }} \

View File

@@ -43,11 +43,11 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
# 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).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3
uses: github/codeql-action/autobuild@v4
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
@@ -72,4 +72,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@v4

View File

@@ -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

View File

@@ -6,24 +6,51 @@ on:
branches:
- main
paths:
- docs/*
- docs/**
- docs-standalone/**
- .github/workflows/docs-release.yml
- mkdocs.yml
- docs-standalone/mkdocs.yml
- HMI/README.md
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
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: git config --global user.name Docs deploy
- run: git config --global user.email docs@dummy.bot.com
- run: mike set-default stable
- run: mike deploy --push --update-aliases stable
- run: zensical build --config-file mkdocs.yml
- run: mv site _site_main
- run: zensical build --config-file docs-standalone/mkdocs.yml
- 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

View File

@@ -11,7 +11,7 @@ jobs:
name: HACS Action
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v4"
- uses: "actions/checkout@v6"
- name: HACS Action
uses: "hacs/action@main"
with:

View File

@@ -18,7 +18,7 @@ jobs:
gen-ioBroker-localization:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
ref: ${{ github.head_ref }}
@@ -28,7 +28,7 @@ jobs:
python HMI/code_gen/localization/iobroker.py
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:
commit_message: Update iobroker localization file
#file_pattern: "**.txt"

View File

@@ -18,7 +18,7 @@ jobs:
addons: ${{ steps.addons.outputs.addons_list }}
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: 🔍 Find add-on directories
id: addons
@@ -33,9 +33,9 @@ jobs:
path: ${{ fromJson(needs.find.outputs.addons) }}
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: 🚀 Run Home Assistant Add-on Lint
uses: frenck/action-addon-linter@v2.18
uses: frenck/action-addon-linter@v2.21
with:
path: "./${{ matrix.path }}"

View File

@@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
ref: ${{ github.head_ref }}
@@ -80,7 +80,7 @@ jobs:
find -name "**.txt"
rm Nextion2Text.py* ignore-id.py out.txt
- uses: stefanzweifel/git-auto-commit-action@v5
- uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: ${{ steps.last-commit-message.outputs.msg }} (add nextion2text)
#file_pattern: "**.txt"

27
.gitignore vendored
View File

@@ -7,3 +7,30 @@ panels.yaml
# don't add Webstorm project stuff
.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

View File

@@ -1,4 +1,4 @@
+++ /dev/fd/62 2024-11-22 20:00:11.734673876 +0000
+++ /dev/fd/62 2025-12-26 19:43:25.803166597 +0000
+I/n2t-out/Program.s.txt
++ HMI/US/portrait/n2t-out/Program.s.txt
+1 +12,11 @@

View File

@@ -5,7 +5,7 @@ If you like this project consider buying me a pizza 🍕 <a href="https://paypal
[![hacs_badge](https://img.shields.io/badge/HACS-Default-41BDF5.svg)](https://github.com/hacs/integration)
![hacs validation](https://github.com/joBr99/nspanel-lovelace-ui/actions/workflows/hacs-validation.yaml/badge.svg)
[![GitHub Release](https://img.shields.io/github/release/joBr99/nspanel-lovelace-ui.svg)](https://github.com/joBr99/nspanel-lovelace-ui/releases)
![Project Maintenance](https://img.shields.io/maintenance/yes/2024.svg)
![Project Maintenance](https://img.shields.io/maintenance/yes/2026.svg)
[![GitHub Activity](https://img.shields.io/github/commit-activity/y/joBr99/nspanel-lovelace-ui.svg)](https://github.com/joBr99/nspanel-lovelace-ui/commits/main)

View File

@@ -151,7 +151,7 @@ class LuiController(object):
items = self._config.get_all_entity_names()
apis.ha_api.log(f"gtest123: {items}")
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}")
for item in items:
if apis.ha_api.entity_exists(item):
@@ -206,11 +206,15 @@ class LuiController(object):
self._pages_gen.generate_timer_detail_page(entity_id, True)
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'):
entity_config = self._config._config_entites_table.get(entity_id)
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
if entity_id == "screensaver" and button_type == "bExit":
# get default card if there is one
@@ -334,6 +338,11 @@ class LuiController(object):
apis.ha_api.get_entity(entity_id).call_service("return_to_base")
elif entity_id.startswith('service'):
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
if button_type == "media-next":

View File

@@ -159,8 +159,8 @@ alarm_control_panel_mapping = {
}
climate_mapping = {
'auto': 'calendar-sync',
'heat_cool': 'calendar-sync',
'auto': 'fan-auto',
'heat_cool': 'sun-snowflake-variant',
'heat': 'fire',
'off': 'power',
'cool': 'snowflake',

View File

@@ -275,7 +275,7 @@ class LuiPagesGen(object):
icon_up_status = "disable"
icon_stop_status = "disable"
icon_down_status = "disable"
bits = entity.attributes['supported_features']
bits = entity.attributes.get('supported_features')
pos = entity.attributes.get("current_position")
if pos is None:
pos_status = entity.state
@@ -309,6 +309,11 @@ class LuiPagesGen(object):
unit_of_measurement = entity.attributes.get("unit_of_measurement", "")
value = entity.state
try:
value = str(round(float(value), 1))
except:
print("An exception occurred")
# limit value to 4 chars on us-p
if self._config.get("model") == "us-p" and cardType == "cardEntities":
value = entity.state[:4]
@@ -382,8 +387,30 @@ class LuiPagesGen(object):
elif entityType == "weather":
entityTypePanel = "text"
unit = get_attr_safe(entity, "temperature_unit", "")
if type(item.stype) == int and len(entity.attributes['forecast']) >= item.stype:
fdate = dp.parse(entity.attributes['forecast'][item.stype]['datetime'])
rt = None
index = item.stype
if type(item.stype) == str and ":" in item.stype and len(item.stype.split(":")) == 2:
spintstr = item.stype.split(":")
rt = spintstr[0]
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
@@ -391,11 +418,20 @@ class LuiPagesGen(object):
else:
dateformat = "%a" if item.nameOverride is None else item.nameOverride
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)
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:
value = f'{get_attr_safe(entity, "temperature", "")}{unit}'
else:
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:
name = "unsupported"
# Overwrite for value
@@ -1059,3 +1095,4 @@ class LuiPagesGen(object):
self._send_mqtt_msg(f"pageType~popupNotify")
self._send_mqtt_msg(f"entityUpdateDetail~{ident}~{heading}~65535~{b1}~65535~{b2}~65535~{msg}~65535~0")

View File

@@ -34,7 +34,7 @@ class NsPanelLovelaceUIManager(ad.ADBase):
desired_tasmota_driver_version = 8
desired_display_firmware_version = 53
version = "v4.3.3"
version = "v4.7.3"
model = cfg.get("model")
if model == "us-l":

View 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;
}

View 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
```

View 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
```

View 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.

View 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]
```

View 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`

View 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.

View 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.

View 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
```

View 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>`

View 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

View File

@@ -10,14 +10,46 @@
display: none;
}
/*.md-header,*/ .md-footer {
/*.md-header,*/ .md-footer,
.md-footer-meta {
background-color: #333333;
}
.md-footer__inner.md-grid {
display: none;
/* 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;
}

View 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/)

View File

@@ -94,37 +94,3 @@ Now, to install NSPanel Lovelace UI Backend with HACS, follow these steps:
proceed with the download
7. The Backend Application is now installed, and HACS will inform you when updates are available
# Workaround for HomeAssistant 2024.04
AppDaemon is using the old REST API that until AppDaemon moved on the the websocket API this woraround is needed to get weather forecast data from homeassistant. (https://github.com/AppDaemon/appdaemon/issues/1837)
To get the forecast data in appdaemon, there is a script needed in homeassistant's configuration.yaml:
```yaml
template:
- trigger:
- platform: time_pattern
hours: /1
- platform: homeassistant
event: start
action:
- service: weather.get_forecasts
data:
type: daily
target:
entity_id: weather.home # change to your weather entity
response_variable: daily
sensor:
- name: Weather Forecast Daily
unique_id: weather_forecast_daily
state: "{{ states('weather.home') }}" # # change to your weather entity in this line
attributes:
temperature: "{{ state_attr('weather.home', 'temperature') }}" # change to your weather entity
temperature_unit: "{{ state_attr('weather.home', 'temperature_unit') }}" # change to your weather entity
forecast: "{{ daily['weather.home'].forecast }}" # change to your weather entity
```
![image](https://github.com/joBr99/nspanel-lovelace-ui/assets/29555657/41f21db3-a6e2-4e4f-8dab-b9351ecd23e5)
Adjust the entities in your apps.yaml that are accessing the forecast to the newly created trigger template:
![image](https://github.com/joBr99/nspanel-lovelace-ui/assets/29555657/1cfd913d-88be-4cb0-9a68-0e864ee1ad4f)

View File

@@ -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 can use the Tasmota Web Installer to do so. [Tasmota Web Installer](https://tasmota.github.io/install/)
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](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)
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.
[ESPHome component](https://github.com/sairon/esphome-nspanel-lovelace-ui)
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)
---
## 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.)
![tasmota-template-config](img/tasmota-template-config.png)
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
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
```
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.
(Matter could cause memory issues during flashing of the Nextion Screen, but you can still enable it if you need to.)
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.)
---
## 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>
<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>
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>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -12,7 +12,7 @@ repo_name: jobr99/nspanel-lovelace-ui
repo_url: https://github.com/jobr99/nspanel-lovelace-ui
edit_uri: ""
copyright: "Copyright &copy; 2023 Johannes Braun"
copyright: "Copyright &copy; 2026 Johannes Braun"
docs_dir: docs
@@ -42,8 +42,6 @@ extra_css:
extra:
analytics:
provider: custom
version:
provider: mike
markdown_extensions:
- admonition
@@ -63,7 +61,6 @@ markdown_extensions:
plugins:
- search:
lang: en
- mkdocs-video
nav:
- "Overview": index.md
@@ -75,6 +72,7 @@ nav:
- "FAQ": faq.md
- "Configuration - apps.yaml (Home Assistant)":
- "Overview": config-overview.md
#- "Migration to Standalone Rewrite": config-migration-standalone.md
- "Screensaver": config-screensaver.md
- "Cards":
- "Entities Card": card-entities.md

View File

@@ -1,6 +1,6 @@
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config
name: NSPanel Lovelace UI Addon
version: "4.7.80"
version: "4.7.85"
slug: nspanel-lovelace-ui
description: NSPanel Lovelace UI Addon
services:

View File

@@ -475,7 +475,7 @@ class AlarmCard(HACard):
main_entity = self.entities[0]
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")
color = rgb_dec565([255,255,255])

View File

@@ -8,6 +8,8 @@ def wait_for_ha_cache():
while time.time() < mustend:
if len(libs.home_assistant.home_assistant_entity_state_cache) == 0:
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)
def calculate_dim_values(sleepTracking, sleepTrackingZones, sleepBrightness, screenBrightness, sleepOverride, return_involved_entities=False):
@@ -28,8 +30,8 @@ def calculate_dim_values(sleepTracking, sleepTrackingZones, sleepBrightness, scr
involved_entities.append(sleepBrightness)
try:
dimmode = int(float(libs.home_assistant.get_entity_data(sleepBrightness).get('state', 10)))
except ValueError:
print("sleepBrightness entity invalid")
except (TypeError, ValueError):
logging.exception("sleepBrightness entity '%s' has an invalid state value", sleepBrightness)
if screenBrightness:
if isinstance(screenBrightness, int):
@@ -44,8 +46,8 @@ def calculate_dim_values(sleepTracking, sleepTrackingZones, sleepBrightness, scr
involved_entities.append(screenBrightness)
try:
dimValueNormal = int(float(libs.home_assistant.get_entity_data(screenBrightness).get('state', 100)))
except ValueError:
print("screenBrightness entity invalid")
except (TypeError, ValueError):
logging.exception("screenBrightness entity '%s' has an invalid state value", screenBrightness)
# force sleep brightness to zero in case sleepTracking is active
if sleepTracking:
if libs.home_assistant.is_existent(sleepTracking):
@@ -69,12 +71,13 @@ def calculate_dim_values(sleepTracking, sleepTrackingZones, sleepBrightness, scr
else:
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:
case 'button':
button_press(entity_id, value)
button_press(entity_id, value, action_context=action_context)
case 'OnOff':
on_off(entity_id, value)
on_off(entity_id, value, action_context=action_context)
case 'number-set':
if entity_id.startswith('fan'):
attr = libs.home_assistant.get_entity_data(entity_id).get('attributes', [])
@@ -82,7 +85,7 @@ def handle_buttons(entity_id, btype, value, entity_config=None):
service_data = {
"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':
action_service_mapping = {
'up': 'open_cover',
@@ -99,37 +102,37 @@ def handle_buttons(entity_id, btype, value, entity_config=None):
'timer-finish': 'finish',
}
service = action_service_mapping[btype]
call_ha_service(entity_id, service)
call_ha_service(entity_id, service, action_context=action_context)
case 'timer-start':
if value:
service_data = {
"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:
call_ha_service(entity_id, "start")
call_ha_service(entity_id, "start", action_context=action_context)
case 'positionSlider':
service_data = {
"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':
service_data = {
"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':
state = libs.home_assistant.get_entity_data(entity_id).get('state', '')
if state == "off":
call_ha_service(entity_id, "turn_on")
call_ha_service(entity_id, "turn_on", action_context=action_context)
else:
call_ha_service(entity_id, "turn_off")
call_ha_service(entity_id, "turn_off", action_context=action_context)
case 'media-shuffle':
suffle = libs.home_assistant.get_entity_data(entity_id).get('attributes', []).get('shuffle')
service_data = {
"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':
pos = int(value)
# HA wants to have this value between 0 and 1 as float
@@ -137,12 +140,12 @@ def handle_buttons(entity_id, btype, value, entity_config=None):
service_data = {
"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':
service_data = {
"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
case 'brightnessSlider':
# scale 0-100 to ha brightness range
@@ -150,7 +153,7 @@ def handle_buttons(entity_id, btype, value, entity_config=None):
service_data = {
"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':
attr = libs.home_assistant.get_entity_data(entity_id).get('attributes', [])
min_mireds = attr.get("min_mireds")
@@ -160,19 +163,19 @@ def handle_buttons(entity_id, btype, value, entity_config=None):
service_data = {
"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':
value = value.split('|')
color = pos_to_color(int(value[0]), int(value[1]), int(value[2]))
service_data = {
"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':
service_data = {
"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':
attr = libs.home_assistant.get_entity_data(entity_id).get('attributes', [])
mapping = {
@@ -187,7 +190,7 @@ def handle_buttons(entity_id, btype, value, entity_config=None):
service_data = {
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':
options = libs.home_assistant.get_entity_data(entity_id).get('attributes', []).get("options", [])
if options:
@@ -195,7 +198,7 @@ def handle_buttons(entity_id, btype, value, entity_config=None):
service_data = {
"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':
options = libs.home_assistant.get_entity_data(entity_id).get('attributes', []).get("source_list", [])
if options:
@@ -203,7 +206,7 @@ def handle_buttons(entity_id, btype, value, entity_config=None):
service_data = {
"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':
options = entity_config.get("effectList", libs.home_assistant.get_entity_data(entity_id).get('attributes', []).get("effect_list", []))
if options:
@@ -211,13 +214,13 @@ def handle_buttons(entity_id, btype, value, entity_config=None):
service_data = {
"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':
temp = int(value)/10
service_data = {
"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':
value = value.split("|")
temp_high = int(value[0])/10
@@ -226,47 +229,67 @@ def handle_buttons(entity_id, btype, value, entity_config=None):
"target_temp_high": temp_high,
"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':
service_data = {
"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 _:
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]
libs.home_assistant.call_service(
ok = libs.home_assistant.call_service(
entity_name=entity_id,
domain=etype,
service=service,
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]
match etype:
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':
call_ha_service(entity_id, "toggle")
call_ha_service(entity_id, "toggle", action_context=action_context)
case 'lock':
state = libs.home_assistant.get_entity_data(entity_id).get('state', '')
if state == "locked":
call_ha_service(entity_id, "unlock")
call_ha_service(entity_id, "unlock", action_context=action_context)
else:
call_ha_service(entity_id, "lock")
call_ha_service(entity_id, "lock", action_context=action_context)
case 'button' | 'input_button':
call_ha_service(entity_id, "press")
call_ha_service(entity_id, "press", action_context=action_context)
case 'input_select' | 'select':
call_ha_service(entity_id, "select_next")
call_ha_service(entity_id, "select_next", action_context=action_context)
case 'vacuum':
state = libs.home_assistant.get_entity_data(entity_id).get('state', '')
if state == "docked":
call_ha_service(entity_id, "start")
call_ha_service(entity_id, "start", action_context=action_context)
else:
call_ha_service(entity_id, "return_to_base")
call_ha_service(entity_id, "return_to_base", action_context=action_context)
case _:
logging.error("buttonpress for entity type %s not implemented", etype)
@@ -274,14 +297,14 @@ def button_press(entity_id, value):
# apis.ha_api.call_service(entity_id.replace(
# '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]
match etype:
case 'light' | 'switch' | 'input_boolean' | 'automation' | 'fan':
service = "turn_off"
if value == "1":
service = "turn_on"
call_ha_service(entity_id, service)
call_ha_service(entity_id, service, action_context=action_context)
case _:
logging.error(
"Control action on_off not implemented for %s", entity_id)

View File

@@ -16,6 +16,7 @@ ws_connected = False
home_assistant_entity_state_cache = {}
template_cache = {}
response_buffer = {}
nspanel_event_handler = None
ON_CONNECT_HANDLER = None
@@ -46,10 +47,16 @@ def register_on_disconnect_handler(handler):
def on_message(ws, message):
global auth_ok, request_all_states_id, home_assistant_entity_state_cache, response_buffer, template_cache
try:
json_msg = json.loads(message)
if json_msg["type"] == "auth_required":
except json.JSONDecodeError:
logging.exception("Failed to parse Home Assistant websocket message as JSON")
return
message_type = json_msg.get("type")
if message_type == "auth_required":
authenticate_client()
elif json_msg["type"] == "auth_ok":
elif message_type == "auth_ok":
auth_ok = True
logging.info("Home Assistant auth OK. Requesting existing states.")
subscribe_to_events()
@@ -57,30 +64,41 @@ def on_message(ws, message):
if ON_CONNECT_HANDLER is not None:
ON_CONNECT_HANDLER()
# for templates
elif json_msg["type"] == "event" and json_msg["id"] in response_buffer:
elif message_type == "event" and json_msg.get("id") in response_buffer:
event = json_msg.get("event", {})
listeners = event.get("listeners", {})
template_cache[response_buffer[json_msg["id"]]] = {
"result": json_msg["event"]["result"],
"listener-entities": json_msg["event"]["listeners"]["entities"]
"result": event.get("result"),
"listener-entities": listeners.get("entities", [])
}
elif json_msg["type"] == "event" and json_msg["event"]["event_type"] == "state_changed":
entity_id = json_msg["event"]["data"]["entity_id"]
home_assistant_entity_state_cache[entity_id] = json_msg["event"]["data"]["new_state"]
elif message_type == "event" and json_msg.get("event", {}).get("event_type") == "state_changed":
event_data = json_msg.get("event", {}).get("data", {})
entity_id = event_data.get("entity_id")
if not entity_id:
logging.debug("Received state_changed event without entity_id")
return
home_assistant_entity_state_cache[entity_id] = event_data.get("new_state")
send_entity_update(entity_id)
# rerender template
for template, template_cache_entry in template_cache.items():
if entity_id in template_cache_entry.get("listener-entities", []):
cache_template(template)
elif json_msg["type"] == "event" and json_msg["event"]["event_type"] == "esphome.nspanel.data":
nspanel_data_callback(json_msg["event"]["data"]["device_id"], json_msg["event"]["data"]["CustomRecv"])
elif json_msg["type"] == "result" and not json_msg["success"]:
logging.error("Failed result: ")
logging.error(json_msg)
elif json_msg["type"] == "result" and json_msg["success"]:
if json_msg["id"] == request_all_states_id:
for entity in json_msg["result"]:
elif message_type == "event" and json_msg.get("event", {}).get("event_type") == "esphome.nspanel.data":
event_data = json_msg.get("event", {}).get("data", {})
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["id"] in response_buffer and json_msg.get("result"):
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:
@@ -98,7 +116,11 @@ def _ws_connection_open(ws):
def _ws_connection_close(ws, close_status_code, close_msg):
global ws_connected
ws_connected = False
logging.error("WebSocket connection closed!")
logging.error(
"WebSocket connection closed (status=%s, message=%s)",
close_status_code,
close_msg,
)
if ON_DISCONNECT_HANDLER is not None:
ON_DISCONNECT_HANDLER()
@@ -119,9 +141,12 @@ def _do_connection():
on_open=_ws_connection_open, on_close=_ws_connection_close)
while True:
logging.info(F"Connecting to Home Assistant at {ws_url}")
try:
ws.close()
time.sleep(1)
ws.run_forever(sslopt={"cert_reqs": ssl.CERT_NONE})
except Exception:
logging.exception("WebSocket connection loop failed")
time.sleep(10)
@@ -145,8 +170,8 @@ def subscribe_to_events():
send_message(json.dumps(msg))
def subscribe_to_nspanel_events(nsp_callback):
global next_id, nspanel_data_callback
nspanel_data_callback = nsp_callback
global next_id, nspanel_event_handler
nspanel_event_handler = nsp_callback
msg = {
"id": next_id,
"type": "subscribe_events",
@@ -169,8 +194,10 @@ def send_entity_update(entity_id):
on_ha_update(entity_id)
def nspanel_data_callback(device_id, msg):
global nspanel_data_callback
nspanel_data_callback(device_id, msg)
if nspanel_event_handler is None:
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:
global next_id
@@ -187,8 +214,11 @@ def call_service(entity_name: str, domain: str, service: str, service_data: dict
}
send_message(json.dumps(msg))
return True
except Exception as e:
logging.exception("Failed to call Home Assisatant service.")
except Exception:
logging.exception(
"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:
@@ -203,8 +233,8 @@ def send_msg_to_panel(service: str, service_data: dict) -> bool:
}
send_message(json.dumps(msg))
return True
except Exception as e:
logging.exception("Failed to call Home Assisatant service.")
except Exception:
logging.exception("Failed to call Home Assistant panel service: %s", service)
return False
def execute_script(entity_name: str, domain: str, service: str, service_data: dict) -> str:
@@ -241,13 +271,13 @@ def execute_script(entity_name: str, domain: str, service: str, service_data: di
else:
return response_buffer[call_id]["response"]
raise TimeoutError("Did not recive respose in time to HA script call")
except Exception as e:
logging.exception("Failed to call Home Assisatant script.")
except Exception:
logging.exception("Failed to call Home Assistant script: %s.%s", domain, service)
return {}
def cache_template(template):
if not template:
raise Exception("Invalid template")
raise ValueError("Invalid template")
global next_id, response_buffer
try:
call_id = next_id
@@ -259,7 +289,7 @@ def cache_template(template):
}
send_message(json.dumps(msg))
return True
except Exception as e:
except Exception:
logging.exception("Failed to render template.")
return False
@@ -301,5 +331,10 @@ def is_existent(entity_id: str):
def send_message(message):
global ws, next_id
try:
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")

View File

@@ -25,27 +25,42 @@ last_settings_file_mtime = 0
mqtt_connect_time = 0
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):
global panel_in_queues
# send HA updates to all panels
for queue in panel_in_queues.values():
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):
global panel_in_queues
if device_id in panel_in_queues.keys():
queue = panel_in_queues[device_id]
try:
queue.put(("MQTT:", msg))
except Exception:
logging.exception("Failed to enqueue panel event for device '%s'", device_id)
def process_output_to_panel():
while True:
try:
msg = panel_out_queue.get()
#client.publish(msg[0], msg[1])
#apis.ha_api.call_service(service="esphome/" + self._api_panel_name + "_nspanelui_api_call", command=2, data=msg)
service = msg[0] + "_nspanelui_api_call"
service_data = {
"data": msg[1],
@@ -55,23 +70,31 @@ def process_output_to_panel():
service=service,
service_data=service_data
)
except Exception:
logging.exception("Failed to process outgoing panel message")
def connect():
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:
MqttManager(settings, panel_out_queue, panel_in_queues)
else:
logging.info("MQTT values not configured, will not connect.")
# 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.connect()
else:
logging.info("Home Assistant values not configured, will not connect.")
return
wait_seconds = 0
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)
if settings.get("use_ha_api"):
libs.home_assistant.subscribe_to_nspanel_events(on_ha_panel_event)
@@ -97,13 +120,20 @@ def setup_panels():
panel_thread.start()
def panel_thread_target(queue_in, 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:
try:
msg = queue_in.get()
if msg[0] == "MQTT:":
panel.customrecv_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():
CONFIG_FILE = os.getenv('CONFIG_FILE')
@@ -117,18 +147,27 @@ def get_config(file):
try:
with open(file, 'r', encoding="utf8") as 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:
print ("Error while parsing YAML file:")
logging.error("Error while parsing YAML file: %s", file)
if hasattr(exc, 'problem_mark'):
if exc.context != None:
print (' parser says\n' + str(exc.problem_mark) + '\n ' +
str(exc.problem) + ' ' + str(exc.context) +
'\nPlease correct data and retry.')
logging.error(
"Parser says\n%s\n%s %s\nPlease correct data and retry.",
str(exc.problem_mark), str(exc.problem), str(exc.context)
)
else:
print (' parser says\n' + str(exc.problem_mark) + '\n ' +
str(exc.problem) + '\nPlease correct data and retry.')
logging.error(
"Parser says\n%s\n%s\nPlease correct data and retry.",
str(exc.problem_mark), str(exc.problem)
)
else:
print ("Something went wrong while parsing yaml file")
logging.exception("Something went wrong while parsing yaml file")
return False
if not settings.get("mqtt_username"):
@@ -172,10 +211,14 @@ def config_watch():
project_files.append(get_config_file())
handler = ConfigChangeEventHandler(project_files)
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()
while True:
try:
time.sleep(1)
except Exception:
logging.exception("Config watch loop failed")
def signal_handler(signum, frame):
logging.info(f"Received signal {signum}. Initiating restart...")
@@ -194,4 +237,5 @@ if __name__ == '__main__':
time.sleep(100)
else:
while True:
time.sleep(100)

View File

@@ -19,7 +19,6 @@ class MqttManager:
self.client.username_pw_set(
settings["mqtt_username"], settings["mqtt_password"])
# Wait for connection
connection_return_code = 0
mqtt_server = settings["mqtt_server"]
mqtt_port = int(settings["mqtt_port"])
logging.info("Connecting to %s:%i as %s",
@@ -28,9 +27,12 @@ class MqttManager:
try:
self.client.connect(mqtt_server, mqtt_port, 5)
break # Connection call did not raise exception, connection is sucessfull
except: # pylint: disable=bare-except
except Exception: # pylint: disable=broad-exception-caught
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.)
self.client.loop_start()
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()
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")
# subscribe to panelRecvTopic of each panel
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):
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
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:
queue = self.msg_out_queue_list[msg.topic]
queue.put(("MQTT:", data["CustomRecv"]))
else:
logging.debug("JSON payload on topic '%s' has no 'CustomRecv' key", msg.topic)
else:
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
logging.exception("Something went wrong during processing of message:")
logging.exception("Unexpected error while processing MQTT message on topic: %s", msg.topic)
try:
logging.error(msg.payload.decode('utf-8'))
except: # pylint: disable=bare-except
except Exception: # pylint: disable=broad-exception-caught
logging.error(
"Something went wrong when processing the exception message, couldn't decode payload to utf-8.")
def process_in_queue(self, client, msg_in_queue):
while True:
try:
msg = msg_in_queue.get()
client.publish(msg[0], msg[1])
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")

View File

@@ -105,7 +105,10 @@ class LovelaceUIPanel:
def schedule_thread_target(self):
while True:
try:
self.schedule.exec_jobs()
except Exception:
logging.exception("Scheduler execution failed for panel '%s'", self.name)
time.sleep(1)
def update_time(self):
@@ -203,6 +206,9 @@ class LovelaceUIPanel:
def customrecv_event_callback(self, msg):
logging.debug("Recv Message from NsPanel (%s): %s", self.name, msg)
msg = msg.split(",")
if len(msg) < 2:
logging.error("Malformed panel message on '%s': %s", self.name, msg)
return
# run action based on received command
if msg[0] == "event":
if msg[1] == "startup":
@@ -227,11 +233,20 @@ class LovelaceUIPanel:
if msg[1] == "renderCurrentPage":
self.render_current_page(requested=True)
if msg[1] == "buttonPress2":
if len(msg) < 4:
logging.error("Malformed buttonPress2 payload on '%s': %s", self.name, msg)
return
entity_id = msg[2]
if entity_id == "":
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
@@ -273,7 +288,13 @@ class LovelaceUIPanel:
self.render_current_page(switchPages=True)
# send ha stuff to ha
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':
card_iid = entity_id.split(".")[1]
if int(self.current_card.config.get("pin")) == int(value):
@@ -281,19 +302,33 @@ class LovelaceUIPanel:
self.current_card = self.searchCard(card_iid)
self.render_current_page(switchPages=True)
case 'mode-light':
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 _:
ha_control.handle_buttons(entity_id, btype, value)
ha_control.handle_buttons(
entity_id,
btype,
value,
action_context=action_context,
)
if msg[1] == "pageOpenDetail":
if len(msg) < 4:
logging.error("Malformed pageOpenDetail payload on '%s': %s", self.name, msg)
return
entity_id = msg[3]
effectList = None
# replace iid with real entity id
if entity_id.startswith("iid."):
iid = entity_id.split(".")[1]
for e in self.current_card.entities:
if e.iid == iid:
entity_id = e.entity_id
effectList = None
if entity_id.startswith("light"):
effectList = e.config.get("effectList")
if msg[2] == "popupInSel": #entity_id.split(".")[0] in ['input_select', 'media_player']: