Constructor
new SmileP1(optionsopt)
Properties:
Name | Type | Description |
---|---|---|
loggedIn |
boolean | login state. |
firmwareLevel |
number | firmware level of the Smile P1. e.g. '2.1.13' |
Example
// create a Smile P1 session, login to device, fetch meter readings
const Smile = require('smilep1');
const smile = new Smile();
async function getMeterReadings() {
try {
// fill in the id of the device, e.g. 'hcfrasde'
// fill in the ip address of the device, e.g. '192.168.1.50'
const options = { id='yourDeviceID', host='yourDeviceIP'}
await smile.login(options);
const powerInfo = await smile.getMeterReadings();
console.log(powerInfo);
} catch (error) {
console.log(error);
}
}
getMeterReadings();
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
sessionOptions |
<optional> |
configurable session options |
Methods
(async) discover(optionsopt) → {Promise.<discoverInfo>}
Discover a Plugwise device in your local network (internet connection required)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
discoverOptions |
<optional> |
configurable discovery options |
Returns:
The device information.
- Type
- Promise.<discoverInfo>
(async) getFirmwareLevel() → {Promise.<firmwareLevel>}
Get firmware level of the Smile P1 device.
Returns:
The status information.
- Type
- Promise.<firmwareLevel>
(async) getInterfaceStatus() → {Promise.<interfaceStatus>}
Get the network interface status. (V3 firmware only)
Returns:
- Type
- Promise.<interfaceStatus>
(async) getLogs(optionsopt) → {Promise.<meterLogs>}
Get the power and gas log history.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
logsOptions |
<optional> |
configurable Logs options |
Returns:
- Type
- Promise.<meterLogs>
(async) getMeterReadings() → {Promise.<meterReadings>}
Get the power and gas meter readings.
Returns:
- Type
- Promise.<meterReadings>
(async) getStatus() → {Promise.<statusV2>|Promise.<statusV3>}
Get the deviceInfo. The returned device info depends on fw level
Returns:
The device info depends on fw level
(async) getWifiScan() → {Promise.<WifiScanInfo>}
Perform a wifi scan. (V3 firmware only)
Returns:
- Type
- Promise.<WifiScanInfo>
(async) login(optionsopt) → {Promise.<loggedIn>}
Login to the Smile P1. Passing options will override any existing session settings.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
sessionOptions |
<optional> |
configurable session options |
Returns:
The loggedIn state.
- Type
- Promise.<loggedIn>
(async) reboot() → {Promise.<rebootStarted>}
Reboot to the Smile P1. (V3 firmware only)
Returns:
The rebooted state.
- Type
- Promise.<rebootStarted>