-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
42 changed files
with
11,954 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
|
||
--- | ||
|
||
Before submitting a problem please check the troubleshooting section | ||
https://docs.openmqttgateway.com/upload/troubleshoot.html | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Steps to reproduce the behavior: | ||
1. Publish to '...' | ||
2. Subscribe on '....' | ||
3. See error | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots** | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
**Environment (please complete the following information):** | ||
* OpenMQTTGateway version used (V0.9.3, 0.8, development) | ||
* Library version related to the problem you have (if you have troubles with RF provide the version of RCSwitch library) | ||
* For IR and RF clarify if you tested with the basic examples given with these libraries | ||
|
||
**Additional context** | ||
Add any other context about the problem here. | ||
|
||
* You should not have a compilation error if you use the versions of the libraries linked into the libraries folder, this badges show you the state of the compilation | ||
[![Build Status](https://github.com/1technophile/OpenMQTTGateway/workflows/Build/badge.svg?branch=master)](https://github.com/1technophile/OpenMQTTGateway/actions) | ||
* If you are not sure this is a bug or an enhancement post your question to the forum below | ||
[![Community forum](https://img.shields.io/badge/community-forum-brightgreen.svg)](https://community.openmqttgateway.com) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
|
||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context or screenshots about the feature request here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## Description: | ||
|
||
|
||
## Checklist: | ||
- [ ] The pull request is done against the latest development branch | ||
- [ ] Only one feature/fix was added per PR and the code change compiles without warnings | ||
- [ ] I accept the [DCO](https://github.com/theengs/1decoder/blob/development/docs/participate/development.md#developer-certificate-of-origin). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Create and publish documentation | ||
on: | ||
workflow_dispatch: | ||
jobs: | ||
documentation: | ||
runs-on: ubuntu-latest | ||
name: Create the documentation and deploy it to GitHub Pages | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: "14.x" | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.7" | ||
- name: Install build dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install requests | ||
npm install | ||
- name: get lastest release tag | ||
id: last_release | ||
uses: InsonusK/[email protected] | ||
with: | ||
myToken: ${{ github.token }} | ||
view_top: 1 | ||
- name: Set version tag from git | ||
run: sed -i "s/version_tag/${{steps.last_release.outputs.tag_name}}/g" docs/.vuepress/config.js | ||
- name: Build documentation | ||
run: | | ||
python ./scripts/gen_wu.py ${GITHUB_REPOSITORY} | ||
npm run docs:build | ||
- name: Deploy to GitHub Pages | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./docs/.vuepress/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/build | ||
/node_modules | ||
.vscode | ||
.pio | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
pids | ||
logs | ||
node_modules | ||
npm-debug.log | ||
coverage/ | ||
run | ||
dist | ||
.DS_Store | ||
.nyc_output | ||
.basement | ||
config.local.js | ||
basement_dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Contributor Covenant Code of Conduct | ||
|
||
## Our Pledge | ||
|
||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. | ||
|
||
## Our Standards | ||
|
||
Examples of behavior that contributes to creating a positive environment include: | ||
|
||
* Using welcoming and inclusive language | ||
* Being respectful of differing viewpoints and experiences | ||
* Gracefully accepting constructive criticism | ||
* Focusing on what is best for the community | ||
* Showing empathy towards other community members | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery and unwelcome sexual attention or advances | ||
* Trolling, insulting/derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or electronic address, without explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a professional setting | ||
|
||
## Our Responsibilities | ||
|
||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. | ||
|
||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. | ||
|
||
## Scope | ||
|
||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. | ||
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. | ||
|
||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] | ||
|
||
[homepage]: http://contributor-covenant.org | ||
[version]: http://contributor-covenant.org/version/1/4/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,117 +1,21 @@ | ||
# 1decoder | ||
Theengs Decoder project aims to provide an efficient, portable and lightweight library for Internet of Things decoding. | ||
Sensors and devices use chains of data to communicate to gateways, computers, servers. Enabling to have lightweight and fast communication, on the other hand we have a huge diversity of communication methods, resulting in the sensors or devices to be closed to one ecosystem or a few. | ||
Theengs decoder is a library that gather things decoders and operate them so as to understand these things on a common format. This format can easily be integrated into different systems, these systems will be open thanks to the capabilities offered by the Theengs Decoder. | ||
|
||
# Using | ||
Theengs Decoder leverages json format to receive data and provide an enriched output. | ||
It's also a simplified way of defining the thing properties and how to decode these. | ||
|
||
Call `decodeBLEJson(JsonObject)` with the input being of the Arduino JSON JsonObject type. If the device is known the JsonObject will have the decoded device data added to it. | ||
![Overview](/docs/img/Theengs_decoder.jpg) | ||
|
||
### Example | ||
Input JsonObject: | ||
``` | ||
{ | ||
"servicedata": "712098000163b6658d7cc40d0410024001" | ||
} | ||
``` | ||
Theengs Decoder can be used on memory constraint environment like micro controllers (ESP32, ESP8266, Arduino), on PC or on a Unix server. | ||
It is setup with unit testing so as to assure that the modification done on the library doesn't affect previous capabilities. | ||
|
||
JsonObject after decoding: | ||
``` | ||
{ | ||
"servicedata": "712098000163b6658d7cc40d0410024001" | ||
"brand":"Xiaomi", | ||
"model":"miflora", | ||
"model_id":"HHCCJCY01HHCC", | ||
"tempc":32, | ||
"tempf":89.6 | ||
} | ||
``` | ||
In a few words: | ||
* Light | ||
* Portable | ||
* Expandable | ||
* Interoperable | ||
|
||
# Adding device decoding | ||
|
||
Device decode specifications are located in the [device_json.h](src/device_json.h) file. The format is: | ||
``` | ||
R""""( | ||
{ | ||
"brand":"Xiaomi", | ||
"model":"miflora", | ||
"model_id":"HHCCJCY01HHCC", | ||
"condition":["servicedata", "contain", "209800"], | ||
"properties":{ | ||
"tempc":{ | ||
"condition":["servicedata", 25, "4"], | ||
"decoder":["value_from_hex_data", "servicedata", 30, 4, true], | ||
"post_proc":['/', 10] | ||
}, | ||
"moi":{ | ||
"condition":["servicedata", 25, "8"], | ||
"decoder":["value_from_hex_data", "servicedata", 30, 2, false] | ||
}, | ||
"lux":{ | ||
"condition":["servicedata", 25, "7"], | ||
"decoder":["value_from_hex_data", "servicedata", 30, 6, true] | ||
}, | ||
"fer":{ | ||
"condition":["servicedata", 25, "9"], | ||
"decoder":["value_from_hex_data", "servicedata", 30, 4, true] | ||
} | ||
} | ||
})"""", | ||
``` | ||
|
||
Each device must provide a `brand`, `model`, `model_id`, `condition`, and `properties`. | ||
- `brand` = brand name of the device. | ||
- `model` = model name of the device. | ||
- `model_id` = model id number of the device. | ||
|
||
### Condition | ||
`condition` is a JSON array, which must contain as the first parameter, the data source to test for the condtion. Valid inputs are: | ||
- "servicedata" | ||
- "manufacturerdata" | ||
- "name" | ||
- "uuid" | ||
|
||
The second parameter is how the data should be tested. Valid inputs are: | ||
- "contain" tests if the specified value (see below) exists the data source | ||
- "index" tests if the specified value exists at the index location (see below) in the data source | ||
|
||
The third parameter can be either the index value or the data value to find. If the second parameter is `contain`, the third parameter should be the value to look for in the data source. If the second parameter is `index`, the third parameter should be the location in the data source to look for the value provided as the fourth parameter. | ||
|
||
`condition` can have multiple conditions chanined together using '|' and '&' between them. | ||
For example: `"condition":["servicedata", "index", 0, "0804", '|', "servicedata", "index", 0, "8804"]` | ||
This will match if the service data at index 0 is "0804" `OR` "8804". | ||
|
||
### Properties | ||
Properties is a nested JSON object containing one or more JSON objects. In the example above it looks like: | ||
``` | ||
"properties":{ | ||
"tempc":{ | ||
"condition":["servicedata", 25, "4"], | ||
"decoder":["value_from_hex_data", "servicedata", 30, 4, true], | ||
"post_proc":['/', 10] | ||
}, | ||
``` | ||
|
||
Here we have a single property that defines a value that we want to decode. The key "tempc" will be used as the key in the JsonObject provided when `decodeBLEJson(JsonObject)` is called. "tempc" in this example is another JSON object that has an (optional, explained below) `condition`, `decoder`, and `post_proc`. | ||
|
||
`condition` is a JSON array. The first parameter defines the data source of the condition to test and must be one of: | ||
- "servicedata" | ||
- "manufacturerdata" | ||
|
||
The second parameter is the index of the data source to look for the value. The third parameter is the value to test for. | ||
If the condition is met the data will be decoded and added to the JsonObject. | ||
|
||
`decoder` is a JSON array that specifies the decoder function and parameters to decode the value. The first parameter is the name of the function to call, currently only "value_from_hex_data" is valid. The other parameters are: | ||
- "servicedata", Extract the value from the service data. Could also be "manufacturerdata" | ||
- 30, The index of the data source where the value exists. | ||
- 4, The length of the data in bytes (characters in the string). | ||
- true/false, If the value in the data source should have it's endianness reversed before converting. | ||
- (optional)true/false, Sets if the resulting value can be a negative number. | ||
|
||
`post_proc` This specifies any post processing of the resulting decoded value. This is a JSON array that should be written in the order that the operation order is desired. In the simple example the first parameter is the '/' divide operation and the second parameter (10) is the value to divide the result by. Multiple operations can be chained together in this array to perform more complex calculations. Valid operations are: | ||
- '/' divide | ||
- '*' multiply | ||
- '+' add | ||
- '-' subtract | ||
- '<' shift left | ||
- '>' shift right | ||
- '!' Not (invert), useful for bool types | ||
|
||
`val_bits` (Not shown in the example) is an additional parameter that can be added to define the value. It will convert the post processed result into a value with the number of bits specified by `val_bits`. Valid values are: 1 (for bool), 8, 16, 32. Double is the default type if this is omitted. | ||
::: warning Note | ||
The material and information contained in this documentation is for general information purposes only. You should not rely upon the material or information on this documentation as a basis for making any business, legal or any other decisions. There is no warranty given on this documentation content. If you decide to follow the information and materials given it is at your own risk. I will not be liable for any false, inaccurate, inappropriate or incomplete information presented on this website. | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
module.exports = { | ||
markdown: { | ||
lineNumbers: true | ||
}, | ||
title: 'Theengs decoder', | ||
description: 'One decoder for many devices, decode easily your BLE devices data and transform these into a readable format', | ||
head: [ | ||
['link', { rel: 'icon', href: '/img/Openmqttgateway_logo_mini.png' }], | ||
['link', { rel: 'manifest', href: '/manifest.json' }], | ||
['meta', { name: 'theme-color', content: '#3eaf7c' }], | ||
['meta', { name: 'apple-mobile-web-app-capable', content: 'yes' }], | ||
['meta', { name: 'apple-mobile-web-app-status-bar-style', content: 'black' }], | ||
['link', { rel: 'mask-icon', href: '/icons/safari-pinned-tab.svg', color: '#3eaf7c' }], | ||
['meta', { name: 'msapplication-TileImage', content: '/icons/msapplication-icon-144x144.png' }], | ||
['meta', { name: 'msapplication-TileColor', content: '#000000' }], | ||
['script', {type: 'module', src: 'https://unpkg.com/[email protected]/dist/web/install-button.js?module'}] | ||
], | ||
themeConfig: { | ||
smoothScroll: true, | ||
repo: 'theengs/1decoder', | ||
docsDir: 'docs', | ||
docsBranch: 'master', | ||
lastUpdated: 'Last Updated', | ||
editLinks: true, | ||
sidebar: [ | ||
['/','0 - What is it for 🏠'], | ||
{ | ||
title: '1 - Devices 🌡️', // required | ||
sidebarDepth: 1, // optional, defaults to 1 | ||
children: [ | ||
'devices/CGD1', | ||
'devices/CGDK2', | ||
'devices/CGG1', | ||
'devices/CGH1', | ||
'devices/CGP1W', | ||
'devices/CGPR1', | ||
'devices/H5072', | ||
'devices/H5075', | ||
'devices/HHCCJCY01HHCC', | ||
'devices/LYWSD02', | ||
'devices/LYWSD03MMC_ATC', | ||
'devices/LYWSD03MMC_PVVX', | ||
'devices/LYWSDCGQ', | ||
'devices/Miband', | ||
'devices/MUE4094RT', | ||
'devices/TPMS', | ||
'devices/VEGTRUG', | ||
'devices/WS02', | ||
'devices/XMTZC04HM', | ||
'devices/XMTZC05HM' | ||
] | ||
}, | ||
{ | ||
title: '2 - Use ✈️', // required | ||
sidebarDepth: 1, // optional, defaults to 1 | ||
children: [ | ||
'use/use' | ||
] | ||
}, | ||
{ | ||
title: '3 - Participate 💻', // required | ||
sidebarDepth: 1, // optional, defaults to 1 | ||
children: [ | ||
'participate/support', | ||
'participate/development', | ||
'participate/adding-decoders' | ||
] | ||
} | ||
] | ||
}, | ||
plugins: [ | ||
['@vuepress/pwa', { | ||
serviceWorker: true, | ||
updatePopup: true | ||
}], | ||
['@vuepress/medium-zoom', true], | ||
['@vuepress/nprogress'] | ||
] | ||
} |
Oops, something went wrong.