Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process protocol.json #20

Closed
2 of 4 tasks
andreondra opened this issue Jan 25, 2023 · 8 comments
Closed
2 of 4 tasks

Process protocol.json #20

andreondra opened this issue Jan 25, 2023 · 8 comments
Assignees
Labels
sermatec protocol Protocol reverse-engineering

Comments

@andreondra
Copy link
Member

andreondra commented Jan 25, 2023

A file describing whole protocol was found - it can't be published in its original form but it will probably help to implement the rest of the protocol without a need of a packet sniffing.

  • Translate from Chinese
  • Verify the information in the file
  • Rewrite the information from the file to the documentation
  • (future issues) Implement
@andreondra andreondra added the sermatec protocol Protocol reverse-engineering label Jan 25, 2023
@andreondra andreondra self-assigned this Jan 25, 2023
@mathieupotier
Copy link
Member

wonderful \o/

@sbechet
Copy link

sbechet commented Jan 27, 2023

My small contribution : https://github.com/sbechet/sermatec-ess

@andreondra
Copy link
Member Author

andreondra commented Jan 28, 2023

@sbechet Great find! If you want, you may add these to the docs folder in this repo and send a PR. I'll translate the files and we can use them to enhance the script.

@sbechet
Copy link

sbechet commented Jan 29, 2023

Hello andreondra,

Thank you for your work.
I added a small script to manage the translation automation to plan the next versions of the android application.

json file is self supporting for documentation

I think it will be a better idea to use this json file directly. I don't know if you mean rust but we can use clap crate for cli, json serde crate to deserialize the json file then, maybe nom crate for some of the rest. It seems to me that it will be less work than rewriting everything manually.

What do you think ? Good or bad idea ?

@andreondra
Copy link
Member Author

Hi @sbechet,

the files you found appear to contain all the information needed (the file I found had a different structure and some information were missing, so it was kinda unreliable source). If we verify that these files contain correct information, we should use them directly, as you say, that's the way the original app works.

That would allow us not only to generate the Markdown documentation easily, but also to load all the information in the script directly from the files - now as you can see the commands are hard-coded, which was OK for a few commands but if we want to support all of the them (and keep up to date), it would be a pain to maintain.

However, there are some things we need to adjust in the original jsons:

  1. Translate the descriptions and check the translations for the syntactical or semantic errors.
  2. Add tags to fields where they are missing so we can use them to generate an output json in the script (the field names are also hard-coded in the current script version = horrible).

So I suggest we inspect the structure of the jsons, verify the compatibility and write a script that will preprocess the files (translate, add the tags and probably some more enhancements). The cn2en.sh is a good start.

From the preprocessed files we can generate the docs and load the commands in the script, making the json files the single source of truth.

Thank you for your suggestion and let me know what do you think.

@mathieupotier
Copy link
Member

Information in file seems really useful, checked few addresses in my proxy, seems that we're on the good way doing something amazing... ^_^

@mathieupotier
Copy link
Member

mathieupotier commented Feb 3, 2023

Hi @andreondra,

I'm checking out all information in this file, I'll made a PR to update your sensors.

Tested the file data : seems really reliable, don't get all informations filled, but probably due to my hardware setup...
image

  • System Information ✅
  • Battery Information ✅
  • Control Cabinet Information 🚧

@andreondra
Copy link
Member Author

Hi @mathieupotier,

good job! That sounds wonderful. I'll focus on making a protocol.json parser and I'll also open new relevant issues, so have a look and let me know if you wanna work on any or open another issue. :)

This issue will be closed now, because the project will be now re-implemented as I described in this comment based on @sbechet's suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sermatec protocol Protocol reverse-engineering
Projects
None yet
Development

No branches or pull requests

3 participants