Skip to content

Commit

Permalink
Merge pull request #10 from Luligu/dev
Browse files Browse the repository at this point in the history
Release 0.5.1
  • Loading branch information
Luligu authored Jun 25, 2024
2 parents a0a351b + d4f7f4c commit 63eae14
Show file tree
Hide file tree
Showing 16 changed files with 891 additions and 92 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

All notable changes to this project will be documented in this file.

## [0.5.1] - 2024-06-25

### Added

- [color]: Added ColorControl cluster to shelly device with rgb.
- [current]: Added the current value to EveHistory electrical cluster.

### Fixed

- [cover]: Fix cover move to position for gen 2.
- [power]: Fix power value update.

<a href="https://www.buymeacoffee.com/luligugithub">
<img src="./yellow-button.png" alt="Buy me a coffee" width="120">
</a>

## [0.4.0] - 2024-06-23

### Added
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "matterbridge-shelly",
"version": "0.4.0",
"version": "0.5.1",
"description": "Matterbridge shelly plugin",
"author": "https://github.com/Luligu",
"license": "Apache-2.0",
Expand Down
45 changes: 40 additions & 5 deletions src/auth.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
/**
* This file contains the auth functions.
*
* @file src\auth.ts
* @author Luca Liguori
* @date 2024-05-01
* @version 1.0.0
*
* Copyright 2024, 2025 Luca Liguori.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License. *
*/

import crypto from 'crypto';
/*
import { AnsiLogger, TimestampFormat, db, idn, rs, zb } from 'node-ansi-logger';
import { Shelly } from './shelly.js';
import { ShellyDevice } from './shellyDevice.js';
*/

export interface AuthParams {
realm: string; // device_id
Expand Down Expand Up @@ -53,6 +71,22 @@ export function getGen1BodyOptions(params?: Record<string, string | number | boo
return new URLSearchParams(params as any).toString();
}

/*
options: {
"method":"POST",
"headers": {
"Content-Type":"application/json"
},
"body": "{
\"jsonrpc\":\"2.0\",
\"id\":10,
\"src\":\"Matterbridge\",
\"method\":\"Cover.GoToPosition \",
\"params\":{\"id\":0,\"pos\":90}
}"
}
*/

export function getGen2BodyOptions(jsonrpc: string, id: number, src: string, method: string, params?: Record<string, string | number | boolean>, auth?: AuthParams): string {
const body: Record<string, string | number | boolean | object | AuthParams> = {};
body.jsonrpc = '2.0';
Expand All @@ -61,6 +95,7 @@ export function getGen2BodyOptions(jsonrpc: string, id: number, src: string, met
body.method = method;
if (params) body.params = params;
if (auth) body.auth = auth;
// console.log(JSON.stringify(body));
return JSON.stringify(body);
}

Expand Down
23 changes: 23 additions & 0 deletions src/ble.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
/**
* This file contains the ble functions.
*
* @file src\ble.ts
* @author Luca Liguori
* @date 2024-05-01
* @version 1.0.0
*
* Copyright 2024, 2025 Luca Liguori.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License. *
*/

/*
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { AnsiLogger, TimestampFormat, db, debugStringify, dn, hk, nf, rs, wr, zb } from 'node-ansi-logger';
Expand Down
23 changes: 23 additions & 0 deletions src/coapServer.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
/**
* This file contains the class CoapServer.
*
* @file src\coapServer.ts
* @author Luca Liguori
* @date 2024-05-01
* @version 1.0.0
*
* Copyright 2024, 2025 Luca Liguori.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License. *
*/

import { AnsiLogger, BLUE, CYAN, MAGENTA, RESET, TimestampFormat, db, debugStringify, idn, rs } from 'node-ansi-logger';
import coap, { Server, IncomingMessage, OutgoingMessage, globalAgent } from 'coap';
import EventEmitter from 'events';
Expand Down
Loading

0 comments on commit 63eae14

Please sign in to comment.