NxPanel - Replacement Firmware for Sonoff NSPanel

I’m with the same version VERSION = “1.1.2”
Do I need to change something inside the file?

no, you need to change nothing in the file. don’t!!

Should get this;

00:00:00.003 HDW: ESP32-D0WD-V3 (PSRAM)
00:00:00.139 UFS: FlashFS mounted with 276 kB free
00:00:00.276 CFG: Loaded from File, Count 295
00:00:00.292 QPC: Count 1
00:00:00.880 BRY: Berry initialized, RAM used=4097 bytes
00:00:00.923 Project tasmota - NS Panel Version 11.0.0.1(tasmota)-2_0_2_1(2022-02-16T11:30:27)
00:00:02.332 NXP: Initializing Driver

can you delete the .bec file. This is the compiled version tasmota makes if one not there. you shouldnt need to, but try. also, upgrade you tamsota to make you are on latest one, ones from around christmas had a tcpclient bug in them
image
this looks old…

Thank you very much it was my mistake
old version of Tasmota

What’s the json for the warnings ?
because it does not work for me
{warnings: [{id:x (1-4) , type:x (0-7) , state:x (1-3)]},…]}}`

Here is an example;

I use it to show which colour recycle bin we are currently on!! :slight_smile:

import org.slf4j.LoggerFactory

def logger = LoggerFactory.getLogger("org.openhab.core.automation.nspanel")
def mqtt = actions.get("mqtt","mqtt:broker:mqtt_broker")

date = new Date()
logger.info("Date: $date")

def d = new Date()
def days = d.getTime()/86400000 - 0
def week = days/7 as long
def w = week%4
  
var color

if (w==3) {
  color = 3
}
else if (w==1) {
  color = 2
}
else {
  color = 1
}

mqtt.publishMQTT("cmnd/nspanel/nxpanel", '{"warnings":[{"id":1,"type":8,"state":'+color+'}]}')

What is the combination for a dimmer Brightness with a name at the top of the page?

It’s the last component I need to finalise message for, but it will;

{"refresh":{"pid":15,"name":"Hall Light","dimmer":50,"power":1}}

for the refresh message when you move to screen

and for the event you send from OH if you change the dimmer when the page in open

{"sync":{"pid":15,"dimmer":50,"power":1}}

and the control will send

{"dimmer1":{"pid":15,"power":1,"dimmer":34}}

Should be in the next version tomorrow

@jonny211, is it all making more sense now? :slight_smile:

And I do not understand why it does not work for me … :rofl:
Optimization suggestions
Background color change
icon numbers 1,2,3 for a ceiling fan
air conditioner remote similar to the Tasmota nspanel page
Support in other languages for product names
Thanks a lot

Need to explain how far you’ve got, you must be close. It’s working very stable now for me, so you must just need a few tweaks.

They are all good. When a few more people are using it, I’ll pole what people think is best, it’s kind of a big job as need to redo all the screens! But i’m very open to that, but I’d rather do it optimally.

Rather than numeric icons, would a dictated control not be better?

I’m not sure which page your mean by “Tasmota nspanel page”

There is very little hard codes labels, maybe the month and some on thermostat. I def want to make it work for other languages, so that will be top of list, can you be specfic were you see the issues?

dictated control be better and jpag icon be more an better :wink:
the issues with the dimmer
maybe I’m not defining it correctly
I get a vacuum icon

json<<makeButton(4,“Bedroom”,3,2,7)

wow, excellent work! I’m playing with this since yesterday, but I’m using Node-RED to handle the communication. I have a few requests, if possible.

1 - Could you make a list with all the available commands?
2 - How can I get the icon for the weather widget? Or get a list of available names.
3 - I noticed that if I restart the nspanel with a light that is connected to the relay and it is turned on, the relay indication in the screen is not updated. I have to turn the light off and on again, to update the status bar. Is it possible to pass the status of the relay at start? Or is it something you can do in your side?

Great work, again!

  1. Sorry, just not got around to a list of commands in one place, they are kind of scattered around in this thread. I’ve just not had time to do that yet, as so far, my time has bee on getting it working! :slight_smile: I’ll get to a list and some better documentation shortly.
  2. The weather icon name I have made to match the names from the openweather plugin, so if you have that binding it’s very easy. But here they are; OpenWeather
  3. I’m clear on this question…

You should set the state in 2 places. Firstly, when you move to the page and you get a page request send to your backend, your backned should send either a refresh or sync message back, depening on if it’s the same page id or not as the last time the page was opened. If it was same, ncpanel would send a sync request to you, otherwise, refresh. In that message you send, you should be setting the state item to reflect on/off. Secondly, for realtime update, you should also have another rule or something in your backend to send another sync message to nxpanel when it’s activated. so if that was the current screen showing, it would be kept in sync.

This post explains it best;

I’d prefer to do a control. Can you define it?

1 - great! Thank you
2 - Yes, thats what I was looking for.
3 - What I mean is that those 2 colored lines, just above the physical buttons in the NSPanel in the main page, that should reflect the state of the relays. How can I update those 2 status lights, since they can be not in sync sometimes.

  1. I understand now. I’ve not had an issue with that myself. there a no commands as such, since tasmota send that message directly to the panel. could you maybe try to find out where it goes wrong?
    if you turn weblog 4 on in tasmota you will see the messages it send, you will see;
{ "switches": { "switch1": 0 , "switch2": 0 } }

when you press the reply. You could sent this youself and it will change the UI, that i think that is wrong. it should be doing that itself. What sceen are you not seeing it sync in, maybe there is a bug. the reply show set the buttons on the home screen and all other screen look at the home screen and copy it’;s state. it’s possible I may have missed something. Please see if you can find a replicable case of it not working
.

My NSPanel had the right button a little flimsy, so I removed the screen and made a video to the seller. When I removed the screen, the lights connected to the switch were on. Then, when I connected the screen again, the status bar were out of sync with how the lights were. When I turned the lights off and on again, it synced. I will try to replicate that when I’m home.

Linking NxPanel Buttons to your existing Buttons

The best solution for linking your nxpanel buttons to those on your system is defined here, it seems to work very well.

It only happens that a reset is sent to the unit so the relays do not change state and then there is no synchronization.
If you do an electrical reset, everything works normally.
This is a situation that does not happen if you do not cause it.

ahh
i understand. you reset the unit via software and it boots but it boots think the relays are off. yes, that will be, I do not send current state on boot. I’ll look at that
not too bad

def makeButton(bid,label,type,icon=null,state=null,next=null) {
                4   Bed..  3    2         7

It’s the state which is wrong, it should either be 0/1 for the dimmer being on off, and the next element should be set to the 7 (which I assume is the room the dimmer is for?)

(why it goes wrong is becuase it adds 7 to the icon image which being 0 or 1 would take to dimmer on/off icon, adding 7 takes it past that to a different icon altogether!)

with that fixed, it would display correctly. but probably not function fully. I’m just tiding the function flow today and it will be in next release. Don’t forget to give me an idea of an fan control.

1 Like

Version 1.0.2

This version should have most of the things fixed people have mentioned.

Moreover, I have changed the example script in the 2nd post in this thread to be much more readable and understandable. I have taken all the links out to my items, so you can run it “as is” and you will have a working NxPanel with example components for most things.

I suggest you make a new rule on the nspanel channel trigger and call this one 'NxPanel Demo Page Rule" and copy the code from the 2nd post to there, you can then disable you current one, and enable that one. Then restart the panel in tasmota

restart 1

You should then have a working demo as a template. I wouldn’t change this, keep it as a reference working one, I’ll update it as I go.

Make another copy of this rule, as your real one. and then change that one.

Rememeber to long-press the dimmers and fan (which is a dimmer) to get to detail.

You can easily switch between the demo one and you working one during testing by simply disabling one and enabling the other and restarting again. remember to restart 1 when you swap.

Maybe @Pentium4 will want to do something the same with the javascript version?

Your systems should update to 1.0.2 shortly (it you enabled test updates), but as ever you can 9998+red on alarm, or autoflash from the console.