mclimate-payload-helper 1.0.31 → 1.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +20 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1 +1,20 @@
1
- # mclimate-payload-helper
1
+ # mclimate-payload-helper
2
+
3
+ ## How to add decoders for new devices
4
+
5
+ - Add new device type in src/decoders/payloadParsers/types/allDevices.ts following the established naming convention
6
+ - Add new device payload parser in src/decoders/payloadParsers. Make sure to export the class in the index.ts file so that it can be imported later using absolute imports with @
7
+ - Add new device payload parser in src/decoders/payloadParsers
8
+ - Add the new parser to src/decoders/payloadParsers/uplinkPayLoadParser appending a new case DeviceType.NEW_DEVICE
9
+ - Add a new command (if needed) in src/decoders/commandsReadingHelper. Make sure to add a break statement after the new 'case' - follow the example from previous commands
10
+
11
+ ## How to add new commands in encoder
12
+
13
+ - Add new device command class in src/encoders. By design each device command class extends GeneralCommands. If the new device extends further classes - .e.g. Temperature, use the applyMixins utility function - check out the bottom of CO2DisplayCommands for an example. In case you want to exclude certain commands - you can use the delMethods utility function - the CO2DisplayCommands class has an example of this as well. Make sure to add the new class to the index.ts file.
14
+ - Add a schema and type for the new device command class in src/encoders/types/schemas. Follow the example from other devices. By default all device schemas spread the GeneralCommandSchemas. Some devices also inherit from other schemas and you can spread these directly in the schema object. In case only certain commands from a schema are inherited (e.g. only a few from DisplayCommands) - these need to be copied explicitly into the schema. Once the schema is complete, add the typing namespace below it - you only need to add the types for the "set" commands as only they are typed in the device command class.
15
+
16
+ ## How to publish a new version of the package
17
+
18
+ - Bump the version in package.json
19
+ - Run 'npm publish'
20
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mclimate-payload-helper",
3
- "version": "1.0.31",
3
+ "version": "1.0.32",
4
4
  "description": "Mclimate payload helper",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",