Skip to main content

A Python CLI to minify Heishamon rules

Project description

HeishaMon Rules Minify

A Python CLI to minify Heishamon rules

HeishaMon is a project to read out a Panasonic air-water heat pump using an ESP8266 board. The HeishaMon firmware also supports the use of rules, to control the heatpump from within the HeishaMon itself. Since the ruleset must be stored within HeishaMon, its size must be limited. Therefore, it is best to use short function and variable names in order to maximize the number of rules that can be stored. Moreover, the rules library does not support comments in a ruleset, making it hard to read and maintain a ruleset, but also making it hard to share the ruleset with other.

This project aims to overcome these issues by making it possible write a ruleset with comments and descriptive function and variables names, and then minifying it. This way it is still possible to maximize the number of rules on the HeishaMon.

Note: The minifier should work for both the rule library used in version 3.2.3 and this updated rule libaray version. In the rule library from version 3.2.3, the elseif statement cannot be used

Installation

python3 -m pip install heishamon_rules_minify

Usage example

Start by creating a ruleset that adheres to the HeishaMon rules syntax, but can use the following extras:

  • Single line comments starting with -- or block comments between --[[ and ]].
  • Custom function and variable names will be minified to only keep the first letter (which will be capitalised) and capital letters, so for example #WaterTemperature will become #WT, #allowDHW will become #ADHW.

When the ruleset is finished, minify it using the following command:

heishamon-rules-minify [input_file] [output_file]

This will shorten all custom function and variable names and remove all unneeded spaces and newlines.

Extra options

There are a couple of extra options to pass with the minifier:

  • --print or -p to also print the output on the command line.
  • --comments_only or -c to only remove the comments from the input file but do no further minifying.

Release History

  • 0.0.1
    • Initial version
  • 0.0.2
    • Fix incorrect spacing for double operators, minor bugfixes
  • 0.0.3
    • Add option to only remove comments

Contributing

  1. Fork it (https://github.com/yourname/yourproject/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

heishamon_rules_minify-0.0.3.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

heishamon_rules_minify-0.0.3-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file heishamon_rules_minify-0.0.3.tar.gz.

File metadata

File hashes

Hashes for heishamon_rules_minify-0.0.3.tar.gz
Algorithm Hash digest
SHA256 14606e1f9bea6510005b33d36827cf1e1c183d5d6a09d85df71a743c689aaddd
MD5 3e8f4743c9eac039baaff76cdacc5230
BLAKE2b-256 7365faee93c571731b8ac1bdccd0ad565cc7204b8995dad8767f7522e44ea452

See more details on using hashes here.

File details

Details for the file heishamon_rules_minify-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for heishamon_rules_minify-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 dfb9d434a07c8403fb450510a9aafd1598d3f5dcc8106401ac38dc3f2aca07d1
MD5 0a9f70f6a6aacffd13c03a48d8f1d327
BLAKE2b-256 0964bf0a499bafbff219ba2bd7389c00853a5f98d166703758cf26d525007ad7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page