Closed Hedda closed 6 months ago
I am backing the NSPanel so hope to get one ASAP, but without it in front of me I cannot make any assumptions about how it works. I have seen the IO pinout and actually spent an hour or 2 looking at the fcc pictures and had all of the pins listed right before they posted that update on kickstarter :man_facepalming:
@jesserockz Suggest that you write a short mail to "Jeri Shi" jerry.shi@itead.cc, "Stan Li" Stan.li@itead.cc, and "Daniel Zhan" daniel.zhan@itead.cc telling them who you are and ask them nicely if they would be willing to send you a prototype or preview sample unit in advance of them shipping general availability of the Kickstarter early-bird units, maybe even be so bold and ask them to also send some units to your fellow ESPHome and Home Assistant core developers. I am sure that they would appreciate it if some of the popular open-source firmware projects could already support it before it gets shipped to end-users.
I will do just that @Hedda. Thanks =)
FYI, Tasmota developer blakadder now discovered that SONOFF NSPanel uses Nextion Discovery 3.5” NX4832F035 screen type part:
https://nextion.tech/datasheets/nx4832f035/
NX4832F035 Nextion 3.5″ Discovery Series HMI Touch Display can be purchased as a separate unit directly from ITead for $29.90 (US) if need it for development or want to test it in an ESP32 DIY project:
https://itead.cc/product/nx4832f035-nextion-3-5-discovery-series-hmi-touch-display/
blakadder (in Tasmota discussions): "With this discovery we confirm it is possible to upload custom GUI created in Nextion Editor."
https://nextion.tech/nextion-editor/#_section1
blakadder has posted updated information on his findings here:
https://blakadder.com/nspanel-teardown/
Note that the main PCB is marked with “E32-MSW-NX” and “NSPanel-EU” if you open it.
and specific flashing instructions here:
https://templates.blakadder.com/sonoff_NSPanel.html
and looks like he is also planning on posting code here:
https://github.com/blakadder/nspanel
blakadder wrote: I’ve also successfully decoded most of the NSPanel custom protocol, just need to figure out why the touch function stops working when doing some actions. Here’s a list of objects pulled by a nice tool coded by MaxZ from Nextion Unoffficial Discord:
https://gist.github.com/blakadder/7928279bd95ad47b54f705b7a121a7e1
Again, more discussion here on Home Assistant community forum:
Over at the https://unofficialnextion.com/t/welcome-to-the-unofficial-nextion-tjc-user-forum/8 we’ve been making some discoveries:
Also ESPhome only sends the connect command to the Nextion. That doesn’t work because the NSPanel is in Protocol Reparse mode. You need to send the full escape sequence from the Nextion Upload Protocol v1.1 1 instead to exit Protocol Reparse mode.
You need to have GPIO4 pulled low so the screen boots. Then send the escape reparse mode string DRAKJHSUYDGBNCJHGJKSHBDNÿÿÿ and you can use all standard nextion commands.
https://gist.github.com/blakadder/7928279bd95ad47b54f705b7a121a7e1
Although not locked down to Nextion, but: https://haswitchplate.github.io/openHASP-docs
Although not locked down to Nextion, but: https://haswitchplate.github.io/openHASP-docs
blakadder (who now managed to get Sonoff NSPanel display working with Tasmota) said that openHASP can't be reused for this:
https://github.com/arendst/Tasmota/discussions/13347
"Nextion screens have a different design philosophy and will not work with LVGL and therefore openHASP"
blakadder continuously keeps updating his findings both on a few web-pages and in this GitHub repo:
https://blakadder.com/nspanel-teardown/
https://templates.blakadder.com/sonoff_NSPanel.html
https://github.com/blakadder/nspanel
https://blakadder.github.io/nspanel/
https://gist.github.com/blakadder/7928279bd95ad47b54f705b7a121a7e1
As noted it does not use standard Nextion so they reference Nextion Instruction Set and the Nextion HMI Project Upload Protocol:
https://nextion.tech/instruction-set/
https://nextion.tech/2017/12/08/nextion-hmi-upload-protocol-v1-1/
Again, the community at the unofficial Nextion/TJC chat room on Discord has made most of the discoveries about this display:
https://unofficialnextion.com/t/welcome-to-the-unofficial-nextion-tjc-user-forum/8
FYI, blakadder now said that he is trying to replicate the original default firmware but using MQTT to be able to integrate it in HA.
Everything neatly laid out here for hacking it and configuring Tasmota and blakadder said will be updated as support progresses:
https://templates.blakadder.com/sonoff_NSPanel
Michel from espthings.io also updated his teardown and test of flashing ESPHome:
https://www.espthings.io/index.php/2021/10/10/sonoff-nspanel-first-impressions/
Again, also be sure to check out this teardown as an introduction to the hardware:
@Hedda https://twitter.com/Jesserockz/status/1457415401743126530 =)
Awesome stuff! Will keep an eye on https://github.com/esphome/esphome/pull/2702 and your Twitter while waiting for ITead to ship Sonoff NSPanel!
@jesserockz Thank you so much for this component! It seems that weather data are not currently supported (YAML part missing form my understanding). Do you plan to finish the NSPanel support for next release?
I've flashed my NSPanel with jesserockz's code and it's working pretty fine. I've found how to declare widgets in the YAML configuration. It's clear that "devices" are not currently supported but "groups" are. Regarding "devices", "CURTAIN: 11" is missing in the code. Regarding groups, I think that I found bugs when using multi-switch (2 ou 3 or 4):
For example, with this code:
- type: group
name: Salon
uiid: SWITCH_VERTICAL_TRIPLE
items:
- name: "Open"
on_click:
- homeassistant.service:
service: cover.open_cover
data:
entity_id: cover.salon_volet_roulant
- name: "Close"
on_click:
- homeassistant.service:
service: cover.close_cover
data:
entity_id: cover.salon_volet_roulant
- name: "STOP"
on_click:
- homeassistant.service:
service: cover.stop_cover
data:
entity_id: cover.salon_volet_roulant
If I click on OUTLET1 or 2 or 3, only the last on_click action is triggered, here it is cover.stop_cover
When trying to compile with Jesse's code, I'm getting the error below. Any idea what can be wrong?
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
Dependency Graph
|-- <AsyncTCP-esphome> 1.2.2
|-- <WiFi> 1.0
|-- <FS> 1.0
|-- <Update> 1.0
|-- <ESPAsyncWebServer-esphome> 2.1.0
| |-- <AsyncTCP-esphome> 1.2.2
|-- <DNSServer> 1.1.0
|-- <ArduinoJson-esphomelib> 5.13.3
|-- <ESPmDNS> 1.0
Compiling /data/sonoff-nspanel1/.pioenvs/sonoff-nspanel1/src/esphome/components/nspanel/nspanel.cpp.o
Compiling /data/sonoff-nspanel1/.pioenvs/sonoff-nspanel1/src/esphome/components/text_sensor/text_sensor.cpp.o
Compiling /data/sonoff-nspanel1/.pioenvs/sonoff-nspanel1/src/esphome/components/time/automation.cpp.o
Compiling /data/sonoff-nspanel1/.pioenvs/sonoff-nspanel1/src/esphome/components/time/real_time_clock.cpp.o
In file included from src/esphome/components/sensor/sensor.h:3:0,
from src/esphome/components/nspanel/nspanel.h:6,
from src/esphome/components/nspanel/nspanel.cpp:1:
src/esphome/components/nspanel/nspanel.cpp: In member function 'bool esphome::nspanel::NSPanel::process_data_()':
src/esphome/components/nspanel/nspanel.cpp:99:50: error: 'format_hex_pretty' was not declared in this scope
format_hex_pretty(message_data, length).c_str());
^
src/esphome/core/log.h:95:89: note: in definition of macro 'esph_log_d'
esp_log_printf_(ESPHOME_LOG_LEVEL_DEBUG, tag, __LINE__, ESPHOME_LOG_FORMAT(format), ##__VA_ARGS__)
^
src/esphome/components/nspanel/nspanel.cpp:98:3: note: in expansion of macro 'ESP_LOGD'
ESP_LOGD(TAG, "Received NSPanel: Type=0x%02X PAYLOAD=%s RAW=[%s]", type, message.c_str(),
^
Compiling /data/sonoff-nspanel1/.pioenvs/sonoff-nspanel1/src/esphome/components/uart/uart.cpp.o
Compiling /data/sonoff-nspanel1/.pioenvs/sonoff-nspanel1/src/esphome/components/uart/uart_component.cpp.o
Compiling /data/sonoff-nspanel1/.pioenvs/sonoff-nspanel1/src/esphome/components/uart/uart_component_esp32_arduino.cpp.o
*** [/data/sonoff-nspanel1/.pioenvs/sonoff-nspanel1/src/esphome/components/nspanel/nspanel.cpp.o] Error 1
========================= [FAILED] Took 12.08 seconds =========================
On ESPHome 2021.12.1, I'm seeing a similar error on compilation as what @TyzzyT is getting:
Processing nspanel (board: esp32dev; framework: arduino; platform: platformio/espressif32 @ 3.3.2)
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
Dependency Graph
|-- <WiFi> 1.0
|-- <Update> 1.0
|-- <ArduinoJson-esphomelib> 5.13.3
|-- <ESPmDNS> 1.0
Compiling /data/nspanel/.pioenvs/nspanel/src/esphome/components/nspanel/nspanel.cpp.o
Compiling /data/nspanel/.pioenvs/nspanel/src/esphome/components/output/automation.cpp.o
Compiling /data/nspanel/.pioenvs/nspanel/src/esphome/components/output/float_output.cpp.o
Compiling /data/nspanel/.pioenvs/nspanel/src/esphome/components/resistance/resistance_sensor.cpp.o
Compiling /data/nspanel/.pioenvs/nspanel/src/esphome/components/rtttl/rtttl.cpp.o
Compiling /data/nspanel/.pioenvs/nspanel/src/esphome/components/sensor/automation.cpp.o
Compiling /data/nspanel/.pioenvs/nspanel/src/esphome/components/sensor/filter.cpp.o
In file included from src/esphome/components/sensor/sensor.h:3:0,
from src/esphome/components/nspanel/nspanel.h:6,
from src/esphome/components/nspanel/nspanel.cpp:1:
src/esphome/components/nspanel/nspanel.cpp: In member function 'bool esphome::nspanel::NSPanel::process_data_()':
src/esphome/components/nspanel/nspanel.cpp:99:50: error: 'format_hex_pretty' was not declared in this scope
format_hex_pretty(message_data, length).c_str());
^
src/esphome/core/log.h:95:89: note: in definition of macro 'esph_log_d'
esp_log_printf_(ESPHOME_LOG_LEVEL_DEBUG, tag, __LINE__, ESPHOME_LOG_FORMAT(format), ##__VA_ARGS__)
^
src/esphome/components/nspanel/nspanel.cpp:98:3: note: in expansion of macro 'ESP_LOGD'
ESP_LOGD(TAG, "Received NSPanel: Type=0x%02X PAYLOAD=%s RAW=[%s]", type, message.c_str(),
^
*** [/data/nspanel/.pioenvs/nspanel/src/esphome/components/nspanel/nspanel.cpp.o] Error 1
========================== [FAILED] Took 3.15 seconds ==========================
The yaml config I used is available here.
EDIT: It compiled fine using the dev release of ESPHome.
Yeah I'm not alone using ESPHome with a NSPanel 👍 You need to comment those 2 lines. Using (for example) VSCode or File Editor add-on, go to config/esphome/.esphome/external_components/8d2a6156/esphome/components/nspanel/nspanel.cpp and comment line 98 and 99 by adding //:
// ESP_LOGD(TAG, "Received NSPanel: Type=0x%02X PAYLOAD=%s RAW=[%s]", type, message.c_str(),
// format_hex_pretty(message_data, length).c_str());
Also, you need to change 1 thing in your YAML:
- platform: gpio
name: "$devicename Screen Power"
id: screen_power
entity_category: config
pin:
number: 4
inverted: true
restore_mode: ALWAYS_OFF
Restore Mode for the screen power switch must now be set to ALWAYS_OFF
Hey @mbo18, I've managed to flash the panel with ESPHome, thank you very much for your help. Where do you define the widgets as you described? I tried something like the code below, but that doesn't work.
nspanel:
id: nspanel_id
time_id: homeassistant_time
temperature: temperature
eco_mode_switch: eco_mode
screen_power_switch: screen_power
relays:
- relay_1
- relay_2
- type: group
name: Group1
uiid: SWITCH_VERTICAL_SINGLE
items:
- name: "Toggle"
on_click:
- homeassistant.service:
service: light.toggle
data:
entity_id: light.christmas_tree
Currently we can only use scene or empty. Here is my code:
nspanel:
id: nspanel_id
time_id: current_time
temperature: temperature
screen_power_switch: screen_power
eco_mode_switch: eco_mode
relays:
- relay_1
- relay_2
widgets:
- type: scene
name: LEntrée
on_click:
- homeassistant.service:
service: light.toggle
data:
entity_id: light.entree_bulb
- type: empty
- type: empty
- type: empty
- type: empty
- type: empty
- type: empty
- type: empty
Thanks @mbo18, you're the best! This is working for me.
Is there any support for changing the orientation of the screen yet? I have the portrait-orientation NSPanel but it displays landscape.
That’s in NSPanel settings and not in ESPHome I think. Slide your finger from the top of the screen to the bottom
I can't get mine to register when I try to change orientation. I see the option to do it.
I can’t help you, this option does not exist in the EU version
@mkaatman When I tapped the option for orientation, nothing changed on-screen. However, after power cycling, it appeared with the orientation I had selected.
That was it. I must have done the old triple tap prior. Now how do you get Fahrenheit to stick?
Under nspanel:
set temperature_unit_celcius
to false:
temperature_unit_celcius: false
Sorry, still catching up on Github notifications.
Great to see people are receiving their NSPanels and using ESPHome on them :heart:
A few things:
__init__.py
file
Outlet 1/2/etc
format_hex_pretty
is only in dev
and therefore either you need to use dev, or comment out the lines as @mbo18 has done.Please do keep sending in your issues/feedback and I will try to make this work the best I can.
Jesse
Hi @jesserockz! thanks for working on this. I'm just wondering how you will implement the weather part, switches (group) and devices. Do you already have worked on something? Regarding weather:
homeassistant
platform?)
Something like:
nspanel:
...
weather_entity: weather.home
nspanel:
...
weather:
temperature:
temp_min:
temp_max:
icon:
which will be sensors form HA:
sensor:
- platform: homeassistant
entity_id: sensor.weatherhome_temperature
id: outdoor_temp
internal: true
- platform: homeassistant
entity_id: sensor.weatherhome_min_temp_0
id: outdoor_temp_min
internal: true
- platform: homeassistant
entity_id: sensor.weatherhome_max_temp_0
id: outdoor_temp_max
internal: true
text_sensor:
- platform: homeassistant
entity_id: weather.home
id: outdoor_icon
internal: true
filters: # mapping done directly by the component?
- map:
- clear-night -> CLOUD_BLUE
- cloudy -> SUN_CLOUD
- exceptional -> RED_THERMOSTAT
- fog -> CLOUD_FOG
- hail -> CLOUD_ICE_CRYSTALS
- lightning -> CLOUD_RAIN_LIGHTNING
- lightning-rainy -> CLOUD_RAIN_LIGHTNING
- partlycloudy -> SUN_CLOUD
- pouring -> CLOUD_RAIN
- rainy -> CLOUD_RAIN
- snowy -> CLOUD_SNOWFLAKES
- snowy-rainy -> CLOUD_RAIN_SNOW
- sunny -> SUNNY
- windy -> WIND
- windy-variant -> WIND
Regarding devices, do you plan to add homeassistant
platform to light, climate and cover?
And finally, regarding groups, a binary sensor and a switch sensor per HA light or switch could do the job? like:
binary_sensor:
- platform: homeassistant
id: light1_state
entity_id: light.entree_bulb
internal: true
switch:
- platform: template
id: light1_switch
internal: true
lambda: |-
if (id(light1_state).state) {
return true;
} else {
return false;
}
turn_on_action:
- homeassistant.service:
service: light.turn_on
data:
entity_id: light.entree_bulb
turn_off_action:
- homeassistant.service:
service: light.turn_off
data:
entity_id: light.entree_bulb
then NSPanel group's state and action could come from the switch template. The configuration could look like:
- type: group
name: Light 1
uiid: SWITCH_VERTICAL
items:
- name: "Light 1"
switch: light1_switch
@mbo18 Ah something I added in my local config, but not in the PR for weather:
api:
services:
- service: weather_data
variables:
icon: int
temperature: int
min: int
max: int
then:
- lambda: id(nspanel_id).send_weather_data((nspanel::WeatherIcon)icon, temperature, min, max);
The icons list is here: https://github.com/esphome/esphome/pull/2702/files#diff-90cb7313b616f9d6e69e3358d14b0325f04255d8e84891a20431dd5eb57a7543R17-R32
- Or you can ask for different sensors like:
nspanel: ... weather: temperature: temp_min: temp_max: icon:
I do like this approach and I think that might work nicely.
Regarding devices, do you plan to add
homeassistant
platform to light, climate and cover?
Not anytime soon, that will be a big task in itself.
And finally, regarding groups, a binary sensor and a switch sensor per HA light or switch could do the job? like:
I had done something similar although skipped the template switch and just set the group item state directly from the homeassistant
binary_sensor
and then used a trigger on the group item to call the ha service directly.
For the light devices
though I was thinking ESPHome might need a homeassistant
platform for light, which is why I disabled it completely for now.
@jesserockz
Ah something I added in my local config, but not in the PR for weather:
Nice but that needs an automation in HA that runs every X minutes to stay updated
I do like this approach and I think that might work nicely
I think that it should be easier :) with the mapping between HA weather states and NSPanel icons done in the component
I had done something similar although skipped the template switch and just set the group item state directly from the
homeassistant
binary_sensor
and then used a trigger on the group item to call the ha service directly.
Ok
For the light
devices
though I was thinking ESPHome might need ahomeassistant
platform for light, which is why I disabled it completely for now.
Yes that would be great but a lot of work right? So we may have scene, group and weather working in the future but device support will need more work to be done and not only to the NSPanel component?
I have weather working fine now, thanks for the info about the service 👍
I have pushed a commit to the PR that should fix the compile issues with the format_hex_pretty lines.
I added lines 98 and 99 of nspanel.cpp file again and can confirm that compiling with ESPHome stable version is working now.
@jesserockz Thank you for the fantastic work on getting nsswitch panel into esphome! I am impressed that I can directly flash esphome on a brand new device without having to use Sonoff's firmware. I have the basic functionality setup, and I am trying to tweak it for my use case. I have a couple of questions. This is the first time I am trying to use esphome for a more complex application, and my unfamiliarity is probably showing.
# Enable Home Assistant API
api:
password: !secret api_pw
services:
- service: weather_data
variables:
icon: int
temperature: int
min: int
max: int
then:
- lambda: id(nspanel_id).send_weather_data((nspanel::WeatherIcon)icon, temperature, min, max);
nspanel:
relays:
- demo_switch_1
- demo_switch_2
Later in the config, I can use the config from binary_light to control the actual light. This seems hacky, so I was wondering if I am missing something obvious.
This is my HA automation for the weather data:
- alias: Send Weather to NSPanel
id: Send Weather to NSPanel
initial_state: true
trigger:
- platform: state
entity_id: weather.home
attribute: temperature
condition:
- condition: state
entity_id: binary_sensor.nspanel_status
state: "on"
action:
- service: esphome.nspanel_weather_data
data:
icon: >-
{% set weather = states('weather.home') %}
{% if weather == 'clear-night' %} {{ 1|int }}
{% elif weather == 'cloudy' %} {{ 2|int }}
{% elif weather == 'exceptionnal' %} {{ 30|int }}
{% elif weather == 'fog' %} {{ 11|int }}
{% elif weather == 'hail' %} {{ 24|int }}
{% elif weather == 'lightning' %} {{ 15|int }}
{% elif weather == 'lightning-rainy' %} {{ 15|int }}
{% elif weather == 'partlycloudy' %} {{ 2|int }}
{% elif weather == 'pouring' %} {{ 12|int }}
{% elif weather == 'rainy' %} {{ 12|int }}
{% elif weather == 'snowy' %} {{ 20|int }}
{% elif weather == 'snowy-rainy' %} {{ 29|int }}
{% elif weather == 'sunny' %} {{ 1|int }}
{% elif weather == 'windy' %} {{ 32|int }}
{% elif weather == 'windy-variant' %} {{ 32|int }}
{% endif %}
temperature: "{{ state_attr('weather.home', 'temperature') }}"
min: "{{ state_attr('weather.home', 'forecast')[0].templow }}"
max: "{{ state_attr('weather.home', 'forecast')[0].temperature }}"
with weather.home
your weather entity and esphome.nspanel_weather_data
the service that has be created in HA.
Regarding the light, you can change the switch to a light in HA instead of ESPHome with this integration: https://www.home-assistant.io/integrations/light.switch/
@mbo18 Thank you so much for the pointers for both items. I think I have everything needed to continue tweaking my yaml. Merry Christmas!
hi i'm having this issue when using the code from @jesserockz code.
any ideas?
Delete all the spaces on line 29 (\t is a tab, which is invalid per YAML spec) and then add the spaces back with your space bar. That should clean it up.
@nightweyr Good point there, I will look into making it work with light
s too as I guess it will most likely be replacing dumb light switches.
Hey folks! Thanks so much for all of your work on this. I just got one of my NSPanels flashed this morning!
For context, I have 2x NSPanels, both are US vertical versions.
I tried setting the temp to F using temperature_unit_celcius: false
, and the C changed to an F, but the temperature remained the same (e.g. without temperature_unit_celcius: false
it shows 22 C and with temperature_unit_celcius: false
it shows 22 F). In the HA entity, it correctly shows ~73 F.
Any ideas on how to convert the temp correctly?
Is there a reference yaml configuration you guys are starting with? I finally flashed today and I'm in a boot loop. Trying to troubleshoot now.
Hey folks! Thanks so much for all of your work on this. I just got one of my NSPanels flashed this morning!
For context, I have 2x NSPanels, both are US vertical versions.
I too have two US NSpanels. Mind sharing the the yaml you used?
I too have two US NSpanels. Mind sharing the the yaml you used?
Here's what I have so far. Note that I set the IP address manually, so you'd need to change that if you want to set a static IP.
I had first flashed Tasmota onto mine, then decided to flash ESPHome. To do that, I had to download the config from ESPHome and flash using ESP-Flasher. After that, I've been able to flash wirelessly.
esphome:
name: bathroom-switch
esp32:
board: esp32dev
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
# Set this to the IP of the ESP
static_ip: 33.0.40.229
# Set this to the IP address of the router. Often ends with .1
gateway: 33.0.40.1
# The subnet of the network. 255.255.255.0 works for most home networks.
subnet: 255.255.255.0
time:
- platform: homeassistant
api:
services:
- service: weather_data
variables:
icon: int
temperature: int
min: int
max: int
then:
- lambda: id(nspanel_id).send_weather_data((nspanel::WeatherIcon)icon, temperature, min, max);
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:
temperature: temperature
eco_mode_switch: eco_mode
screen_power_switch: screen_power
temperature_unit_celcius: false
relays:
- relay_1
- relay_2
widgets:
- type: scene
name: MC
on_click:
- homeassistant.service:
service: light.toggle
data:
entity_id: light.mission_control_lights
- type: empty
- type: empty
- type: empty
- type: empty
- type: empty
- type: empty
- type: empty
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: "Bathroom Switch Temperature"
This is my HA automation for the weather data:
@mbo18 Thanks for this automation! I tried setting it up in my HA, but I can't figure out what service to use. There doesn't appear to be any esphome.***
services available. Am I missing a step to create that service?
EDIT:
Nevermind, I found the ESPHome documentation for user-defined services. I've updated my automation to use esphome.bathroom_switch_weather_data
and it's now working.
@queerdo your yaml is working for me. I'm having the degrees C issue as well.
@queerdo use a filter on the temp sensor to convert it to F
@jesserockz excellent, thanks! That did the trick:
EDIT: I realized that just adding the filter made the temp appear correct on the display, but in the HA entity it showed ~160F cause it still thought it was reporting in C and then converting to F. Adding unit_of_measurement: "°F"
in the ESPHome config fixes that though.
- platform: ntc
id: temperature
sensor: resistance_sensor
calibration:
b_constant: 3950
reference_temperature: 25°C
reference_resistance: 10kOhm
name: "Entry Switch Temperature"
unit_of_measurement: "°F"
filters:
- lambda: return x * (9.0/5.0) + 32.0;
Later in the config, I can use the config from binary_light to control the actual light. This seems hacky, so I was wondering if I am missing something obvious.
@nightweyr I may be misunderstanding what you're trying to do here - if it's getting the relay to show up as a light in HA then that's already been covered. However, if you're trying to get the physical buttons to control another entity besides the relays, then this may help.
I removed the on_click
lines from both binary_sensor entries so that they aren't tied to the relays. This way, the buttons are standalone entities that show up in HA that can then be used in automations to control whatever you'd like.
binary_sensor:
- platform: gpio
name: Left Button
pin:
number: 14
inverted: true
- platform: gpio
name: Right Button
pin:
number: 27
inverted: true
@queerdo @mkaatman with latest code, GPIO restore mode for screen power must be off:
- platform: gpio
name: Screen Power
id: screen_power
entity_category: config
pin:
number: 4
inverted: true
restore_mode: ALWAYS_OFF
Just ordered one!
Cannot wait for it to arrive.
@mbo18
Still learning how everything works. Does the latest code get pulled every time we build?
Describe the problem you have/What new integration you would like
Request support in ESPHome for SONOFF NSPanel touchscreen display by ITead = ESP32 based with custom Nextion HMI screen:
https://itead.cc/product/sonoff-nspanel-smart-scene-wall-switch/
It is listed at MSRP $74.90 but early-bird version is currently sold via this Kickstarter campaign for around $54 each or $99 for two:
https://www.kickstarter.com/projects/sonoffnspanel/sonoff-nspanel-smart-scene-wall-switch/
A lot of information had already leaked via its FCC certification (FCC ID 2APN5NSPANEL):
https://fccid.io/2APN5NSPANEL
https://fccid.io/2APN5NSPANEL/User-Manual/User-Manual-5481421.pdf
https://fccid.io/2APN5NSPANEL/External-Photos/External-Photos-5481413.pdf
https://fccid.io/2APN5NSPANEL/Internal-Photos/Internal-Photos-5481415.pdf
https://fccid.io/2APN5NSPANEL/Label/ID-Label-and-Label-Location-5481414.pdf
Many tech review bloggers/vloggers who received preview prototype units seem to complain about its lack of integrated motion sensor for presence detection so can automatically turn on the screen backlighting, (and I like to also add the request for its DS18B20 temperature-only sensor to be replaced with a DHT22, AM2301, or Si7021 temperature and humidity combo sensor).
https://www.youtube.com/watch?v=cGXJnzS7D9g
https://www.youtube.com/watch?v=hQZk3MKJXzI
https://www.youtube.com/watch?v=vg_Jq4Y9b_s
https://www.youtube.com/watch?v=vg_Jq4Y9b_s
https://www.youtube.com/watch?v=DUvWwtvtd6k
Looks like a model each for Europe and North America; “NSPanel-EU” and “NSPanel-US”. It also contains a temperature + humidity sensor and two integrated low-amp relays for 220V/300W or 110V/150W capacity respectively, but the point is really for it to act as remote control of scenes and running widgets (local applications or scripts) such as for example an HVAC thermostat.
As I understand all Nextion displays as their own integrated microcontroller unit (STM32GO ARM Cortex-M0+ 64MHz Onboard MCU Processor) so that will off-load most of the heavy lifting work and all text and graphics, animations, etc. are created using Nextion Editor software, and then then the project files/assets are uploaded directly into the Nextion screen. The screen then has serial commands mapped to UI elements and can be sent and received from ESPHome firmware to control it.
There is some interesting discussions on the Home Assistant community forum about hacking it with ESPHome and/or Tasmota:
https://community.home-assistant.io/t/sonoff-nspanel-smart-scene-wall-switch-by-itead-coming-soon-on-kickstarter/332962/
HA-TB303 and blakadder are two that have especially connected a lot of information about the internal workings of these:
https://espthings.io/nspanel
https://blakadder.com/nspanel-teardown/
Also, the community at the unofficial Nextion/TJC chat room on Discord have been making some discoveries about its display:
https://unofficialnextion.com/t/welcome-to-the-unofficial-nextion-tjc-user-forum/8
The first thing they discovered it that has practically been designed it to be hacked and flashed with third-party firmware. Especially when taking into consideration that Efuses are not burned and pin headers on the board are easy to use for a solderless flash.
The information so far is that it does not use the protocol that ESPHome support for Nextion HMI but instead a custom protocol:
Nextion HMI Project Upload Protocol specifications:
https://nextion.tech/2017/12/08/nextion-hmi-upload-protocol-v1-1/
ITead has also posted specific IO (Input-Output) definition documention for Sonoff NSPanel in a new Kickstarter campaign update:
Please describe your use case for this integration and alternatives you've tried:
Additional context