Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create initial NSPanel component #2702

Draft
wants to merge 29 commits into
base: dev
Choose a base branch
from

Conversation

jesserockz
Copy link
Member

@jesserockz jesserockz commented Nov 11, 2021

This is still under development and the structure might change

What does this implement/fix?

This creates a component to communicate with and control the NSPanel default UI that is shipped with the device.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other

Related issue or feature (if applicable): closes esphome/feature-requests#1469

Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs#

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP8266

Example entry for config.yaml:

# Example config.yaml
esphome:
  name: NSPanel

esp32:
  board: esp32dev

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

time:
  - platform: homeassistant

api:

logger:

ota:

uart:
  tx_pin: 16
  rx_pin: 17
  baud_rate: 115200

external_components:
  - source: github://pr#2702
  	components: ["nspanel"]

nspanel:
  id: nspanel_id
  time_id: homeassistant_time
  temperature: temperature
  eco_mode_switch: eco_mode
  relays:
    - relay_1
    - relay_2

binary_sensor:
  - platform: gpio
    name: Left Button
    pin:
      number: 14
      inverted: true
    on_click:
      - switch.toggle: relay_1

  - platform: gpio
    name: Right Button
    pin:
      number: 27
      inverted: true
    on_click:
      - switch.toggle: relay_2

output:
  - platform: ledc
    id: buzzer_out
    pin:
      number: 21

switch:
  - platform: gpio
    name: Relay 1
    id: relay_1
    pin:
      number: 22

  - platform: gpio
    name: Relay 2
    id: relay_2
    pin:
      number: 19

  - platform: gpio
    name: Screen Power
    id: screen_power
    entity_category: config
    pin:
      number: 4
      inverted: true
    restore_mode: ALWAYS_ON

  - platform: template
    name: NSPanel Energy Saving Mode
    id: eco_mode
    entity_category: config
    restore_state: true
    optimistic: true

rtttl:
  id: buzzer
  output: buzzer_out


sensor:
  - platform: adc
    id: ntc_source
    pin: 38
    update_interval: 10s
    attenuation: 11db

  - platform: resistance
    id: resistance_sensor
    sensor: ntc_source
    configuration: DOWNSTREAM
    resistor: 11.2kOhm

  - platform: ntc
    id: temperature
    sensor: resistance_sensor
    calibration:
      b_constant: 3950
      reference_temperature: 25°C
      reference_resistance: 10kOhm
    name: "${friendly_name} Temperature"

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

@probot-esphome
Copy link

Hey there @jesserockz,
Thanks for submitting this pull request! Can you add yourself as a codeowner for this integration? This way we can notify you if a bug report for this integration is reported.
In __init__.py of the integration, please add:

CODEOWNERS = ["@jesserockz"]

And run script/build_codeowners.py

(message by NeedsCodeownersLabel)

Copy link
Contributor

@masto masto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling nit: celcius -> celsius

esphome/components/nspanel/__init__.py Outdated Show resolved Hide resolved
esphome/components/nspanel/__init__.py Outdated Show resolved Hide resolved
esphome/components/nspanel/__init__.py Outdated Show resolved Hide resolved
esphome/components/nspanel/nspanel.cpp Outdated Show resolved Hide resolved
esphome/components/nspanel/nspanel.h Outdated Show resolved Hide resolved
esphome/components/nspanel/nspanel.h Outdated Show resolved Hide resolved
Co-authored-by: Christopher Masto <chris@masto.com>
@sangtraceur
Copy link

Is it currently working? Stopped compiling firmwares when switching to current stable version of ESPH

src/esphome/components/nspanel/nspanel.cpp: In lambda function: src/esphome/components/nspanel/nspanel.cpp:100:112: error: use of deleted function 'ArduinoJson::JsonObject::JsonObject(const ArduinoJson::JsonObject&)'

@sangtraceur
Copy link

Is it currently working? Stopped compiling firmwares when switching to current stable version of ESPH

src/esphome/components/nspanel/nspanel.cpp: In lambda function: src/esphome/components/nspanel/nspanel.cpp:100:112: error: use of deleted function 'ArduinoJson::JsonObject::JsonObject(const ArduinoJson::JsonObject&)'

I verified by pulling standalone ESPH and seems to compile properly. Probbaly problem is within my homeassistant installation.
Sorry for scaring u ;)

@mbo18
Copy link
Contributor

mbo18 commented Apr 21, 2022

@jesserockz what is missing in order to merge this PR? I’m using it since month now without any issue 😃

@github-actions
Copy link
Contributor

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jul 21, 2022
@mbo18
Copy link
Contributor

mbo18 commented Jul 21, 2022

Not stale

@github-actions github-actions bot removed the stale label Jul 22, 2022
@github-actions
Copy link
Contributor

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. Thank you for your contributions.

@github-actions github-actions bot added the stale label Oct 21, 2022
@mbo18
Copy link
Contributor

mbo18 commented Oct 21, 2022

Not stale?

@github-actions github-actions bot removed the stale label Oct 22, 2022
@ssieb ssieb added the not-stale Won't go stale label Oct 24, 2022
@github-actions
Copy link
Contributor

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jan 23, 2023
@mbo18
Copy link
Contributor

mbo18 commented Jan 23, 2023

Hi @jesserockz, Will this PR be merged someday? What if it is closed? Do I have to abandon ESPHome? Thank you

@github-actions github-actions bot removed the stale label Jan 24, 2023
@monester
Copy link

I wonder is this NSPanel protocol written specifically to one device or there is more devices using it?

@jesserockz
Copy link
Member Author

Personally I ended up writing my own UI for my panels and have since moved to using that along with the standard nextion component.

Even if this PR closes, the external component will stay and I will not delete the branch.

At some point I might make a standalone repository for this, but it will stay as an external_component only. I don't have any intention of merging this PR. It was an initial stab at working with the NSPanel UI, and was never complete and needs more work to implement all the things the nspanel has.

@jesserockz jesserockz marked this pull request as draft January 25, 2023 19:26
@peetereczek
Copy link

I find my NSPanel working well with ESPHome build on that PR as external component, original and other custom UIs for nextion display are working as well. Indeed I feel that there is still place for improvement, but I belevie it can be continiued here on the PR some day.

There are some limitations, as it's not possible to use many of ESP features (like BLE) due to lack of memory, but functionality I would expect from normal NSPanel works good with HA integration.

@github-actions
Copy link
Contributor

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. Thank you for your contributions.

@github-actions github-actions bot added the stale label May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
ESPHome Dev
Needs Review
Development

Successfully merging this pull request may close these issues.

Add support for ITead's SONOFF NSPanel touchscreen display (ESP32 with custom Nextion HMI screen)?
9 participants