esphome / esphome/feature-requests

Change in Nextion integration to make more efficient use of the ESP-Home flash memory

Open
#1,696 2 comments 1 reaction 0 assignees View on GitHub
component: nextion
Dominant language
No language data
Stars
450
Forks
29
PR merge metrics
No merged PRs in 30d

Description

**Describe the problem you have/What new integration you would like**
I would like a change in the Nextion integration. The reason is that many of us can't squeeze enough in the ESP to get what we want from our displays/NS panels.
Currently adding "buttons" means you add this kind of code:

```
binary_sensor:
- platform: nextion
name: Light1
page_id: 2
component_id: 23
on_click:
- homeassistant.service:
service: light.toggle
data:
entity_id: light.light1
```

I noticed however even without this yaml the Nextion display sends a message to ESP-Home saying:
```
Got touch page=2 component=23 type=PRESS
Got touch page=2 component=23 type=RELEASE
```

What if we don't include page and component_id in the yaml and just have a "Nextion sensor" that is exposed to Home Assistant.
Perhaps a sensor with state `page=2, component=23, type=press` then release.
That way we can do all the automations in HA instead of loading the ESP full of yaml that is only button clicks.

With the above we would have one sensor that captures any "clicks". What we have today is perhaps 20 sensors just to get the buttons to work.

Another change I would love to see is a sensor with the current page number.
The reason is again to get fewer sensors in ESP-Home.

Imaging a sensor saying `page0`.
In Home Assistant we add a template sensor with an array like this:
```
array = ["page0.component0": "light.light1", "page1.component0": "sun.sun", "page3.component0": "person.someone_geocoded_location"]
{{ states(array[states('sensor.page') ~ "component0"]) }}
```

and then we add another with componenet1 for all pages.

So the above sensor will change between several states depending on the page, and I think that can be used to push the correct states to each Nextion field.

**Please describe your use case for this integration and alternatives you've tried:**
I tried using the logger and send that to Home Assistant but I could not get it to work.
I posted my test on the community page: https://community.home-assistant.io/t/sonoff-nspanel-smart-scene-wall-switch-by-itead-coming-soon-on-kickstarter/332962/623

**Additional context**

Whoever does this change will probably be a hero to all NS panel owners who is currently dreading the 68.4% limit.

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names no files or tests; start by locating the Nextion integration and reviewing the touch messages described in the report. Assess whether a single Home Assistant-exposed touch sensor and a current-page sensor can replace per-button YAML while reducing ESPHome flash use. Done means the requested events and page state are available for Home Assistant automations with less configuration overhead.

Written by the indexing model from the issue text.

Assessment

Domain
embedded-iot
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.