Skip to content

Commit 2c87236

Browse files
committed
fix wrong brackets
1 parent c367eb6 commit 2c87236

File tree

1 file changed

+28
-30
lines changed

1 file changed

+28
-30
lines changed

index.js

+28-30
Original file line numberDiff line numberDiff line change
@@ -68,56 +68,54 @@ async function handleSubscription(that) {
6868

6969
if(that.subClient.listeners('event').length == 0) {
7070

71-
try {
71+
try {
7272

73-
await that.subClient.subscribeCharacteristics(subscribeAll)
73+
await that.subClient.subscribeCharacteristics(subscribeAll)
7474

75-
} catch (e) {
75+
} catch (e) {
7676

77-
that.log.error("Unable to subscribe")
78-
that.log.error(e)
77+
that.log.error("Unable to subscribe")
78+
that.log.error(e)
7979

80-
}
80+
}
8181

82-
}
82+
}
8383

84-
that.subClient.on('event', async (event) => {
84+
that.subClient.on('event', async (event) => {
8585

86-
if (that.logUpdates) {
86+
if (that.logUpdates) {
8787

88-
that.allEvents = event
88+
that.allEvents = event
8989

90-
that.allEvents.characteristics.forEach(ev => {
90+
that.allEvents.characteristics.forEach(ev => {
9191

92-
that.typeToUpdate = capitalizeFirstLetter(getKeyByValue(instanceId, ev.iid))
93-
that.log("received update for '" + that.typeToUpdate + "' => " + ev.value)
94-
that.savedStates[getKeyByValue(instanceId, ev.iid)] = ev.value
95-
that.service.getCharacteristic(Characteristic[that.typeToUpdate]).updateValue(ev.value)
92+
that.typeToUpdate = capitalizeFirstLetter(getKeyByValue(instanceId, ev.iid))
93+
that.log("received update for '" + that.typeToUpdate + "' => " + ev.value)
94+
that.savedStates[getKeyByValue(instanceId, ev.iid)] = ev.value
95+
that.service.getCharacteristic(Characteristic[that.typeToUpdate]).updateValue(ev.value)
9696

97-
})
97+
})
9898

99-
}
100-
101-
})
99+
}
102100

103-
that.subClient.on('event-disconnect', async (formerSubscribes) => {
101+
})
104102

105-
try {
103+
that.subClient.on('event-disconnect', async (formerSubscribes) => {
106104

107-
await that.subClient.unsubscribeCharacteristics(subscribeAll)
108-
that.subClient.removeAllListeners('event')
109-
closeClient(that, clientType.sub)
110-
handleSubscription(that)
105+
try {
111106

112-
} catch (e) {
107+
await that.subClient.unsubscribeCharacteristics(subscribeAll)
108+
that.subClient.removeAllListeners('event')
109+
closeClient(that, clientType.sub)
110+
handleSubscription(that)
113111

114-
that.log.error(e)
112+
} catch (e) {
115113

116-
}
114+
that.log.error(e)
117115

118-
})
116+
}
119117

120-
}
118+
})
121119

122120
}
123121

0 commit comments

Comments
 (0)