@ymyzk/homebridge-echonet-lite 1.0.29 → 1.0.30
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.
- package/package.json +4 -1
- package/.claude/settings.local.json +0 -8
- package/.github/workflows/publish.yml +0 -26
- package/.idea/codeStyles/Project.xml +0 -57
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/homebridge-echonet-lite.iml +0 -9
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/.prettierignore +0 -1
- package/.prettierrc +0 -3
- package/sample.js +0 -90
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "Homebridge Echonet Lite",
|
|
3
3
|
"name": "@ymyzk/homebridge-echonet-lite",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.30",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"lib"
|
|
8
|
+
],
|
|
6
9
|
"repository": {
|
|
7
10
|
"type": "git",
|
|
8
11
|
"url": "https://github.com/ymyzk/homebridge-echonet-lite.git"
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
name: Publish to npm
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- 'v*.*.*'
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
publish:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
permissions:
|
|
12
|
-
contents: read
|
|
13
|
-
id-token: write # Required for npm provenance attestation
|
|
14
|
-
steps:
|
|
15
|
-
- uses: actions/checkout@v4
|
|
16
|
-
|
|
17
|
-
- uses: actions/setup-node@v4
|
|
18
|
-
with:
|
|
19
|
-
node-version: '20'
|
|
20
|
-
registry-url: 'https://registry.npmjs.org'
|
|
21
|
-
|
|
22
|
-
- run: npm ci
|
|
23
|
-
|
|
24
|
-
- run: npm publish --provenance --access public
|
|
25
|
-
env:
|
|
26
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
<component name="ProjectCodeStyleConfiguration">
|
|
2
|
-
<code_scheme name="Project" version="173">
|
|
3
|
-
<HTMLCodeStyleSettings>
|
|
4
|
-
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
|
5
|
-
</HTMLCodeStyleSettings>
|
|
6
|
-
<JSCodeStyleSettings version="0">
|
|
7
|
-
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
8
|
-
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
|
9
|
-
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
10
|
-
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
|
|
11
|
-
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
|
12
|
-
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
13
|
-
</JSCodeStyleSettings>
|
|
14
|
-
<TypeScriptCodeStyleSettings version="0">
|
|
15
|
-
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
16
|
-
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
|
17
|
-
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
18
|
-
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
|
|
19
|
-
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
|
20
|
-
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
21
|
-
</TypeScriptCodeStyleSettings>
|
|
22
|
-
<VueCodeStyleSettings>
|
|
23
|
-
<option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
|
|
24
|
-
<option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
|
|
25
|
-
</VueCodeStyleSettings>
|
|
26
|
-
<codeStyleSettings language="HTML">
|
|
27
|
-
<option name="SOFT_MARGINS" value="120" />
|
|
28
|
-
<indentOptions>
|
|
29
|
-
<option name="INDENT_SIZE" value="2" />
|
|
30
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
31
|
-
<option name="TAB_SIZE" value="2" />
|
|
32
|
-
</indentOptions>
|
|
33
|
-
</codeStyleSettings>
|
|
34
|
-
<codeStyleSettings language="JavaScript">
|
|
35
|
-
<option name="SOFT_MARGINS" value="120" />
|
|
36
|
-
<indentOptions>
|
|
37
|
-
<option name="INDENT_SIZE" value="2" />
|
|
38
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
39
|
-
<option name="TAB_SIZE" value="2" />
|
|
40
|
-
</indentOptions>
|
|
41
|
-
</codeStyleSettings>
|
|
42
|
-
<codeStyleSettings language="TypeScript">
|
|
43
|
-
<option name="SOFT_MARGINS" value="120" />
|
|
44
|
-
<indentOptions>
|
|
45
|
-
<option name="INDENT_SIZE" value="2" />
|
|
46
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
47
|
-
<option name="TAB_SIZE" value="2" />
|
|
48
|
-
</indentOptions>
|
|
49
|
-
</codeStyleSettings>
|
|
50
|
-
<codeStyleSettings language="Vue">
|
|
51
|
-
<option name="SOFT_MARGINS" value="120" />
|
|
52
|
-
<indentOptions>
|
|
53
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
54
|
-
</indentOptions>
|
|
55
|
-
</codeStyleSettings>
|
|
56
|
-
</code_scheme>
|
|
57
|
-
</component>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="JAVA_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
-
<exclude-output />
|
|
5
|
-
<content url="file://$MODULE_DIR$" />
|
|
6
|
-
<orderEntry type="inheritedJdk" />
|
|
7
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
8
|
-
</component>
|
|
9
|
-
</module>
|
package/.idea/misc.xml
DELETED
package/.idea/modules.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectModuleManager">
|
|
4
|
-
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/homebridge-echonet-lite.iml" filepath="$PROJECT_DIR$/.idea/homebridge-echonet-lite.iml" />
|
|
6
|
-
</modules>
|
|
7
|
-
</component>
|
|
8
|
-
</project>
|
package/.idea/vcs.xml
DELETED
package/.prettierignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
node_modules/
|
package/.prettierrc
DELETED
package/sample.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
// Load the node-echonet-lite module
|
|
2
|
-
var EchonetLite = require("node-echonet-lite");
|
|
3
|
-
|
|
4
|
-
// Create an EchonetLite object
|
|
5
|
-
// The type of network layer must be passed.
|
|
6
|
-
var el = new EchonetLite({ type: "lan" }); //, 'netif': '172.23.214.108'});
|
|
7
|
-
|
|
8
|
-
// Initialize the EchonetLite object
|
|
9
|
-
el.init((err) => {
|
|
10
|
-
if (err) {
|
|
11
|
-
// An error was occurred
|
|
12
|
-
showErrorExit(err);
|
|
13
|
-
} else {
|
|
14
|
-
// Start to discover devices
|
|
15
|
-
discoverDevices();
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
// Start to discover devices
|
|
20
|
-
function discoverDevices() {
|
|
21
|
-
// Start to discover Echonet Lite devices
|
|
22
|
-
console.log("discover 1");
|
|
23
|
-
el.startDiscovery((err, res) => {
|
|
24
|
-
console.log("discover 2");
|
|
25
|
-
// Error handling
|
|
26
|
-
if (err) {
|
|
27
|
-
showErrorExit(err);
|
|
28
|
-
}
|
|
29
|
-
// Determine the type of the found device
|
|
30
|
-
var device = res["device"];
|
|
31
|
-
var address = device["address"];
|
|
32
|
-
|
|
33
|
-
for (let eoj of device.eoj) {
|
|
34
|
-
// var eoj = device['eoj'][0];
|
|
35
|
-
var group_code = eoj[0]; // Class group code
|
|
36
|
-
var class_code = eoj[1]; // Class code
|
|
37
|
-
console.log(address, eoj);
|
|
38
|
-
if (group_code === 0x02 && class_code === 0x91) {
|
|
39
|
-
console.log("Stop");
|
|
40
|
-
// Stop to discovery process
|
|
41
|
-
el.stopDiscovery();
|
|
42
|
-
// This means that the found device belongs to the home air conditioner class
|
|
43
|
-
console.log("Found a light (" + address + ").");
|
|
44
|
-
// Get the operation status
|
|
45
|
-
getOperationStatus(address, eoj);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Get the operation status
|
|
52
|
-
function getOperationStatus(address, eoj) {
|
|
53
|
-
var epc = 0x80; // An property code which means the operation status
|
|
54
|
-
// el.getPropertyMaps(address, eoj, (err, res) => {
|
|
55
|
-
// // this value is true if the air conditione is on
|
|
56
|
-
// console.log(JSON.stringify(res.message.data));
|
|
57
|
-
// var status = res['message']['data']['status'];
|
|
58
|
-
// var desc = (status ? 'on' : 'off');
|
|
59
|
-
// console.log('The device is ' + desc + '.');
|
|
60
|
-
// // Toggle the status of the operation status
|
|
61
|
-
// // changePowerStatus(address, eoj, epc, !status);
|
|
62
|
-
// });
|
|
63
|
-
el.getPropertyValue(address, eoj, epc, (err, res) => {
|
|
64
|
-
// this value is true if the air conditione is on
|
|
65
|
-
var status = res["message"]["data"]["status"];
|
|
66
|
-
var desc = status ? "on" : "off";
|
|
67
|
-
console.log("The device is " + desc + ".");
|
|
68
|
-
// Toggle the status of the operation status
|
|
69
|
-
changePowerStatus(address, eoj, epc, !status);
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Change the status of the operation status
|
|
74
|
-
function changePowerStatus(address, eoj, epc, status) {
|
|
75
|
-
var edt = { status: status };
|
|
76
|
-
el.setPropertyValue(address, eoj, epc, edt, (err, res) => {
|
|
77
|
-
var desc = status ? "on" : "off";
|
|
78
|
-
console.log("The device was turned " + desc + ".");
|
|
79
|
-
el.close(() => {
|
|
80
|
-
console.log("Closed.");
|
|
81
|
-
// This script terminates here.
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// Print an error then terminate the process of this script
|
|
87
|
-
function showErrorExit(err) {
|
|
88
|
-
console.log("[ERROR] " + err.toString());
|
|
89
|
-
process.exit();
|
|
90
|
-
}
|