How to make a Sonoff NSPanel turn off the screen when you're not using it
Тәжірибелік нұсқаулар және стиль
See the pinned comment from fpv.darkt.im below for what might be a much easier way: • How to make a Sonoff N...
Automatic sleep mode doesn't seem to work on the Sonoff NSPanel. Here's how to fake it with a timer and some Nextion Editor hackery. Links below:
00:00 Introduction
00:57 3D Printed Stands
02:53 The Problem
03:37 Setting Things Up
07:38 Adding the Timer
09:00 Wake Button Hackery
13:40 Keeping it Awake
15:14 Saving and Restoring Brightness
17:24 Testing it Out
18:04 Almost Perfect
19:04 The Final Test
20:20 Outro
🔗 Useful links 🔗
‣ Community Wiki: github.com/masto/NSPanel-Demo...
‣ Sonoff NSPanel: amzn.to/34fqZ5y
‣ USB to TTL adapter: amzn.to/3qHKdZa
✓ Sample files
‣ My demo YAML and HMI files: github.com/masto/NSPanel-Demo...
‣ 3D Printed Stands: www.thingiverse.com/thing:518...
✓ Software
‣ Home Assistant: home-assistant.io
‣ ESPHome: esphome.io
‣ Nextion Editor: nextion.tech/nextion-editor/
‣ OpenHASP: haswitchplate.github.io/openH...
✓ Touch Displays
‣ Sonoff NSPanel (US model): amzn.to/34fqZ5y
‣ Lanbon L8 (US model): amzn.to/3sV8w8N
‣ HA SwitchPlate HASPone: github.com/HASwitchPlate/HASPone
✓ Tools and equipment
‣ USB to TTL adapter: amzn.to/3qHKdZa
‣ Breadboard alligator clip jumpers: amzn.to/3HpU6kX
‣ Dupont jumpers: amzn.to/3zfr2JS
‣ Pin headers: amzn.to/3sQAHpk
‣ 4-pin I2C cables: amzn.to/3JworA5
‣ Assorted Dupont connectors: amzn.to/3mNOg52
‣ Crimp tool for Dupont connectors: amzn.to/3Hn2TE6
‣ Silicone wires (convenient for bench testing): amzn.to/3Hpr1pG
‣ Ferrules: amzn.to/3mO13UU
‣ Hex crimper for ferrules: amzn.to/32QlJ7G
‣ WAGO wire connectors: amzn.to/3ELDke8
‣ Precision screwdriver set: amzn.to/3FM5w1L
‣ Cliff Quicktest (US model): amzn.to/3zic85B or www.newark.com/cliff-electron...
Пікірлер: 61
Hi, just a tip: the display supports a wake-up. Just set "id(disp1).set_auto_wake_on_touch(true);" in the display section - so you can reduce some of the mentioned hackery ;)
@fpvdarktim
2 жыл бұрын
And you can use "id(disp1).sleep(1);" to send it to sleep instead of utilizing the brightness.
@ChrisMasto
2 жыл бұрын
@@fpvdarktim Thanks! I explored that option, but I ran into some problems with interactions between ESPHome and the Nextion in sleep mode. But your comment got me to look at the documentation again and now I see that there is a sleep() API method (esphome.io/api/classesphome_1_1nextion_1_1_nextion.html#a79a8ba02e23cacd7f3270ff72f8e6f8a). I have been doing things the hard way for no reason, once again. 🙂
@gertgaljoen2209
2 жыл бұрын
@@ChrisMasto You mention the 'non-working' thsp... Did you put in the editor, this 2 next lines in the page0 / Postinitialize Event? thsp=120 //Sleep on No Touch thup=1 //Auto Wake on Touch
@ChrisMasto
2 жыл бұрын
@@gertgaljoen2209 Yes. As far as I know, nobody has had any success with thsp. It just stays awake. There are also issues with sendxy not working as expected. The best guess I've heard is that it might be related to these being a custom order of capacitive touch screens instead of resistive for this product, and maybe they didn't get everything hooked up properly.
@DustinWill
2 жыл бұрын
@@ChrisMasto Same with almost everything I do. Do it the hard way first and learn a lot more along the way!
Thank you for the effort doing these easy to understand videos. Easy to catch up on the progress with this Panel. Keep up the good work! Greetings from Denmark.
thank you for your work on these panels. It is much appreciated and hope you continue to tinker!
great vid , calm about my pace so i can follow along and understand ,just waiting for my usb to serial to try it all out ,keep up the good work
Very comprehensive, thank you Christopher, great work and great video
Great video. I love how you explain your thinking in solving a problem.
Finally got mine from the kickstarte today, this video save me hours of work. Thanks Now i'm spending all my time trying to work out how to get a slider value from the display to Home Assistant
Blown Away! Excellent work!
Possibly my new favorite Home Assistant KZreadr... keep stuff like this coming, please! Subscription definitely earned.
Thank you for this videos...very helpful...figured out my issue...keep it up
VERY useful! That send command thing is great. I just have a node-red flow that detects motion as it's in an area with a motion detector anyway. I've just got it calling the click wake_button,0 in the flow and it works perfectly.
Another awesome video with a tons of good inspirations!
The video was great. I’m learning along with you. Today I was working on how to swipe between pages. I wasn’t able to find any good resources. If you are able to figure it out, I’m sure the community would appreciate another video. Keep up the good work!!
@ChrisMasto
2 жыл бұрын
There's a link on the Wiki with a pointer to one solution: github.com/masto/NSPanel-Demo-Files/wiki/HowTo. I haven't tried to do this yet personally.
@jeffreyanderson02
2 жыл бұрын
@@ChrisMasto Thank you. I tried the link earlier, but I think it is to a discord server I don’t have access to.
Thank you for sharing this! Very cool :)
great video !!! it's very usefull. Thanks!
Another great video. 👍
amazing! thankyou!
Another great video, Christopher! Thanks. Can't you tell the timer event to go back to page 1 after dimming and before enabling the button? That would save you from adding more invisible buttons.
While not Nextion, for a different project I was able to define a blank screen (equivalent of your wake button). Then when it went to sleep it moved to that sleep screen, and turned off the backlight. When it woke up, it then either restored to where it was, or went back to the home screen. If that is possible via the commands that would be how I'd likely do it. Would solve your wake button on top of the other buttons issue on the HMI editor.
Using touch cap you can drop the button. Alternatively you could create a "dimmed" page, and switch to it on timeout.
Oh wow, I just read the "auto wake on touch" comment. That changes everything. If that's the case, then I would see if you can have it wake on the home screen every wake event. That way if it goes to sleep on a different page, it will wake up on the home screen.
@ChrisMasto
2 жыл бұрын
Yup, that's what it does by default, and it's covered in the next video.
Thanks!
It would be nice if the dim down happened gradually. Not that you usually stand there watching it when it goes off, but still. Have 3-4 dim levels in between just to show "I'm about to go off".
@barrymcardle7771
2 жыл бұрын
Was about to add that to the comments. Would be great to have the last 5seconds at a very low dim so you get an idea it's about to turn off.
I’m really hoping someone builds a snap in adaptor board and mount for the neat connector on the back to convert them to either USB, Battery or POE, as we have super strict electrical codes here in Australia which won’t let us wire these in directly without an electrician or a signed off Australian compliance for the unit. If I can make them Power off an alternate power source without a bunch of loose wires hanging off it, I’d be much more likely to adopt them for my use. (Would also be amazing if you could trigger flash mode as well off a potential usb board, making it completely smooth and user proof)
I like the pace and format of the videos. My only suggestion, my personal preference is for face time. Maybe just a little during the recap/intro first couple minutes, but I really prefer to put a face to a name/personality. Nothing to hide here in a public domain. :)
Great tutorial! I'm definitely going to implement this sleep method. I found you can send the command sleep=1 and it works, but you can't update the screen when it is in sleep mode, so you have to update all info after waking which is not very nice
@ChrisMasto
2 жыл бұрын
That may be one of the few advantages of doing it this way :-) Regarding sleep, check out the top comment. When I have time, I'm going to do a proper update, but it looks like calling `id(disp1).sleep(1)` and `.sleep(0)` should properly sleep and wake the screen, so combined with an on_wake: handler that triggers the needed updates, it might just be a much cleaner approach.
@Ballanux
2 жыл бұрын
@@ChrisMasto Depends on what you want to show with "on_wake", for me it takes several seconds to update the temperatures and weather, so I think I will the brightness trick
Yep subscribed
Thanks once again do you have any ideas on implementing a colour picker for WLED ?
Would be nice to check on the hardware buttons if they wake up the screen or do their „normal“ operation. Not sure if it is possible to query the dim state from esphome and use it in templates there.
what is the power supply you show on the 3d print instructions...looks like a handy thing...especially if you have multiple NSPanels
Off topic: is there a way to upload images for buttons, background etc to make that UI more pleasant? Also, I would make the screen barely visible, not blank, so you know the stance of the buttons at a glance without interaction. Burn-in really does not matter, unless you want this for 20 years span :)
instead of the button, just use a blank page to clear out the screen, and for detecting the touch event use the TouchCap component when the TouchCap component detects an interaction turn the brightness back to 100 and also switch to the right page with the buttons etc... Do you think this will work?
Hi, can you please tell me how to change the code so that the temp displays in °C, instead of Fahrenheit?
I have it setup as soon there is no motion in the room with an external sensor anymore the dim level is 0 and when the sensor detects motion dim level is 100 all done from HA
Does screen rotate if in vertical position
the screen looks bigger than my EU version is there a different version in the editor
Insted of overlaying with a buttton why not just set another page that is black. And then jump from page to page, Page two can also be used as screensaver.
Leave the button "off screen" and adjust the button position when the screen initializes.
How did you power screen without other part of device? Is it just 5VDC?
@hagan92
2 жыл бұрын
Yes it is.
A little suggestion for feature videos. Zoom in on the text you are typing. It's quite hard to see what your doing, and even worse when you are watching it on mobile.
@ChrisMasto
2 жыл бұрын
Thanks. I'm literally doing that in this video, though I guess I need to zoom more in the future.
@TheHellis
2 жыл бұрын
@@ChrisMasto it was very hard to read what you typed in ESP-Home. At least on a mobile. But when anyone needs to use the code they have to be at the computer anyways so it's not that big of a deal.
@ChrisMasto
2 жыл бұрын
@@TheHellis Got it. I did want to make the font a lot bigger there but when I zoomed the browser, it also increased the size of the Home Assistant interface so much it was unusable. I will experiment with a better way of doing it next time.
@TheHellis
2 жыл бұрын
@@ChrisMasto do it while editing. That is by far the easiest way. I can't speak for all editing softwares but the ones I have used has a way to zoom in the clip