homebridge-smartsystem 6.8.11 → 6.8.13
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/README.md +57 -165
- package/accessories/door.js +1 -0
- package/accessories/door.ts +1 -1
- package/accessories/garagedoor.js +1 -0
- package/accessories/garagedoor.ts +2 -2
- package/accessories/lock.js +4 -4
- package/accessories/lock.ts +4 -4
- package/accessories/windowcovering.js +1 -1
- package/accessories/windowcovering.ts +1 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -540,170 +540,62 @@ add a file called "ssh" to the boot partition of the sd card
|
|
|
540
540
|
touch /Volumes/boot/ssh
|
|
541
541
|
```
|
|
542
542
|
|
|
543
|
-
later: ssh pi@192.168.99.97 / pw=raspberry
|
|
544
543
|
|
|
545
|
-
or, if you can access a terminal:
|
|
546
|
-
sudo raspi-config
|
|
547
|
-
-> enable ssh
|
|
548
|
-
-> boot to cmdline
|
|
549
|
-
|
|
550
|
-
if you want a private key on the machine
|
|
551
|
-
```
|
|
552
|
-
mkdir ~/.ssh
|
|
553
|
-
chmod 755 ~/.ssh
|
|
554
|
-
cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
|
|
555
|
-
chmod 644 ~/.ssh/authorized_keys
|
|
556
|
-
rm ~/id_rsa.pub
|
|
557
|
-
```
|
|
558
|
-
|
|
559
|
-
### other stuff
|
|
560
|
-
if needed a wifi connection can be made too, add a file "wpa_supplicant.conf" to the boot partition of the sd card
|
|
561
|
-
example content:
|
|
562
|
-
```
|
|
563
|
-
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
|
|
564
|
-
update_config=1
|
|
565
|
-
|
|
566
|
-
network={
|
|
567
|
-
ssid="MySSID"
|
|
568
|
-
psk="MyPassword"
|
|
569
|
-
}
|
|
570
|
-
```
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
### dns server
|
|
574
|
-
If you need a dns server:
|
|
575
|
-
```
|
|
576
|
-
sudo vi /etc/network/interfaces
|
|
577
|
-
```
|
|
578
|
-
Add at end: dns-nameservers 8.8.4.4 8.8.8.8
|
|
579
|
-
=> reboot
|
|
580
|
-
```
|
|
581
|
-
shutdown -r now
|
|
582
|
-
```
|
|
583
|
-
|
|
584
|
-
### nodejs (65Mb)
|
|
585
|
-
Depends on version of Raspberry:
|
|
586
|
-
```
|
|
587
|
-
uname -a => ARM7 of ARM8
|
|
588
|
-
```
|
|
589
|
-
|
|
590
|
-
### 1a - nodejs - ARM7
|
|
591
|
-
```
|
|
592
|
-
wget https://nodejs.org/dist/v12.16.1/node-v12.16.1-linux-armv7l.tar.xz
|
|
593
|
-
cd /opt
|
|
594
|
-
sudo tar -xJvf ~/node-v12.16.1-linux-armv7l.tar.xz
|
|
595
|
-
rm -f ~/node-v12.16.1-linux-armv7l.tar.xz
|
|
596
|
-
sudo ln -s /opt/node-v12.16.1-linux-armv7l /opt/node
|
|
597
|
-
sudo ln -s /opt/node/bin/node /usr/bin/node
|
|
598
|
-
sudo ln -s /opt/node/bin/npm /usr/bin/npm
|
|
599
|
-
sudo apt-get install -y git
|
|
600
|
-
cd ~
|
|
601
|
-
```
|
|
602
|
-
|
|
603
|
-
### 1b - nodejs - ARM8
|
|
604
|
-
```
|
|
605
|
-
sudo rm -f /opt/node
|
|
606
|
-
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
|
|
607
|
-
sudo apt-get install -y nodejs
|
|
608
|
-
sudo npm install -g npm
|
|
609
|
-
sudo apt-get install -y git
|
|
610
|
-
cd ~
|
|
611
|
-
```
|
|
612
|
-
|
|
613
|
-
## New v2.0 All in one script
|
|
614
|
-
```
|
|
615
|
-
## old systems remove
|
|
616
|
-
sudo npm -g remove pm2
|
|
617
|
-
sudo rm -f /usr/bin/pm2
|
|
618
|
-
|
|
619
|
-
sudo npm -g remove homebridge
|
|
620
|
-
sudo rm -f /usr/bin/homebridge
|
|
621
|
-
|
|
622
|
-
sudo npm -g remove mqtt
|
|
623
|
-
sudo rm -f /usr/bin/mqtt
|
|
624
|
-
|
|
625
|
-
## clean up
|
|
626
|
-
sudo apt autoremove
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
## start intstall: node, npm, git
|
|
630
|
-
cd ~
|
|
631
|
-
sudo rm -f /opt/node
|
|
632
|
-
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
|
|
633
|
-
sudo apt-get install -y nodejs
|
|
634
|
-
sudo npm install -g npm
|
|
635
|
-
sudo apt-get install -y git
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
### install: homebridge
|
|
639
|
-
sudo npm install -g --force --unsafe-perm homebridge
|
|
640
|
-
### install mqtt
|
|
641
|
-
sudo npm install -g --force mqtt
|
|
642
|
-
|
|
643
|
-
### install: smartsystem
|
|
644
|
-
rm -rf smartsocket
|
|
645
|
-
git clone https://github.com/jcoppieters/smartsocket.git
|
|
646
|
-
cd smartsocket
|
|
647
|
-
git checkout v2.0
|
|
648
|
-
npm install
|
|
649
|
-
|
|
650
|
-
### config smartsystem
|
|
651
|
-
rm -rf /home/pi/.homebridge
|
|
652
|
-
mkdir -p /home/pi/.homebridge
|
|
653
|
-
cp ~/smartsocket/config.homebridge.json ~/.homebridge/config.json
|
|
654
|
-
cd ~/smartsocket
|
|
655
|
-
sudo ln -sf /home/pi/smartsocket/ /usr/lib/node_modules/homebridge-system # install the plugin via a link
|
|
656
|
-
cd ~
|
|
657
|
-
|
|
658
|
-
### install pm2 - process mgr
|
|
659
|
-
sudo npm install -g --force pm2
|
|
660
|
-
|
|
661
|
-
### IF NEEDED COPY OLD configs
|
|
662
|
-
cp -v duotecno/*.json smartsocket/
|
|
663
|
-
|
|
664
|
-
### start the system and save for reboots
|
|
665
|
-
cd ~/smartsocket
|
|
666
|
-
pm2 start homebridge
|
|
667
|
-
pm2 save
|
|
668
|
-
pm2 startup | grep "sudo" | bash
|
|
669
544
|
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
545
|
+
## Install Shelly gen 1 plugin
|
|
546
|
+
|
|
547
|
+
sudo vi /var/lib/homebridge/node_modules/homebridge-shelly/util/custom-characteristics.js
|
|
548
|
+
perms: ["ev","pr"], //Perms.READ, Perms.NOTIFY],
|
|
549
|
+
|
|
550
|
+
sudo vi /var/lib/homebridge/node_modules/homebridge-shelly/accessories/lightbulbs.js
|
|
551
|
+
return 5; //Accessory.Categories.LIGHTBULB
|
|
552
|
+
|
|
553
|
+
sudo vi /var/lib/homebridge/node_modules/homebridge-shelly/accessories/switches.js
|
|
554
|
+
return 8; //Accessory.Categories.SWITCH
|
|
555
|
+
|
|
556
|
+
switches.js: return 8; //Accessory.Categories.SWITCH -> 8
|
|
557
|
+
lightbulbs.js: return 5; //Accessory.Categories.LIGHTBULB -> 5 (4x)
|
|
558
|
+
|
|
559
|
+
base.js: return Accessory.Categories.OTHER -> 1
|
|
560
|
+
doors.js: return Accessory.Categories.DOOR -> 12
|
|
561
|
+
garage-door-openers.js: return Accessory.Categories.GARAGE_DOOR_OPENER -> 4
|
|
562
|
+
outlets.js: return Accessory.Categories.OUTLET -> 7
|
|
563
|
+
sensors.js: return Accessory.Categories.SENSOR -> 10 (4x)
|
|
564
|
+
valves.js: return Accessory.Categories.FAUCET -> 29
|
|
565
|
+
window-coverings.js: return Accessory.Categories.WINDOW_COVERING -> 14
|
|
566
|
+
windows.js: return Accessory.Categories.WINDOW -> 13
|
|
567
|
+
|
|
568
|
+
## OR
|
|
569
|
+
sudo vi /usr/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Accessory.js
|
|
570
|
+
|
|
571
|
+
add:
|
|
572
|
+
Accessory.Categories = {
|
|
573
|
+
OTHER: 1,
|
|
574
|
+
BRIDGE: 2,
|
|
575
|
+
FAN: 3,
|
|
576
|
+
GARAGE_DOOR_OPENER: 4,
|
|
577
|
+
LIGHTBULB: 5,
|
|
578
|
+
DOOR_LOCK: 6,
|
|
579
|
+
OUTLET: 7,
|
|
580
|
+
SWITCH: 8,
|
|
581
|
+
THERMOSTAT: 9,
|
|
582
|
+
SENSOR: 10,
|
|
583
|
+
SECURITY_SYSTEM: 11,
|
|
584
|
+
DOOR: 12,
|
|
585
|
+
WINDOW: 13,
|
|
586
|
+
WINDOW_COVERING: 14,
|
|
587
|
+
PROGRAMMABLE_SWITCH: 15,
|
|
588
|
+
RANGE_EXTENDER: 16,
|
|
589
|
+
IP_CAMERA: 17,
|
|
590
|
+
VIDEO_DOORBELL: 18,
|
|
591
|
+
AIR_PURIFIER: 19,
|
|
592
|
+
HEATER: 20,
|
|
593
|
+
AIR_CONDITIONER: 21,
|
|
594
|
+
HUMIDIFIER: 22,
|
|
595
|
+
DEHUMIDIFIER: 23,
|
|
596
|
+
SPRINKLER: 28,
|
|
597
|
+
FAUCET: 29,
|
|
598
|
+
SHOWER_HEAD: 30,
|
|
599
|
+
TELEVISION: 31,
|
|
600
|
+
TARGET_CONTROLLER: 32
|
|
601
|
+
};
|
package/accessories/door.js
CHANGED
|
@@ -49,6 +49,7 @@ const windowcovering_1 = require("./windowcovering");
|
|
|
49
49
|
class Door extends windowcovering_1.WindowCovering {
|
|
50
50
|
constructor(homebridge, unit) {
|
|
51
51
|
super(homebridge, unit);
|
|
52
|
+
this.targetState = this.homebridge.Characteristic.CurrentDoorState.OPEN;
|
|
52
53
|
}
|
|
53
54
|
getAccessoryServices() {
|
|
54
55
|
// DoorOpener needs authentication
|
package/accessories/door.ts
CHANGED
|
@@ -13,6 +13,7 @@ const accessory_1 = require("./accessory");
|
|
|
13
13
|
class GarageDoor extends accessory_1.Accessory {
|
|
14
14
|
constructor(homebridge, unit) {
|
|
15
15
|
super(homebridge, unit);
|
|
16
|
+
this.targetState = this.homebridge.Characteristic.CurrentDoorState.STOPPED;
|
|
16
17
|
}
|
|
17
18
|
getAccessoryServices() {
|
|
18
19
|
// GarageDoorOpener needs authentication
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { API } from "homebridge";
|
|
1
|
+
import { API, Characteristic } from "homebridge";
|
|
2
2
|
import { Unit } from "../duotecno/protocol";
|
|
3
3
|
import { UnitMotorCmd, UnitState } from "../duotecno/types";
|
|
4
4
|
import { log } from "../duotecno/logger";
|
|
@@ -14,7 +14,7 @@ import { Accessory } from "./accessory";
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
export class GarageDoor extends Accessory {
|
|
17
|
-
targetState;
|
|
17
|
+
targetState = this.homebridge.Characteristic.CurrentDoorState.STOPPED;
|
|
18
18
|
|
|
19
19
|
constructor(homebridge: API, unit: Unit) {
|
|
20
20
|
super(homebridge, unit);
|
package/accessories/lock.js
CHANGED
|
@@ -14,7 +14,7 @@ const accessory_1 = require("./accessory");
|
|
|
14
14
|
class Lock extends accessory_1.Accessory {
|
|
15
15
|
constructor(homebridge, unit) {
|
|
16
16
|
super(homebridge, unit);
|
|
17
|
-
this.targetState =
|
|
17
|
+
this.targetState = this.homebridge.Characteristic.CurrentDoorState.CLOSED; // locked
|
|
18
18
|
(0, logger_1.log)("accessory", "created Lock -> " + unit.getDescription());
|
|
19
19
|
// set default for Unlocked to Locked
|
|
20
20
|
if (this.unit.getType() === types_1.UnitExtendedType.kUnlocker)
|
|
@@ -47,10 +47,10 @@ class Lock extends accessory_1.Accessory {
|
|
|
47
47
|
// always set to "locked" after sending the request.
|
|
48
48
|
this.unit.resetTimer = setTimeout(() => {
|
|
49
49
|
(0, logger_1.log)("accessory", "Autolock for an unlocker after 2 secs of " + this.unit.getDescription());
|
|
50
|
-
this.targetState =
|
|
51
|
-
this.me.getCharacteristic(this.homebridge.Characteristic.LockTargetState).updateValue(
|
|
50
|
+
this.targetState = this.homebridge.Characteristic.CurrentDoorState.CLOSED;
|
|
51
|
+
this.me.getCharacteristic(this.homebridge.Characteristic.LockTargetState).updateValue(this.targetState);
|
|
52
52
|
this.unit.status = 1;
|
|
53
|
-
this.me.getCharacteristic(this.homebridge.Characteristic.LockCurrentState).updateValue(
|
|
53
|
+
this.me.getCharacteristic(this.homebridge.Characteristic.LockCurrentState).updateValue(this.targetState);
|
|
54
54
|
}, 2000);
|
|
55
55
|
}
|
|
56
56
|
next();
|
package/accessories/lock.ts
CHANGED
|
@@ -15,7 +15,7 @@ import { Accessory } from "./accessory";
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
export class Lock extends Accessory {
|
|
18
|
-
targetState =
|
|
18
|
+
targetState = this.homebridge.Characteristic.CurrentDoorState.CLOSED; // locked
|
|
19
19
|
|
|
20
20
|
constructor(homebridge: API, unit: Unit) {
|
|
21
21
|
super(homebridge, unit);
|
|
@@ -62,10 +62,10 @@ export class Lock extends Accessory {
|
|
|
62
62
|
// always set to "locked" after sending the request.
|
|
63
63
|
this.unit.resetTimer = setTimeout(() => {
|
|
64
64
|
log("accessory", "Autolock for an unlocker after 2 secs of " + this.unit.getDescription())
|
|
65
|
-
this.targetState =
|
|
66
|
-
this.me.getCharacteristic(this.homebridge.Characteristic.LockTargetState).updateValue(
|
|
65
|
+
this.targetState = this.homebridge.Characteristic.CurrentDoorState.CLOSED;
|
|
66
|
+
this.me.getCharacteristic(this.homebridge.Characteristic.LockTargetState).updateValue(this.targetState);
|
|
67
67
|
this.unit.status = 1;
|
|
68
|
-
this.me.getCharacteristic(this.homebridge.Characteristic.LockCurrentState).updateValue(
|
|
68
|
+
this.me.getCharacteristic(this.homebridge.Characteristic.LockCurrentState).updateValue(this.targetState);
|
|
69
69
|
}, 2000);
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -58,7 +58,7 @@ const logger_1 = require("../duotecno/logger");
|
|
|
58
58
|
class WindowCovering extends accessory_1.Accessory {
|
|
59
59
|
constructor(homebridge, unit) {
|
|
60
60
|
super(homebridge, unit);
|
|
61
|
-
this.targetState =
|
|
61
|
+
this.targetState = this.homebridge.Characteristic.CurrentDoorState.OPEN;
|
|
62
62
|
}
|
|
63
63
|
getAccessoryServices() {
|
|
64
64
|
const covering = this.makeService(this.homebridge.Service.WindowCovering);
|
|
@@ -58,12 +58,10 @@ import { API } from "homebridge";
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
export class WindowCovering extends Accessory {
|
|
61
|
-
targetState;
|
|
61
|
+
targetState = this.homebridge.Characteristic.CurrentDoorState.OPEN;
|
|
62
62
|
|
|
63
63
|
constructor(homebridge: API, unit: Unit) {
|
|
64
64
|
super(homebridge, unit);
|
|
65
|
-
this.targetState = 0; // down or closed by default ??
|
|
66
|
-
|
|
67
65
|
}
|
|
68
66
|
|
|
69
67
|
getAccessoryServices() {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-smartsystem",
|
|
3
3
|
"displayname": "Duotecno Bridge",
|
|
4
|
-
"version": "6.8.
|
|
4
|
+
"version": "6.8.13",
|
|
5
5
|
"description": "SmartServer (Proxy TCP sockets to the cloud, Smappee MQTT, Duotecno IP Nodes, Homekit interface)",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"author": "Johan Coppieters",
|