NSPanel Lovelace UI Helpers (part 1/5, v1.0)

I have the same setup.

I have a rule that is triggered by all the contact sensors and every other item change in the screen saver, the rule then runs the NSPanel helper that calls a script, the script being the screensaver

It works for me.

Thanks for the advice. I was not sure whether I have had to create a dedicated rule to update the screensaver or not. So I did and now the screensaver works nicely.Thanks again.

I almost completed the programming of my panel.

However, I face a problem with the screensaver. When I touch the panel when it displays the screensaver, a CardScript (Menu principal) is called (it is the main script that calls many other scripts ~30).

I would like to go back to the screensaver when touching the upper left corner of the screen (icon with 3 horizontal bars).

I have thus added a Navigation string (from the helpers library) to the “previous” parameter. However, when I touch this corner, nothing happens although I used this several times in all of my scripts to go back to the main CardScript).

Herewith is what I did:

The script id 25a97b3b49 is the screensaver (see next figure):

It seems that this screensaver script is special and cannot be called in other scripts. Is there another way to go back to the screensaver without waiting for the timeout ?

Thanks to @rene_rostock for his really nice piece of software. Thanks to him, I have a more complex panel compared to what I did with nxpanel and I also learnt blocky (something I did not use before).

Just curious as to why you want to have a button to go back to the screen saver, if you just let the page time out, it will go back to the screen saver automatically.

Good question :wink: This is probably because I made a mistake somewhere


I want to have a brightness to 0 for the screensaver after a 30s timeout. I thus configure the callback with the following parameters:

25a97b3b49: is the script id for the screensaver script
a7a2683c99: is the script id for the cardscript “Menu Principal”

But when I touch the screen, the brightness comes to 100 (which is what I want) but the problem is that at the same time, the CardScript “Menu Principal” is displayed so I do not have enough time to see the info on the screensaver. This is why I would like to have the possibility to go back on the screensaver.

Maybe there is another way to awake the screen with the screensaver displayed without going immediately to the cardscript “Menu Principal”

Hi @gd35 ,

you are rigth, screensaver is special, Just create some separate script, which just contains the activate screensaver helper. Link to this script id in your previous section - this will hopefully work (can’t test this in this moment).

Best regards and give some feedback if this does not work, I will check during next weekend why


Rene

Meanwhile, I found that if I keep my finger to the touch screen, the screensaver will be displayed until I remove my finger, then it will go to the ScriptCard “Menu Principal”.

I also use the left physical button (which is unused) to fire a rule to display the screensaver with the following blockly:

So at least, I have a solution.

Thanks @rene_rostock
I immediately tried to your solution. It works perfectly !

I have just a problem with the brightness. What I would like to have is to have a 0 brightness after the timeout (after 30s, the brightness of the screensaver should be 0 to avoid displaying the screensaver when the panel is unused).

With the current parameters and your solution, I can go back to the screensaver from the ScriptCard “Menu principal” but the brightness is 0 although I would like to have it at 100 till the timeout. I am not sure I understood the configuration of the brightness

Hi @gd35 , have you tried to re-set the brightness before going back to the screensaver? This should work, if not this is probably some bug to be fixed


Best regards, Rene

Yes I tried before:

But the screensaver brightness will remain at 100 in-definitively.

Ahh, you can use the script which is run after the screensaver is shown. Set the brightness in this script to 100 and after some timeout in the same script of 30 seconds set it to 0. This way the screensaver get always blanked after 30 seconds. Maybe this solves your problem?

Regards, Rene

Should I include this in the script 25a97b3b49 mentioned in the field “Call script after Screensaver shown” or in the script a7a2683c99 specified in the field “Show Page / Call Script” ?

Hi @gd35 , script 25a97b3b49 is the one which gets called every time the screen saver is displayed, this is the one you need. Set the brightness there and use the timeout there as well.
The other script should be your entry page, which gets called when you leave the screensaver.

Regards, Rene

Thanks for the clarification. I did a test but it does not work.

Meanwhile, I found a “dirty” solution that manage the brightness of the panel using 2 rules triggered by a 30 seconds timer. Each rule send a message to the NSPANEL item to change the brightness (0 or 100). The timer is fired at the end of the screensaver script:

The rule to set the brightness to 0:

The inline script

It works flawlessly.

Thanks again.

My panel is almost ready to be in “production” (wife approval ;-). However, I got a criticism about the fact that if the panel is touched, it will go to the main CardGrid script although the objective was just to see the data displayed on the screensaver.

Is there a way to have:

  • One touch on the screensaver → just display the screensaver with a brightness at 100 (it it is 0)
  • One swipe gesture to the screensaver to go to the main CardGrid script

Thanks in advance

Hi @gd35 ,

did not realized that you removed your request, but just had it implemented, I liked the idea of separate swipe actions. You can try it by copying the new file into your current Block Library: absorb-it:blockly:nspanel_callback . This will provide you with a new, more complex callback as below:

Just tested this with the following testDimmer script:


and it works well. Maybe include to update the weather-icons etc. when calling this after the screensaver is shown, but it works for me as of now. If you try it, feedback is very welcome.

Best regards, Rene

Hi @rene_rostock

Yes I removed my post (but I put it back) because I find a way to do it (but still dirty by intercepting the swipe action through mqtt). The main GridCard is thus called by a rule (swipe down action and not by the screensaver parameter).

I like very much what you proposed for the nspanel callback. So I will remove my rule and use the new version of the callback and I will report to you in the following days (I am busy tomorrow)

Thanks again for your help.

I thus tested your new nspanel_callback.

25a97b3b49: the script to update the screensaver
a7a2683c99: the main CardGrid
70e7a685ae: the testDimmer script (the one you gave in your post but with a 20s delay)

The behavior should be:

  • When I touch the screen, the screensaver is displayed during 20s and brightness is set to 0 after)

This works perfectly !

  • When I swipe (in any direction at that moment for debugging purpose), the main CardGrid script is called

This does not work all the time although I see a MQTT message swipeXXXX send by the nspanel using MQTT Explorer (linux). One explanation might be that the timer is running (because I touched the screen first in the swipe action) and thus nothing else is processed by your script.

In a second attempt, I removed the testDimmer script from the nspanel Callback, then the nspanel works perfectly (but of course I do not have anymore a brightness set to 0 after 20s).