# NSPanel Lovelance UI 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. # Message Flow 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. ![message_flow](../doc-pics/message-flow.png) # Custom Protocol ``` 55 BB [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. ## Example for valid Message This message has to be generated for the Message "1337" (1337 is not a valid command, this is just an example) ``` 55 BB 04 31 33 33 37 5F 5B ``` ## Messages to Nextion Display 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 ms limited from 50 to 65535: timeout,15000,0 - timeout after 15000 disable screensaver timeout,15000,1 - timeout after 15000 enable screensaver change the page type: pageType,pageStartup pageType,cardEntities pageType,cardThermo pageType,cardMedia pageType,popupLight,Schreibtischlampe ### screensaver page 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 ### cardEntities Page 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 ### popupLight Page entityUpdateDetail,*buttonState*,*sliderBrightnessPos*,*sliderColorTempPos* entityUpdateDetail,1,100,78 entityUpdateDetail,1,100,disable ### popupShutter Page entityUpdateDetail,*ignored*,*sliderPos* entityUpdateDetail,1,77 ### cardThermo Page entityUpd,*internalNameEntiy*,*heading*,*currentTemp*,*destTemp*,*status*,*minTemp*,*maxTemp*,*stepTemp* ### cardMedia Page entityUpd,|*internalNameEntiy*|*heading*|*icon*|*title*|*author*|*volume*|*playpauseicon* ## Messages from Nextion Display ### startup page event,startup,version ### screensaver page event,screensaverOpen ### cardEntities Page 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 ### popupLight Page 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 ### popupShutter Page event,pageOpenDetail,popupShutter,internalNameEntity event,buttonPress,D,nameEntity,internalNameEntity,1,positionSlider,50 ### cardThermo Page event,pageOpen,0 event,tempUpd,*pageNumber*,*entityName*,*temperature* ### cardMedia Page 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 # Icons IDs ID | Icon -- | ---- 0 | ![window-open](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/window-open.svg) 1 | ![lightbulb](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/lightbulb.svg) 2 | ![thermometer](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/thermometer.svg) 3 | ![gesture-tap-button](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/gesture-tap-button.svg) 4 | ![flash](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/flash.svg) 5 | ![music](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/music.svg) 6 | ![check-circle-outline](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/check-circle-outline.svg) 7 | ![close-circle-outline](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/close-circle-outline.svg) 8 | ![pause](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/pause.svg) 9 | ![play](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/play.svg) 10 | ![palette](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/palette.svg) 11 | ![alert-circle-outline](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/alert-circle-outline.svg) 12 | ![weather-cloudy](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/weather-cloudy.svg) 13 | ![weather-fog](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/weather-fog.svg) 14 | ![weather-hail](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/weather-hail.svg) 15 | ![weather-lightning](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/weather-lightning.svg) 16 | ![weather-lightning-rainy](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/weather-lightning-rainy.svg) 17 | ![weather-night](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/weather-night.svg) 18 | ![weather-partly-cloudy](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/weather-partly-cloudy.svg) 19 | ![weather-pouring](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/weather-pouring.svg) 20 | ![weather-rainy](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/weather-rainy.svg) 21 | ![weather-snowy](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/weather-snowy.svg) 22 | ![weather-snowy-rainy](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/weather-snowy-rainy.svg) 23 | ![weather-sunny](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/weather-sunny.svg) 24 | ![weather-windy](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/weather-windy.svg) 25 | ![weather-windy-variant](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/weather-windy-variant.svg) 26 | ![water-percent](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/water-percent.svg) # Design Guidelines for Nextion HMI Project 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