The general idea is that the Nextion Display cycles though a page counter and the esp32 tells the display what to do. If you are changeing the page the nextion display will send and event to the esp32 and it has to answer with the messages, that will update the current page with it's desired components. This enables easy changes, without touching the HMI Project.
HomeAssistant / NodeRed -- MQTT -- Tasmota -- Nextion Screen
See the following picture to get an Idea for the messages send and recived from the screen during cycling though pages.
55 BB [payload length] [payload length] [payload] [crc] [crc]
Payload length contains the number of bytes of the payload.
CRC is "CRC-16 (MODBUS) Big Endian" calculated over the whole message
This protocol does not try to implement broken JSON Commands with a specified type (lol). Instead the commands are plain text commands with parameters.
This message has to be generated for the Message "1337" (1337 is not a valid command, this is just an example)
55 BB 04 00 31 33 33 37 5F 5B
The following message should be implemented on all pages
wake screen:
wake
set brightness of screensaver:
dimmode,0 - (screen off)
dimmode,100 - (screen on with full brightness)
set current time:
time,22 : 26
set current date:
date,?Di 24. Februar
set screensaver timeout (set time in sec, max 65):
timeout,15 - timeout after 15 seconds
timeout,0 - disable screensaver
change the page type:
pageType,pageStartup
pageType,cardEntities
pageType,cardThermo
pageType,cardMedia
pageType,popupLight,Schreibtischlampe
pageType,popupNotify
weatherUpdate,? tMainIcon? tMainText? tMRIcon? tMR? tForecast1? tF1Icon? tForecast1Val? tForecast2? tF2Icon? tForecast2Val
weatherUpdate,?0?2,3 C?0?0 mm?Mi?0?9,3 C?Do?0?11,5 C
The following message can be used to update the content on the cardEntities Page
entityUpdHeading,heading1337
entityUpd,*id*,*type*,*internalNameEntity*,*iconId*,*displayNameEntity*,*optionalValue*
entityUpd,1,light,light.entityName,1,Light1,0
entityUpd,2,shutter,cover.entityName,0,Shutter2
entityUpd,3,delete
entityUpd,4,text,sensor.entityName,3,Temperature,content
entityUpd,4,button,button.entityName,3,bt-name,bt-text
entityUpd,1,switch,switch.entityName,4,Switch1,0
entityUpdateDetail,*buttonState*,*sliderBrightnessPos*,*sliderColorTempPos*,*colorMode*
entityUpdateDetail,1,100,78,enable
entityUpdateDetail,1,100,disable
entityUpdateDetail,*ignored*,*sliderPos*
entityUpdateDetail,1,77
entityUpdateDetail,*tHeading*,*b1*,*b2*,*tText*
entityUpd,*internalNameEntiy*,*heading*,*currentTemp*,*destTemp*,*status*,*minTemp*,*maxTemp*,*stepTemp*
entityUpd,|*internalNameEntiy*|*heading*|*icon*|*title*|*author*|*volume*|*playpauseicon*
event,startup,version
event,screensaverOpen
event,*eventName*,*PageNumber*,*PageHeading*,*entityName*,*buttonId*,*actionName*,*optionalValue*
event,pageOpen,0
event,buttonPress,1,tHeading,internalNameEntity,1,up
event,buttonPress,1,tHeading,internalNameEntity,1,down
event,buttonPress,1,tHeading,internalNameEntity,1,stop
event,buttonPress,1,tHeading,internalNameEntity,1,OnOff,1
event,buttonPress,1,tHeading,internalNameEntity,1,button
event,pageOpenDetail,popupLight,internalNameEntity
event,buttonPress,D,nameEntity,internalNameEntity,1,OnOff,1
event,buttonPress,D,nameEntity,internalNameEntity,1,brightnessSlider,50
event,buttonPress,D,nameEntity,internalNameEntity,1,colorTempSlider,50
event,buttonPress,D,nameEntity,internalNameEntity,1,colorWheel,x|y
event,pageOpenDetail,popupShutter,internalNameEntity
event,buttonPress,D,nameEntity,internalNameEntity,1,positionSlider,50
event,buttonPress,D,D,D,1,notifyAction,yes
event,buttonPress,D,D,D,1,notifyAction,no
event,pageOpen,0
event,tempUpd,*pageNumber*,*entityName*,*temperature*
event,buttonPress,1,tHeading,internalNameEntity,1,media-back
event,buttonPress,1,tHeading,internalNameEntity,1,media-pause
event,buttonPress,1,tHeading,internalNameEntity,1,media-next
event,buttonPress,1,tHeading,internalNameEntity,1,volumeSlider,75
ID | Icon |
---|---|
0 | |
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | |
25 | |
26 |
Background Color is
- RGB565: 6371 [18e3] (HEX: #1C1C1C, RGB: 28,28,28)
Source for Icons is the Material Design Font, used by HASPone https://github.com/HASwitchPlate/HASPone