homebridge-lib 6.0.2 → 6.2.0
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 +1 -1
- package/cli/hap.js +1 -1
- package/cli/json.js +1 -1
- package/cli/sysinfo.js +1 -1
- package/cli/upnp.js +1 -1
- package/index.js +1 -1
- package/lib/AccessoryDelegate.js +30 -27
- package/lib/AdaptiveLighting.js +1 -1
- package/lib/CharacteristicDelegate.js +22 -36
- package/lib/Colour.js +1 -1
- package/lib/CommandLineParser.js +1 -1
- package/lib/CommandLineTool.js +1 -1
- package/lib/CustomHomeKitTypes.js +1 -1
- package/lib/Delegate.js +31 -33
- package/lib/EveHomeKitTypes.js +62 -52
- package/lib/HttpClient.js +1 -1
- package/lib/JsonFormatter.js +1 -1
- package/lib/MyHomeKitTypes.js +88 -97
- package/lib/OptionParser.js +27 -2
- package/lib/Platform.js +12 -20
- package/lib/PropertyDelegate.js +8 -11
- package/lib/ServiceDelegate/AccessoryInformation.js +1 -1
- package/lib/ServiceDelegate/Battery.js +1 -1
- package/lib/ServiceDelegate/Dummy.js +1 -1
- package/lib/ServiceDelegate/History/Consumption.js +28 -49
- package/lib/ServiceDelegate/History/Light.js +15 -23
- package/lib/ServiceDelegate/History/On.js +29 -33
- package/lib/ServiceDelegate/History/Power.js +43 -52
- package/lib/ServiceDelegate/History/Sensor.js +215 -0
- package/lib/ServiceDelegate/History/Thermo.js +19 -33
- package/lib/ServiceDelegate/History/index.js +137 -186
- package/lib/ServiceDelegate/ServiceLabel.js +1 -1
- package/lib/ServiceDelegate/index.js +13 -11
- package/lib/SystemInfo.js +3 -2
- package/lib/UiServer.js +1 -1
- package/lib/UpnpClient.js +1 -1
- package/package.json +2 -2
- package/lib/ServiceDelegate/History/Contact.js +0 -96
- package/lib/ServiceDelegate/History/Motion.js +0 -155
- package/lib/ServiceDelegate/History/Room.js +0 -112
- package/lib/ServiceDelegate/History/Weather.js +0 -124
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
// homebridge-lib/lib/ServiceDelegate/History/Motion.js
|
|
2
|
-
//
|
|
3
|
-
// Library for Homebridge plugins.
|
|
4
|
-
// Copyright © 2017-2022 Erik Baauw. All rights reserved.
|
|
5
|
-
//
|
|
6
|
-
// The logic for handling Eve history was copied from Simone Tisa's
|
|
7
|
-
// fakagato-history repository, copyright © 2017 simont77.
|
|
8
|
-
// See https://github.com/simont77/fakegato-history.
|
|
9
|
-
|
|
10
|
-
'use strict'
|
|
11
|
-
|
|
12
|
-
const homebridgeLib = require('../../../index')
|
|
13
|
-
const util = require('util')
|
|
14
|
-
|
|
15
|
-
const { ServiceDelegate } = homebridgeLib
|
|
16
|
-
const { History } = ServiceDelegate
|
|
17
|
-
const { swap16, swap32, numToHex } = History
|
|
18
|
-
|
|
19
|
-
/** Class for an Eve Motion _History_ service delegate.
|
|
20
|
-
*
|
|
21
|
-
* This delegate sets up a `Services.eve.History` HomeKit service
|
|
22
|
-
* with keys for the following HomeKit characteristics:
|
|
23
|
-
*
|
|
24
|
-
* key | Characteristic
|
|
25
|
-
* ---------------- | ----------------------------------
|
|
26
|
-
* `name` | `Characteristics.hap.Name`
|
|
27
|
-
* `historyRequest` | `Characteristics.eve.HistoryRequest`
|
|
28
|
-
* `setTime` | `Characteristics.eve.SetTime`
|
|
29
|
-
* `historyStatus` | `Characteristics.eve.HistoryStatus`
|
|
30
|
-
* `historyEntries` | `Characteristics.eve.HistoryEntries`
|
|
31
|
-
* `resetTotal` | `Characteristics.eve.ResetTotal`
|
|
32
|
-
*
|
|
33
|
-
* This delegate creates the history from the associated
|
|
34
|
-
* `Characteristics.hap.MotionDetected` characteristic. It updates the
|
|
35
|
-
* value of the associated `Characteristics.eve.LastActivation` characteristic.
|
|
36
|
-
* @extends ServiceDelegate.History
|
|
37
|
-
* @memberof ServiceDelegate.History
|
|
38
|
-
*/
|
|
39
|
-
class Motion extends History {
|
|
40
|
-
/** Create a new instance of an Eve Motion _History_ service delegate.
|
|
41
|
-
* @param {!AccessoryDelegate} accessoryDelegate - The delegate of the
|
|
42
|
-
* corresponding HomeKit accessory.
|
|
43
|
-
* @param {!object} params - The parameters for the
|
|
44
|
-
* _History_ HomeKit service.
|
|
45
|
-
* @param {!CharacteristicDelegate} params.motionDelegate - A reference to
|
|
46
|
-
* the delegate of the associated `Characteristics.hap.MotionDetected`
|
|
47
|
-
* characteristic.
|
|
48
|
-
* @param {!CharacteristicDelegate} params.lastActivationDelegate - A
|
|
49
|
-
* reference to the delegate of the associated
|
|
50
|
-
* `Characteristics.eve.LastActivation` characteristic.
|
|
51
|
-
* @param {?CharacteristicDelegate} params.lightLevelDelegate - A reference
|
|
52
|
-
* to the delegate of the associated
|
|
53
|
-
* `Characteristics.hap.CurrentAmbientLightLevel` characteristic.
|
|
54
|
-
* For PIR sensors (like the Hue motion sensor) that report light level in
|
|
55
|
-
* addition to motion.
|
|
56
|
-
* @param {?CharacteristicDelegate} params.temperatureDelegate - A reference
|
|
57
|
-
* to the delegate of the associated `Characteristics.hap.CurrentTemperature`
|
|
58
|
-
* characteristic.
|
|
59
|
-
* For PIR sensors (like the Hue motion sensor) that report temperature in
|
|
60
|
-
* addition to motion.
|
|
61
|
-
*/
|
|
62
|
-
constructor (accessoryDelegate, params) {
|
|
63
|
-
super(accessoryDelegate, params)
|
|
64
|
-
if (!(params.motionDelegate instanceof homebridgeLib.CharacteristicDelegate)) {
|
|
65
|
-
throw new TypeError('params.motionDelegate: not a CharacteristicDelegate')
|
|
66
|
-
}
|
|
67
|
-
if (!(params.lastActivationDelegate instanceof homebridgeLib.CharacteristicDelegate)) {
|
|
68
|
-
throw new TypeError('params.lastActivationDelegate: not a CharacteristicDelegate')
|
|
69
|
-
}
|
|
70
|
-
if (
|
|
71
|
-
params.lightLevelDelegate != null &&
|
|
72
|
-
!(params.lightLevelDelegate instanceof homebridgeLib.CharacteristicDelegate)
|
|
73
|
-
) {
|
|
74
|
-
throw new TypeError('params.lightLevelDelegate: not a CharacteristicDelegate')
|
|
75
|
-
}
|
|
76
|
-
if (
|
|
77
|
-
params.temperatureDelegate != null &&
|
|
78
|
-
!(params.temperatureDelegate instanceof homebridgeLib.CharacteristicDelegate)
|
|
79
|
-
) {
|
|
80
|
-
throw new TypeError('params.temperatureDelegate: not a CharacteristicDelegate')
|
|
81
|
-
}
|
|
82
|
-
this._entry = { time: 0, status: params.motionDelegate.value }
|
|
83
|
-
params.motionDelegate.on('didSet', (value) => {
|
|
84
|
-
const now = Math.round(new Date().valueOf() / 1000)
|
|
85
|
-
params.lastActivationDelegate.value = now - this._h.initialTime
|
|
86
|
-
this._entry.status = value
|
|
87
|
-
if (this._entry.temp != null) {
|
|
88
|
-
const lightlevel = this._entry.lightlevel
|
|
89
|
-
const temp = this._entry.temp
|
|
90
|
-
this._entry.lightlevel = null
|
|
91
|
-
this._entry.temp = null
|
|
92
|
-
this._addEntry(now)
|
|
93
|
-
this._entry.lightlevel = lightlevel
|
|
94
|
-
this._entry.temp = temp
|
|
95
|
-
} else {
|
|
96
|
-
this._addEntry(now)
|
|
97
|
-
}
|
|
98
|
-
})
|
|
99
|
-
if (params.lightLevelDelegate != null) {
|
|
100
|
-
this._entry.lightlevel = params.lightLevelDelegate.value
|
|
101
|
-
params.lightLevelDelegate.on('didSet', (value) => {
|
|
102
|
-
this._entry.lightlevel = value
|
|
103
|
-
})
|
|
104
|
-
}
|
|
105
|
-
if (params.temperatureDelegate != null) {
|
|
106
|
-
this._entry.temp = params.temperatureDelegate.value
|
|
107
|
-
params.temperatureDelegate.on('didSet', (value) => {
|
|
108
|
-
this._entry.temp = value
|
|
109
|
-
})
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
get _fingerPrint () {
|
|
114
|
-
return '03 1C01 3002 0102'
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
_entryStream (entry) {
|
|
118
|
-
if (entry.temp == null) {
|
|
119
|
-
if (entry.lightlevel == null) {
|
|
120
|
-
return util.format(
|
|
121
|
-
'|0b %s %s 01 %s',
|
|
122
|
-
numToHex(swap32(this._h.currentEntry), 8),
|
|
123
|
-
numToHex(swap32(entry.time - this._h.initialTime), 8),
|
|
124
|
-
numToHex(entry.status, 2)
|
|
125
|
-
)
|
|
126
|
-
}
|
|
127
|
-
return util.format(
|
|
128
|
-
'|0d %s %s 03 %s %s',
|
|
129
|
-
numToHex(swap32(this._h.currentEntry), 8),
|
|
130
|
-
numToHex(swap32(entry.time - this._h.initialTime), 8),
|
|
131
|
-
numToHex(entry.status, 2),
|
|
132
|
-
numToHex(swap16(entry.lightlevel), 4)
|
|
133
|
-
)
|
|
134
|
-
}
|
|
135
|
-
if (entry.lightlevel == null) {
|
|
136
|
-
return util.format(
|
|
137
|
-
'|0d %s %s 05 %s %s',
|
|
138
|
-
numToHex(swap32(this._h.currentEntry), 8),
|
|
139
|
-
numToHex(swap32(entry.time - this._h.initialTime), 8),
|
|
140
|
-
numToHex(entry.status, 2),
|
|
141
|
-
numToHex(swap16(entry.temp * 100), 4)
|
|
142
|
-
)
|
|
143
|
-
}
|
|
144
|
-
return util.format(
|
|
145
|
-
'|0f %s %s 07 %s %s %s',
|
|
146
|
-
numToHex(swap32(this._h.currentEntry), 8),
|
|
147
|
-
numToHex(swap32(entry.time - this._h.initialTime), 8),
|
|
148
|
-
numToHex(entry.status, 2),
|
|
149
|
-
numToHex(swap16(entry.lightlevel), 4),
|
|
150
|
-
numToHex(swap16(entry.temp * 100), 4)
|
|
151
|
-
)
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
module.exports = Motion
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
// homebridge-lib/lib/ServiceDelegate/History/Room.js
|
|
2
|
-
//
|
|
3
|
-
// Library for Homebridge plugins.
|
|
4
|
-
// Copyright © 2017-2022 Erik Baauw. All rights reserved.
|
|
5
|
-
//
|
|
6
|
-
// The logic for handling Eve history was copied from Simone Tisa's
|
|
7
|
-
// fakagato-history repository, copyright © 2017 simont77.
|
|
8
|
-
// See https://github.com/simont77/fakegato-history.
|
|
9
|
-
|
|
10
|
-
'use strict'
|
|
11
|
-
|
|
12
|
-
const homebridgeLib = require('../../../index')
|
|
13
|
-
const util = require('util')
|
|
14
|
-
|
|
15
|
-
const { ServiceDelegate } = homebridgeLib
|
|
16
|
-
const { History } = ServiceDelegate
|
|
17
|
-
const { swap16, swap32, numToHex } = History
|
|
18
|
-
|
|
19
|
-
/** Class for an Eve Room _History_ service delegate.
|
|
20
|
-
*
|
|
21
|
-
* This delegate sets up a `Services.eve.History` HomeKit service
|
|
22
|
-
* with keys for the following HomeKit characteristics:
|
|
23
|
-
*
|
|
24
|
-
* key | Characteristic
|
|
25
|
-
* ---------------- | ----------------------------------
|
|
26
|
-
* `name` | `Characteristics.hap.Name`
|
|
27
|
-
* `historyRequest` | `Characteristics.eve.HistoryRequest`
|
|
28
|
-
* `setTime` | `Characteristics.eve.SetTime`
|
|
29
|
-
* `historyStatus` | `Characteristics.eve.HistoryStatus`
|
|
30
|
-
* `historyEntries` | `Characteristics.eve.HistoryEntries`
|
|
31
|
-
*
|
|
32
|
-
* This delegate creates the history from the associated
|
|
33
|
-
* `Characteristics.hap.CurrentTemperature`,
|
|
34
|
-
* `Characteristics.hap.CurrentRelativeHumidity`, and
|
|
35
|
-
* `Characteristics.hap.VOCDensity` characteristics.
|
|
36
|
-
* @extends ServiceDelegate.History
|
|
37
|
-
* @memberof ServiceDelegate.History
|
|
38
|
-
*/
|
|
39
|
-
class Room extends ServiceDelegate.History {
|
|
40
|
-
/** Create a new instance of an Eve Weather _History_ service delegate.
|
|
41
|
-
* @param {!AccessoryDelegate} accessoryDelegate - The delegate of the
|
|
42
|
-
* corresponding HomeKit accessory.
|
|
43
|
-
* @param {!object} params - The parameters for the
|
|
44
|
-
* _History_ HomeKit service.
|
|
45
|
-
* @param {!CharacteristicDelegate} params.temperatureDelegate - A reference
|
|
46
|
-
* to the delegate of the associated `Characteristics.hap.CurrentTemperature`
|
|
47
|
-
* characteristic.
|
|
48
|
-
* @param {?CharacteristicDelegate} params.humidityDelegate - A reference to
|
|
49
|
-
* the delegate of the associated
|
|
50
|
-
* `Characteristics.hap.CurrentRelativeHumidity` characteristic.
|
|
51
|
-
* @param {?CharacteristicDelegate} params.vocDensityDelegate - A reference
|
|
52
|
-
* to the delegate of the associated `Characteristics.eve.AirPressure`
|
|
53
|
-
* characteristic.
|
|
54
|
-
*/
|
|
55
|
-
constructor (accessoryDelegate, params) {
|
|
56
|
-
super(accessoryDelegate, params)
|
|
57
|
-
if (!(params.temperatureDelegate instanceof homebridgeLib.CharacteristicDelegate)) {
|
|
58
|
-
throw new TypeError('params.temperatureDelegate: not a CharacteristicDelegate')
|
|
59
|
-
}
|
|
60
|
-
if (
|
|
61
|
-
params.humidityDelegate != null &&
|
|
62
|
-
!(params.humidityDelegate instanceof homebridgeLib.CharacteristicDelegate)
|
|
63
|
-
) {
|
|
64
|
-
throw new TypeError('params.humidityDelegate: not a CharacteristicDelegate')
|
|
65
|
-
}
|
|
66
|
-
if (
|
|
67
|
-
params.vocDensityDelegate != null &&
|
|
68
|
-
!(params.vocDensityDelegate instanceof homebridgeLib.CharacteristicDelegate)
|
|
69
|
-
) {
|
|
70
|
-
throw new TypeError('params.vocDensityDelegate: not a CharacteristicDelegate')
|
|
71
|
-
}
|
|
72
|
-
this._entry = {
|
|
73
|
-
time: 0,
|
|
74
|
-
temp: params.temperatureDelegate.value,
|
|
75
|
-
humidity: 0,
|
|
76
|
-
voc: 0
|
|
77
|
-
}
|
|
78
|
-
params.temperatureDelegate.on('didSet', (value) => {
|
|
79
|
-
this._entry.temp = value
|
|
80
|
-
})
|
|
81
|
-
if (params.humidityDelegate != null) {
|
|
82
|
-
this._entry.humidity = params.humidityDelegate.value
|
|
83
|
-
params.humidityDelegate.on('didSet', (value) => {
|
|
84
|
-
this._entry.humidity = value
|
|
85
|
-
})
|
|
86
|
-
if (params.vocDensityDelegate != null) {
|
|
87
|
-
this._entry.voc = params.vocDensityDelegate.value
|
|
88
|
-
params.vocDensityDelegate.on('didSet', (value) => {
|
|
89
|
-
this._entry.voc = value
|
|
90
|
-
})
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
get _fingerPrint () {
|
|
96
|
-
// return '07 0102 0202 2202 2901 2501 2302 2801'
|
|
97
|
-
return '03 0102 0202 2202'
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
_entryStream (entry) {
|
|
101
|
-
return util.format(
|
|
102
|
-
'|10 %s %s 07 %s %s %s',
|
|
103
|
-
numToHex(swap32(this._h.currentEntry), 8),
|
|
104
|
-
numToHex(swap32(entry.time - this._h.initialTime), 8),
|
|
105
|
-
numToHex(swap16(entry.temp * 100), 4),
|
|
106
|
-
numToHex(swap16(entry.humidity * 100), 4),
|
|
107
|
-
numToHex(swap16(entry.voc), 4)
|
|
108
|
-
)
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
module.exports = Room
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
// homebridge-lib/lib/ServiceDelegate/History/Weather.js
|
|
2
|
-
//
|
|
3
|
-
// Library for Homebridge plugins.
|
|
4
|
-
// Copyright © 2017-2022 Erik Baauw. All rights reserved.
|
|
5
|
-
//
|
|
6
|
-
// The logic for handling Eve history was copied from Simone Tisa's
|
|
7
|
-
// fakagato-history repository, copyright © 2017 simont77.
|
|
8
|
-
// See https://github.com/simont77/fakegato-history.
|
|
9
|
-
|
|
10
|
-
'use strict'
|
|
11
|
-
|
|
12
|
-
const homebridgeLib = require('../../../index')
|
|
13
|
-
const util = require('util')
|
|
14
|
-
|
|
15
|
-
const { ServiceDelegate } = homebridgeLib
|
|
16
|
-
const { History } = ServiceDelegate
|
|
17
|
-
const { swap16, swap32, numToHex } = History
|
|
18
|
-
|
|
19
|
-
/** Class for an Eve Weather _History_ service delegate.
|
|
20
|
-
*
|
|
21
|
-
* This delegate sets up a `Services.eve.History` HomeKit service
|
|
22
|
-
* with keys for the following HomeKit characteristics:
|
|
23
|
-
*
|
|
24
|
-
* key | Characteristic
|
|
25
|
-
* ---------------- | ----------------------------------
|
|
26
|
-
* `name` | `Characteristics.hap.Name`
|
|
27
|
-
* `historyRequest` | `Characteristics.eve.HistoryRequest`
|
|
28
|
-
* `setTime` | `Characteristics.eve.SetTime`
|
|
29
|
-
* `historyStatus` | `Characteristics.eve.HistoryStatus`
|
|
30
|
-
* `historyEntries` | `Characteristics.eve.HistoryEntries`
|
|
31
|
-
*
|
|
32
|
-
* This delegate creates the history from the associated
|
|
33
|
-
* `Characteristics.hap.CurrentTemperature`,
|
|
34
|
-
* `Characteristics.hap.CurrentRelativeHumidity`, and
|
|
35
|
-
* `Characteristics.eve.AirPressure` characteristics.
|
|
36
|
-
* @extends ServiceDelegate.History
|
|
37
|
-
* @memberof ServiceDelegate.History
|
|
38
|
-
*/
|
|
39
|
-
class Weather extends ServiceDelegate.History {
|
|
40
|
-
/** Create a new instance of an Eve Weather _History_ service delegate.
|
|
41
|
-
* @param {!AccessoryDelegate} accessoryDelegate - The delegate of the
|
|
42
|
-
* corresponding HomeKit accessory.
|
|
43
|
-
* @param {!object} params - The parameters for the
|
|
44
|
-
* _History_ HomeKit service.
|
|
45
|
-
* @param {!CharacteristicDelegate} params.temperatureDelegate - A reference
|
|
46
|
-
* to the delegate of the associated `Characteristics.hap.CurrentTemperature`
|
|
47
|
-
* characteristic.
|
|
48
|
-
* @param {?CharacteristicDelegate} params.humidityDelegate - A reference
|
|
49
|
-
* to the delegate of the associated
|
|
50
|
-
* `Characteristics.hap.CurrentRelativeHumidity` characteristic.
|
|
51
|
-
* @param {?CharacteristicDelegate} params.airPressureDelegate - A reference to
|
|
52
|
-
* the delegate of the associated `Characteristics.eve.AirPressure`
|
|
53
|
-
* characteristic.
|
|
54
|
-
*/
|
|
55
|
-
constructor (accessoryDelegate, params) {
|
|
56
|
-
super(accessoryDelegate, params)
|
|
57
|
-
if (!(params.temperatureDelegate instanceof homebridgeLib.CharacteristicDelegate)) {
|
|
58
|
-
throw new TypeError('params.temperatureDelegate: not a CharacteristicDelegate')
|
|
59
|
-
}
|
|
60
|
-
if (
|
|
61
|
-
params.humidityDelegate != null &&
|
|
62
|
-
!(params.humidityDelegate instanceof homebridgeLib.CharacteristicDelegate)
|
|
63
|
-
) {
|
|
64
|
-
throw new TypeError('params.humidityDelegate: not a CharacteristicDelegate')
|
|
65
|
-
}
|
|
66
|
-
if (
|
|
67
|
-
params.airPressureDelegate != null &&
|
|
68
|
-
!(params.airPressureDelegate instanceof homebridgeLib.CharacteristicDelegate)
|
|
69
|
-
) {
|
|
70
|
-
throw new TypeError('params.airPressureDelegate: not a CharacteristicDelegate')
|
|
71
|
-
}
|
|
72
|
-
this._entry = {
|
|
73
|
-
time: 0,
|
|
74
|
-
temp: params.temperatureDelegate.value
|
|
75
|
-
}
|
|
76
|
-
params.temperatureDelegate.on('didSet', (value) => {
|
|
77
|
-
this._entry.temp = value
|
|
78
|
-
})
|
|
79
|
-
if (params.humidityDelegate != null) {
|
|
80
|
-
this._entry.humidity = params.humidityDelegate.value
|
|
81
|
-
params.humidityDelegate.on('didSet', (value) => {
|
|
82
|
-
this._entry.humidity = value
|
|
83
|
-
})
|
|
84
|
-
if (params.airPressureDelegate != null) {
|
|
85
|
-
this._entry.pressure = params.airPressureDelegate.value
|
|
86
|
-
params.airPressureDelegate.on('didSet', (value) => {
|
|
87
|
-
this._entry.pressure = value
|
|
88
|
-
})
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
get _fingerPrint () { return '03 0102 0202 0302' }
|
|
94
|
-
|
|
95
|
-
_entryStream (entry) {
|
|
96
|
-
if (entry.humidity == null) {
|
|
97
|
-
return util.format(
|
|
98
|
-
'|0c %s %s 01 %s',
|
|
99
|
-
numToHex(swap32(this._h.currentEntry), 8),
|
|
100
|
-
numToHex(swap32(entry.time - this._h.initialTime), 8),
|
|
101
|
-
numToHex(swap16(entry.temp * 100), 4)
|
|
102
|
-
)
|
|
103
|
-
}
|
|
104
|
-
if (entry.pressure == null) {
|
|
105
|
-
return util.format(
|
|
106
|
-
'|0e %s %s 03 %s %s',
|
|
107
|
-
numToHex(swap32(this._h.currentEntry), 8),
|
|
108
|
-
numToHex(swap32(entry.time - this._h.initialTime), 8),
|
|
109
|
-
numToHex(swap16(entry.temp * 100), 4),
|
|
110
|
-
numToHex(swap16(entry.humidity * 100), 4)
|
|
111
|
-
)
|
|
112
|
-
}
|
|
113
|
-
return util.format(
|
|
114
|
-
'|10 %s %s 07 %s %s %s',
|
|
115
|
-
numToHex(swap32(this._h.currentEntry), 8),
|
|
116
|
-
numToHex(swap32(entry.time - this._h.initialTime), 8),
|
|
117
|
-
numToHex(swap16(entry.temp * 100), 4),
|
|
118
|
-
numToHex(swap16(entry.humidity * 100), 4),
|
|
119
|
-
numToHex(swap16(entry.pressure * 10), 4)
|
|
120
|
-
)
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
module.exports = Weather
|