Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
openshwprojects committed Jul 30, 2022
2 parents c35a357 + fa8cf45 commit dd9a3a3
Show file tree
Hide file tree
Showing 9 changed files with 159 additions and 36 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@ jobs:
with:
submodules: recursive
- name: Update SDKs if required
run: make update-submodules
run: make update-submodules
- name: Semantic Release
id: semantic
uses: cycjimmy/semantic-release-action@v2
uses: cycjimmy/semantic-release-action@v3
with:
dry_run: true
semantic_version: 18
semantic_version: 19
extra_plugins: |
@semantic-release/changelog
@semantic-release/git
conventional-changelog-conventionalcommits
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set outputs
Expand Down Expand Up @@ -102,7 +103,7 @@ jobs:
name: Semantic Release Images and Artifacts
runs-on: ubuntu-latest
needs: [ refs, build ]
if: always() && needs.refs.outputs.new_release == 'true' && github.ref == 'refs/heads/main'
if: always() && needs.refs.outputs.new_release == 'true' && (github.ref == 'refs/heads/main' || github.ref_name == 'alpha')
steps:
- name: Source checkout
uses: actions/checkout@v2
Expand All @@ -113,13 +114,14 @@ jobs:
path: output/${{ needs.refs.outputs.version }}
- name: Run Semantic Release
id: semantic
uses: cycjimmy/semantic-release-action@v2
uses: cycjimmy/semantic-release-action@v3
with:
dry_run: false
semantic_version: 18
semantic_version: 19
extra_plugins: |
@semantic-release/changelog
@semantic-release/git
conventional-changelog-conventionalcommits
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Echo Semantic Release Versions
Expand Down
132 changes: 106 additions & 26 deletions .releaserc.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
branches:
- 'main'
- name: 'alpha'
prerelease: true
preset: "angular"
tagFormat: "${version}"
plugins:
Expand Down Expand Up @@ -40,34 +42,112 @@ generateNotes:
- "perf"
- "fix"
commitsSort: "header"
types:
- type: "feat"
- section: "Features"
# Tracked bug fix with a hotfix branch
- type: "hotfix"
- section: "Bug Fixes"
# Uninmportent fix (CI testing, etc)
- type: "fix"
- section: "Bug Fixes"
- type: "chore"
- section: "Bug Fixes"
- type: "docs"
- hidden: true
- type: "doc"
- hidden: true
- type: "style"
- hidden: true
- type: "refactor"
- hidden: true
- type: "perf"
- hidden: true
- type: "test"
- hidden: true
presetConfig: true
mainTemplate: |
{{> header}}
{{#if noteGroups}}
{{#each noteGroups}}
### ⚠ {{title}}
{{#each notes}}
* {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{text}}
{{/each}}
{{/each}}
{{/if}}
{{#each commitGroups}}
{{#if title}}
### {{title}}
{{/if}}
{{#each commits}}
{{> commit root=@root}}
{{/each}}
{{/each}}
{{> footer}}
headerPartial: |
## OpenBK7231T/OpenBeken release {{version}}
OpenBK7231T/OpenBeken is a Tasmota/Esphome replacement for new Tuya modules featuring MQTT and Home Assistant compatibility. This repository is named <code>OpenBK7231T_App</code>, but now it's a multiplatform app, supporting build for multiple separate chips:
- BK7231T (WB3S, WB2S, WB2L, etc)
- BK7231N (CB2S, CB2L, WB2L_M1, etc)
- T34 (T34 is based on BK7231N)
- XR809 (XR3, etc)
- BL602
- W800 (W800-C400, WinnerMicro WiFi & Bluetooth), W801
footerPartial: |
{{#if noteGroups}}
{{#each noteGroups}}
### {{title}}
{{#each notes}}
* {{text}}
{{/each}}
{{/each}}
{{/if}}
### Assets
Refer to the following table for the usage of the various assests included in this release
| Platform | Usage | Filename |
| --- | --- | --- |
| BK7231T | OTA Update | [OpenBK7231T_{{version}}.rbl]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231T_{{version}}.rbl) |
| BK7231T | CCtr Flash | [OpenBK7231T_UG_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231T_UG_{{version}}.bin) |
| BK7231T | UART Flash | [OpenBK7231T_UA_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231T_UA_{{version}}.bin) |
| BK7231N | OTA Update | [OpenBK7231N_{{version}}.rbl]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231N_{{version}}.rbl) |
| BK7231N | CCtr Flash | [OpenBK7231N_UG_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231N_UG_{{version}}.bin) |
| BK7231N | UART Flash | [OpenBK7231N_QIO_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBK7231N_QIO_{{version}}.bin) |
| XR809 | | [OpenXR809_{{version}}.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenXR809_{{version}}.img) |
| BL602 | UART Flash | [OpenBL602_{{version}}.bin]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenBL602_{{version}}.bin) |
| W800 | OTA Update | [OpenW800_{{version}}_ota.img]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenW800_{{version}}_ota.img) |
| W800 | UART Flash | [OpenW800_{{version}}.fls]({{host}}/{{owner}}/{{repository}}/releases/download/{{version}}/OpenW800_{{version}}.fls) |
CCtr Flash = Tuya cloud Cutter flash
Flashing instructions are available on the project's [README.md]({{host}}/{{owner}}/{{repository}}#readme)
preset: conventionalcommits
presetConfig:
types:
- type: "feat"
section: "Features"
# Tracked bug fix with a hotfix branch
- type: "hotfix"
section: "Bug Fixes"
# Uninmportent fix (CI testing, etc)
- type: "fix"
section: "Bug Fixes"
hidden: false
- type: "chore"
section: "Changes"
hidden: false
- type: "docs"
section: "Changes"
hidden: false
- type: "doc"
section: "Changes"
hidden: false
- type: "style"
section: "Changes"
hidden: false
- type: "refactor"
section: "Changes"
hidden: false
- type: "perf"
section: "Changes"
hidden: false
- type: "test"
section: "Changes"
hidden: false
- type: ""
section: "Changes"
hidden: false
prepare:
- path: "@semantic-release/git"
- path: "@semantic-release/changelog"
changelogFile: "CHANGELOG.md"
publish:
- path: "@semantic-release/github"
addReleases: "bottom"
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@ the commands above return a single ASCII string as a reply so it's easy to parse

https://www.elektroda.com/rtvforum/viewtopic.php?p=20031489#20031489

# TuyaMCU example with Tuya 5 Speed Fan Controller by TEQOOZ - BK7231T - WB3S

Home Assistant Yaml examples. Please refer to this example:

https://www.elektroda.com/rtvforum/topic3908093.html

# TuyaMCU WB2S "Moes House" Dimmer configuration example with Home Assistant, see here:

https://www.elektroda.com/rtvforum/topic3898502.html
Expand All @@ -237,7 +243,6 @@ https://www.elektroda.com/rtvforum/topic3898502.html

Please refer to this step by step guide:
https://www.elektroda.com/rtvforum/topic3887748.html


# ZN268131 example, a smart switch that allows you to connect a bistable button

Expand Down
2 changes: 1 addition & 1 deletion sdk/OpenBL602
1 change: 1 addition & 0 deletions src/httpserver/http_fns.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ template_t g_templates [] = {
{ Setup_Device_Empty, "Empty"},
// BK7231N devices
{ Setup_Device_BK7231N_CB2S_QiachipSmartSwitch, "[BK7231N][CB2S] QiaChip Smart Switch"},
{Setup_Device_BK7231N_KS_602_TOUCH, "[BK7231N] KS 602 Touch Switch US"},
// BK7231T devices
{ Setup_Device_BK7231T_WB2S_QiachipSmartSwitch, "[BK7231T][WB2S] QiaChip Smart Switch"},
{ Setup_Device_TuyaWL_SW01_16A, "WL SW01 16A"},
Expand Down
22 changes: 21 additions & 1 deletion src/httpserver/new_http.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,13 @@ void HTTP_AddBuildFooter(http_request_t *request) {
// call with str == NULL to force send. - can be binary.
// supply length
int postany(http_request_t *request, const char *str, int len){
#if PLATFORM_BL602
send(request->fd,str,len,0);
return 0;
#else
int currentlen;
int addlen = len;

if (NULL == str){
send(request->fd, request->reply, request->replylen, 0);
request->reply[0] = 0;
Expand All @@ -351,6 +356,7 @@ int postany(http_request_t *request, const char *str, int len){
request->replylen += addlen;
}
return (currentlen + addlen);
#endif
}


Expand Down Expand Up @@ -414,6 +420,11 @@ int HTTP_ProcessPacket(http_request_t *request) {
//int bChanged = 0;
char *urlStr = "";

if (request->received == 0){
ADDLOGF_ERROR("You gave request with NULL input");
return 0;
}

char *recvbuf = request->received;
for ( i = 0; i < sizeof(methodNames)/sizeof(*methodNames); i++){
if (http_startsWith(recvbuf, methodNames[i])){
Expand All @@ -426,6 +437,10 @@ int HTTP_ProcessPacket(http_request_t *request) {
ADDLOGF_ERROR("unsupported method %7s", recvbuf);
return 0;
}
if (request->reply == 0){
ADDLOGF_ERROR("You gave request with NULL buffer");
return 0;
}

if (request->method == HTTP_GET) {
//ADDLOG_INFO(LOG_FEATURE_HTTP, "HTTP request\n");
Expand Down Expand Up @@ -499,6 +514,12 @@ int HTTP_ProcessPacket(http_request_t *request) {

request->bodystart = p;
request->bodylen = request->receivedLen - (p - request->received);
#if 0
postany(request,"test",4);
return 0;
#elif 0
return http_fn_empty_url(request);
#endif

// look for a callback with this URL and method, or HTTP_ANY
for (i = 0; i < numCallbacks; i++){
Expand All @@ -510,7 +531,6 @@ int HTTP_ProcessPacket(http_request_t *request) {
}
}
}

if(http_checkUrlBase(urlStr,"")) return http_fn_empty_url(request);

if(http_checkUrlBase(urlStr,"index")) return http_fn_index(request);
Expand Down
14 changes: 14 additions & 0 deletions src/new_builtin_devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,20 @@ void Setup_Device_BK7231N_CB2S_QiachipSmartSwitch() {

CFG_Save_SetupTimer();
}

void Setup_Device_BK7231N_KS_602_TOUCH() {
CFG_ClearPins();

PIN_SetPinRoleForPinIndex(17, IOR_Relay);
PIN_SetPinChannelForPinIndex(17, 1);

PIN_SetPinRoleForPinIndex(26, IOR_Button);
PIN_SetPinChannelForPinIndex(26, 1);

CFG_SetFlag(OBK_FLAG_BTN_INSTANTTOUCH,true);
CFG_Save_SetupTimer();
}

void Setup_Device_BK7231T_WB2S_QiachipSmartSwitch() {
CFG_ClearPins();
// Button
Expand Down
1 change: 1 addition & 0 deletions src/new_pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ void Setup_Device_DS_102_3Gang_WB3S();
void Setup_Device_BK7231T_Gosund_Switch_SW5_A_V2_1();
void Setup_Device_13A_Socket_CB2S();
void Setup_Device_Deta_Smart_Double_Power_Point_6922HA_Series2();
void Setup_Device_BK7231N_KS_602_TOUCH();

#endif

2 changes: 1 addition & 1 deletion src/user_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ OSStatus rtos_create_thread( beken_thread_t* thread,
OSStatus err = kNoErr;


err = xTaskCreate(function, name, stack_size/sizeof(StackType_t), arg, 1, thread);
err = xTaskCreate(function, name, stack_size/sizeof(StackType_t), arg, priority, thread);
/*
BaseType_t xTaskCreate(
TaskFunction_t pvTaskCode,
Expand Down

0 comments on commit dd9a3a3

Please sign in to comment.