NxPanel - Replacement Firmware for Sonoff NSPanel

My next question, does anyone have some examples of using the Music panel to control a media player? I’m using Moode audio which is MPD. I’ve managed to get the music info. screen to read the Artist/Album/Track values from MPD but I’m not very clear on how to link the actions to the MPD items e.g. in the logs I can see: mqtt:topic:6e28cd7a35:aec1233913:nxpanel_page_trigger triggered {“media”:{“pid”:20,“action”:“play”,“volume”:51} when pressing the on screen play button.

Gut feeling tells me there is a smarter way (to get a button operating on a group), just haven’t had the time to make a deep dive into this - will let you know if I do…

Can’t help you with the music panels… haven’t used these at all.

  • I have my NXPanel setup with Tasmoto
  • I’m receiving the ‘nxpanel_page_trigger’ in logging
mqtt:topic:tasmota_gang:nxpanel_page_trigger triggered {"page": {"format": 6, "pid": 10, "type": "refresh"}}
  • I’ve setup a rule that fires the JScript

But the JScript crashes with the message:
org.graalvm.polyglot.PolyglotException: ReferenceError: “items” is not defined”.
This seems to reference to an item, i can only find one in the JScript so i assume it’s this one that sends back to the NxPanel:
items.getItem(“nxpanel_command”).sendCommand(messageJson);

I have no idea how to set the item up. I’m putting everything in things / item files, not using the gui. Can someone help me with this? It feels like it’s the last piece of the puzzle.

Thing mqtt:topic:tasmota_gang "Tasmota gang" (mqtt:broker:MQTTBroker) {
	Channels:
		Type switch : power1 "Power Switch" [ commandTopic="cmnd/tasmota_gang/POWER1", stateTopic="stat/tasmota_gang/POWER1", on="ON", off="OFF" ]
		Type switch : power2 "Power Switch" [ commandTopic="cmnd/tasmota_gang/POWER2", stateTopic="stat/tasmota_gang/POWER2", on="ON", off="OFF" ]
		Type number : ANALOG_Temperature1	"Temperature1"	[ stateTopic="tele/tasmota_gang/SENSOR", transformationPattern="JSONPATH:$.ANALOG.Temperature1" ]
		Type number : ESP32_Temperature	"Temperature"	[ stateTopic="tele/tasmota_gang/SENSOR", transformationPattern="JSONPATH:$.ESP32.Temperature" ]
		Type string : nxpanel_command "NxPanel Command" [ commandTopic="cmnd/tasmota_gang/nxpanel" ]
		Type trigger : nxpanel_page_trigger "NxPanel Page Trigger" [ stateTopic="tele/tasmota_gang/RESULT" ] 
}
//Group tasmota_C62090_0144		"Tasmota"		(GroundFloor)		[Equipment]
Switch gang_tm_relay1 "Tasmota relay 1"  { channel="mqtt:topic:tasmota_gang:power1" }
Switch gang_tm_relay2 "Tasmota relay 2"  { channel="mqtt:topic:tasmota_gang:power2" }
Number gang_tm_ANALOG_Temperature1	"Temperature1"			(tasmota_C62090_0144)	['Equipment']	{channel="mqtt:topic:tasmota_gang:ANALOG_Temperature1" }
Number gang_tm_ESP32_Temperature	"Temperature"			(tasmota_C62090_0144)	['Sensor', 'Measurement', 'Temperature']	{channel="mqtt:topic:tasmota_gang:ESP32_Temperature" , synonyms="Temperature"}
String nxpanel_command "NxPanel Command" {channel="mqtt:topic:tasmota_gang:nxpanel_command" }

With the best will in the world, this is an openHAB community. Unless what you want aids working with openHAB you are unlikely to get much joy.
There are several other forums about these devices and you may be better there.

This is Openhab? I’m using the @m-home JScript. There is just no info on how to create the nxpanel_command item in the tutorials, which the JScript seems to be referencing.

Yes. This is how to get the NSPanel with Tasmota to work in openHAB.
as in community.openhab.org
and
‘You control it via MQTT, using OH rules…’ in the first post.
The focus will obviously be on openHAB and you may be able to decipher the commands etc but the instructions are based on getting information in and out of openHAB

1 Like

So this is what i’m asking. How to setup the item in Openhab that sends back the data to Tasmota.

The reply wasn’t to you it was to a person who wasn’t using openHAB but wanted people to help with MQTT
There’s a set-by-step here

Hi,
I’m a bit confused, you are writing JScript in your comments, but the scripting language in all the NXPanel-documentation in this thread is Groovy (these scripting languages are close in syntax but not the same)

So first make sure you have installed the ”Groovy Scripting” automation tool and secondly, make sure you call a Groovy script from your rule. I use the GU in OpenHAB3 for this, Haven’t tried to do this with just files but you can maybe check here: Groovy Scripting Documentation

The trigger script in the documentation does not use an item to send the commands to NXPanel but instead posts the MQTT command directly from the script on the command-TOPIC using this call: mqtt.publishMQTT(TOPIC, json.toString()).
You could use an item instead, see example scripts in the documentation for updating weather and temperature on NXPanel.

I think your problem is that ”items” in ”items.getItem()” is not defined and not that the item is missing. In The Groovy this would look something like this:

def command = ir.getItem(“nxpanel_command”)

Hi @m-home, don’t know if you still will spend time on developing NXPanel, but if you do, there is one paricular feature I’m very interested in (and don’t think I’m alone) which is ”Return Home” to the main panel. I see that you prepared for this in the settings but if this is a time consuming change, an alternative might be if you could add a ”return home” JSON.
Thanx /Alf

Hi,
I am starting to integrate the Nxpanel into my MQTT & Node-red based home automation system.
I really like the Nxpanel icons and flexibility over the stock nspanel screen.
While there are quite some nice icons already in Nxpanel, they do not fully match my needs, so I would like to add or change some of the icons (as there are some I will never use), to make the interface more intuitive and improve the WAF…

The .tft files are available after some extensive digging, but I can not locate the HMI file.
Does anyone know if the HMI (nextion design) file is available, and were I can find it ?
So I can change my icons.

@m-home: Great work, are you willing to add the .HMI file to your github ?

Thanks in advance.

Best Regards,
Robin

Hi,

I would like the Nxpanel to return to the home screen once a button on a sub menu was pressed.
Sofar I have tested with:

  • The “next” data member of a button (bulb) pointing to PID 0 or 1
  • Sending an refresh for a page with PID 0 or 1, when the buton was pressed.
  • Sending an start message with PID 0 or 1 (what is the start message for ?)

But all did not work.

Does anyone know what I am doing wrong ?

Thanks,

Robin

This functionality seems to be missing (I’ve basically tried the same stuff you did). Only solution I know about is to reboot NSPanel which isn’t really a good solution.

Would be great to have an example of the playlist reply.
The panel requests a refresh with same pid as the media page but with different format (14).

I tried a bunch of responses, but nothing shows on the playlist page - not even a title.
Is this feature available/working in 1.0.7?

Can someone tell me if this replacement firmware works for a US model, in a horizontal orientation or if it only works for the EU model?

I installed tasmota, but cannot switch to the non-stock nextion firmware using the instructions with the nxpanel.be

Thank you

Hi!

See this post here: NxPanel - Replacement Firmware for Sonoff NSPanel - #72 by m-home

So as of right now, I don’t think it’ll work…

Thanks
I had read that and it seemed to me that based on it, the Nxpanel should load but just look off.
I can’t even get the InstallNxPanel command to work

I’ll just look into the standard nspanel.be and see what that looks like.

Thanks again

Hi All,

I have successfully flush the NXPanel, but it there have anyway to fallback to the stock version?

Hi All,

First off, thank you very much @m-home for the work on the code, and @Alf for the great documentation. It was a big help in getting started.

I have gotten my NxPanel up and running and have been working on building functionality. I wanted to get the community’s take on a best practice for a “multi-toggle” switch. I’m sure there are many ways to accomplish this, but before I bash my head against the wall I thought I’d see if anyone has done something like this before with the NxPanel firmware and JSON code.

Here’s what I’m hoping to replicate on the NxPanel: Currently I have the following on my default Sitemap:
image

The underlying code uses a single virtual Item that holds a value of ‘0’ for OFF, ‘1’ for Romantic, and ‘2’ for Entertain. Then a Rule gets triggered based on which button gets selected and sends various commands to lights and music.

In the Sitemap it’s easy, just:

Switch item=sceneDiningRoom mappings=[0="Off", 1="Romantic", 2="Entertain"]

Any thoughts on replicating in NxPanel?

Thanks in advance!

It might not be the best solution, but I handled this by treating each mapping as a separate button, and then placed all the buttons in a group.
So there’s a button for “Off”,“Romantic”,“Entertain”, then all of these are added to the “Dining Room Scene” page.
Then set the Rules engine to handle what to do when each one is pressed. I didn’t need the feedback to mark which state it was in, but that could also be done with the Rules by setting the appropriate button and switching off the others.

Hopefully I explained that clearly enough?
A bit of fiddling, but it worked well in my scenario