HMI file format

Has anyone tried to reverse engineer the HMI file format? I tried contacting them and asking if they where willing to share the file format, so i could write a open-source alternative for their buggy Editor - but they where mad for asking…

I really like the screens, but the screen editor is a disaster - i would love to rewrite a editor that would work alot better than what they have created, but i cant figure out the file format (dont have enough time after working hours) so if someone already found the fileformat, sharing would be great :smiley:

Hi @ERDesigns

Great to hear that you‘re motivated for such a big project. Having a better editor would be great.
The HMI file format is well understood. However, no public documentation exists so far. We‘re currently discussing internally if and how we should make it public.

In the meantime you could have a look at my open source Nextion2Text project. While it has no ability to write HMI files it is able to read them correctly. And not only that, it is also able to interpret the various component attributes and their dependencies. I went into the details of how this works in the following post: Convert Nextion to Text - #21 by Max

Kind regards,
Max

3 Likes

Thank you - you did all the hard work already :smile: i will study your project, and try to write a parser myself! This will help me a lot - thank you very much :smile:

2 Likes

I Did something similar to pre 0.38 editor files. Read an .HMI file and generate the code to use it with Arduino.Unfortunately with the new editor thr generator needs a new writeup. I would be interested to figure out how HMI definitions are these days.

#ifndef TEST1_H
#define TEST1_H
//
// include file generated from HMI file TEST1.HMI
// HMI file was created with Nextion IDE version V0.43
// generated on 2017-02-09T15:05:06
//

#include <Arduino.h>
#include <Nextion.h>
/**
 * Structure of page: MainScreen
 */
struct {
    NexPage MainScreen = NexPage (0, 0, "MainScreen"); 
    NexButton ButtonOn = NexButton(0, 1, "ButtonOn"); 
    NexButton ButtonOff = NexButton(0, 2, "ButtonOff"); 
    NexText DisplayText = NexText(0, 3, "DisplayText"); 
} MainScreen_str;

void OnRelease_MainScreen_ButtonOn(void *ptr);
/**
 * @name MainScreen_ButtonOn_ReleaseCallBack
 * @param ptr Pointer to ButtonOnobject that generated this event 
 * is called when a release event is generated from button ButtonOn
 */
void MainScreen_ButtonOn_ReleaseCallBack (void *ptr) { 
    OnRelease_MainScreen_ButtonOn(&ptr);
}

void OnRelease_MainScreen_ButtonOff(void *ptr);
/**
 * @name MainScreen_ButtonOff_ReleaseCallBack
 * @param ptr Pointer to ButtonOffobject that generated this event 
 * is called when a release event is generated from button ButtonOff
 */
void MainScreen_ButtonOff_ReleaseCallBack (void *ptr) { 
    OnRelease_MainScreen_ButtonOff(&ptr);
}

/**
 * @name attachCallBacks()
 * attaches our callback functions to the Nextion system
 */
void attachCallBacks() {
   MainScreen_str.ButtonOn.attachPop(MainScreen_ButtonOn_ReleaseCallBack, &(MainScreen_str.ButtonOn)   MainScreen_str.ButtonOff.attachPop(MainScreen_ButtonOff_ReleaseCallBack, &(MainScreen_str.ButtonOff));
   MainScreen_str.ButtonOff.attachPop(MainScreen_ButtonOff_ReleaseCallBack, &(MainScreen_str.ButtonOff));
}
/**
 * @name nex_listen_list
 * is a list of all objects that need listening to
 */
NexTouch * nex_listen_list[] {
   &MainScreen_str.ButtonOn,
   &MainScreen_str.ButtonOff,
   NULL
};

#endif

I wrote a topic on it on my site a long time ago.
see: http://www.verelec.nl/?page_id=716
Regards
Nico

Is there any more documentation available yet for the HMI file format? I’m interested in writing a utility that will automatically resize pages and components from 240x320 screens to the 3.5" 320x480. I have something based off of the information in Nextion2Text that will bash the properties for x, y, w, h, endx and endy in place, avoiding the need to fully recreate the file, but the resulting file won’t load in the editor, presumably because there is a CRC check in the page header. Is the algorithm for the CRC known?