Yes exactly I use the Sonos Binding which has lots of channels but in practice I use PLAY/PAUSE/NEXT/PREVIOUS which is a single channel command
VOLUME which is a Dimmer from 0 - 100
Personally I’m not even fussed about seeing who is playing. I’d rather just have a single screen with some presets. To be honest if it involves too much work it would be fine just to have some more button icons and I can do it all using one of the standard pages.
If you go the the music play screen and press the buttons, you’ll see;
16:40:18.579 MQT: tele/nspanel/RESULT = {"media":{"action":play"}}
16:40:19.237 MQT: tele/nspanel/RESULT = {"media":{"action":previous"}}
16:40:19.793 MQT: tele/nspanel/RESULT = {"media":{"action":pause"}}
16:40:20.308 MQT: tele/nspanel/RESULT = {"media":{"action":next"}}
16:40:20.915 MQT: tele/nspanel/RESULT = {"media":{"action":next"}}
16:40:21.415 MQT: tele/nspanel/RESULT = {"media":{"action":pause"}}
16:40:21.990 MQT: tele/nspanel/RESULT = {"media":{"action":previous"}}
16:40:22.500 MQT: tele/nspanel/RESULT = {"media":{"action":play"}}
in the mqtt
you just need a rule like others;
if you get “next” then
events.sendCommand(“sonositem”, “play” ) // or what it is it needs
you can probably even add something directly in OH with a channel that listens for that message directly, and then add that channel to your item.
Probablly be better OH people that can give you a slicker answer for best way. I’m my time is really on the core stuff, so I’ve not really had time to look as setting my own up full yet either. was hoping the more general OH people could pick up some of the non nspanel, core OH things!
v1.0.0-beta7
- Fixed bug with 3 button panel
- Added Icon 16
Released.
I’ll add a volume in next release, so you can try it, will make it nicer looking later.
Would be good if you can try the push back to media display, just to see it works Even if you are not bothered about it
so i use now nxpanel.be and flashed the latest nxpanel.tft ,got the openhab channels right and made the rule with the script.I get clock working at main screen but not the weather, should i do something to make it work?NSPLocation at console says “unknown command”.Also swiping right from the main screen i get a page with 8 empty buttons and this at oh logs :
2022-02-08 20:42:01.631 [INFO ] [openhab.event.ChannelTriggeredEvent ] - mqtt:topic:b94727f5:nspanel:nxpanel_page_trigger triggered {"page": {"format": 6, "pid": 10, "type": "refresh"}}
is thet normal?I dont understand where to edit to set up a screen…
Yes, all normal.
The panel is messaging out asking how it should refresh that page, waiting for OH to reply. If you look up the thread, you’ll see others asking too. You need to create a Channel
to get the mqtt events. Then you create a rule to handle the messages, example also above in the thread. The rules get’s the message you showed above and will send back to nxpanel how to show the page. Telling the the icons and buttons you want.
I’m sure others can help you here too, if you can’t figure it from fully reading the thread.
For the weather, you need to install the openweather binding and add a rule for when the weather item changes. when it does, you send;
'{ "weather": { "temp": 7, "icon": "04n", "feels": 4 } }'
back to the panel.
thnx,i read the entire thread 2-3 times but i am still confused.
i have created the 2 channels
- id: nxpanel_command
channelTypeUID: mqtt:string
label: NxPanel Command
description: ""
configuration:
commandTopic: cmnd/nspanel/nxpanel
- id: nxpanel_page_trigger
channelTypeUID: mqtt:trigger
label: NxPanel Page Trigger
description: ""
configuration:
stateTopic: tele/nspanel/RESULT
and created the rule with the groovy script triggered by nxpanel_page_trigger channel.Still cant sync the screen.I dont understand what to do with the nxpanel_command channel also.
i have openweatherMap binding installed ,can i have an example rule for how to send the info?
v1.0.0-beta8
Status page working
Refresh event is like this;
'{"refresh":{"pid":18,"name":"Info Page","status":[{"id":1,"text":"Door","value":"Open","icon":2},{"id":2,"text":"Temp","value":"23"}]}}'
Shorter sync event
'{"sync":{"pid":17,"status":[{"id":4,"value":"Big"}]}}'
colours, “icon”: 1-3
pick your own triggers, they are mine
events.sendCommand("ns_temperature",""+ir.getItem("CabinDevices_CabinRoomTemperature").state.intValue())
def weather = ir.getItem("weather_icon_id").state.toString()
def outdoorTemp = ir.getItem("outdoor_temp").state.intValue()
def apparentTemp = ir.getItem("apparent_temperature").state.intValue()
def wind = ir.getItem("forecast_wind_speed").state.intValue()
def json = String.format(
"{ \"weather\": { \"temp\": %d, \"icon\": \"%s\", \"feels\": %d } }",
outdoorTemp, weather, apparentTemp, wind)
events.sendCommand("nxpanel_command",json)
btw, that script is a groovy one so if you use that, be sure to install groovy automation plugin
Any chance to get a portrait mode of this tft for americans? I’m more than willing to be a test dummy.
(I’m currently unaware of any mode for this so correct me if I’m wrong.
Unfortunately, this would be a huge task of redoing everything, as all the components are designed like that.
I do not think there is any real difference that would stop you using the EU one in the US. other than hole size. Maybe an easier option, if NxPanel would work better for you than stock, is just to get an EU one and mount in a EU size hole? Just a suggestion. But doing a version in a different orientation is beyond the scope of work for me.
I think a few people in EU got a US one as part of the screen isn’t behind the bezel on that, with a view of mounting it horizontally, with buttons at right, not below. Even this doesn’t work ideal with Nxpanel, as the onscreen indicator for the hardware buttons are in the wrong place, and internal hidden UI buttons needed for making it work, are shown, so looks a bit messy. For them I can probably hide the buttons, but the indicators are still in wrong place and the display will not look cantered.
So in summary, NxPanel is really totally optimized for the EU version, because that’s what I have and use
Sorry, can’t be of more help.
Changing the hole size isn’t possible for most houses (including mine) I guess I’ll just wait for another solution
Or wait for the source so I can convert it to portrait mode
code, might not be too bad, i could move most of that and just move the components around. most work would be in the gimp for the screens. might look at it after the EU is all complete and 100%. there is not shared code or core libs in nextion, so everthing is duplication all over the place. it would be pointless looking at it until EU was 100% solid, so code didnt need changed in 2 places during development.
I’d say give the EU one a good test and make sure it worked at did everything you need well. bc I wouldn’t be look at doing anthing in a US one that wasn’;t in EU, it would be an “as-is” port.
Yeah I tried it and it was awesome, looked good and worked exactly how it should have. I will patiently wait for this.
Ok I’ve finally managed to get text rules working with this which makes life a lot easier for me. I had to create another channel running of the MQTT message tele/nspanel/result and linking an Item. You can then get at the json strings.
I have the Music screen running. I can pick up the strings you mentioned.
I did the page as follows which I think is causing a problem in the groovy script I’m not sure about how to code the Music page - no title is coming up. I get an error listed below and in the console
case "10" :
if (refresh) {
json = makePage(10,'Master Bedroom',6)
json<<format<<',buttons:['
json<<makeButton(1,"Walls",1,1)
json<<makeButton(2,"Bath",1,1)
json<<makeButton(3,"Blinds",1,10)
json<<makeButton(4,"Velux",2,10)
json<<makeButton(5,"Music",10,11,13,11)
json<<"]}}"
} else {
json = '{ "sync": {} }'
}
events.sendCommand("nxpanel_command",json.toString())
logger.info("nxpanel_command: "+json)
break
case "11" :
if (refresh) {
json = makePage(11,'Music',13)
json<<format<<',buttons:['
json<<makeButton(1,"Walls",1,1)
json<<makeButton(2,"Bath",1,1)
json<<makeButton(3,"Blinds",1,10)
json<<makeButton(4,"Velux",2,10)
json<<makeButton(5,"Music",10,11,13,11)
json<<"]}}"
} else {
json = '{ "sync": {} }'
}
events.sendCommand("nxpanel_command",json.toString())
break
}
I get the openhab.log error :
2022-02-09 18:23:20.757 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'ca275a12c8' failed: javax.script.ScriptException: java.lang.StringIndexOutOfBoundsException: begin 6, end -1, length 26
And In the console:
18:34:09.820 MQT: tele/NSPanel/RESULT = {"media":{"action":previous"}}
18:34:09.826 BRY: ERROR, bad json: {"media":{"action":previous"}
There’s an extra quote after previous. The sent mqtt message is being improperly formatted.
yes thats the problem! @m-home can you fix it!
I guess I´m not experienced enough… I try to create a page. Like the Status page.
Unfortunately I´m not using Openhab or similar. I work with Loxone Automation and use MQTT.
I can send a JSON Package by the MQTT Function. Weather for example works fine with conversion and all.
But how the heck can I create a page? I guess I´m missing a crucial information here…
Thank you for reading, and your hard work!
Making the page is not so hard it’s just json like the weather. but you need to send it in response to some incoming mqtt
NxPanel send MQTT to you
you send panel MQTT back to make page
It’s conversational. Weather is one-way traffic, you just send to the NxPanel.
You need something that can handle messages as well as send. Most system like OH, have a way to define rules. If X happens do Y. In this case, if panel asks for page 1, send page 1 to panel.
I know nothing about your system, so can’t really help. But I’m sure it must do something the same, or it would be useless. You could do it off you system though. Anything on your network could get the message and send the reply.
v1.0.0-beta9
Colours added to status page. add “icon”: [1…3] to the status message. Will prob rename to color, next release, be warned.
Fixed missing quotes in media messages.