Skip to content

Commit

Permalink
Outlet ip address amends
Browse files Browse the repository at this point in the history
  • Loading branch information
lprhodes committed Feb 27, 2018
1 parent 7cd35c2 commit a948099
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ key | description | example | default
disableAutomaticOff (optional) | Prevent the switch from turning off automatically after a given amount of time. | false | true
onDuration (optional) | The amount of time before the switch automatically turns itself off (used in conjunction with disableAutomaticOff). | 5 | 2
pingIPAddress (optional) | When an IP address is provided, it is pinged every second. If a response is received then the outlet's "Outlet In Use" shows as "Yes", otherwise it shows as "No". | "192.167.1.77" | -
pingIPAddressStateOnly (optional) | Using this option will prevent the hex code from being sent when the state changes | true | false
pingFrequency (optional) | The frequency in seconds that the IP address should be pinged | 5 | 1

#### "data" key-value object
key | description
Expand Down
6 changes: 3 additions & 3 deletions accessories/outlet.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class SwitchAccessory extends BroadlinkRMAccessory {

checkStateWithPing () {
const { config, debug, log, state } = this;
let { pingIPAddress, pingIPAddressStateOnly, name } = config;
let { pingIPAddress, pingIPAddressStateOnly, name, pingFrequency } = config;

const pingFrequency = 1000;
if (!pingFrequency) pingFrequency = 1;

setInterval(() => {
ping.sys.probe(pingIPAddress, (active) => {
Expand All @@ -41,7 +41,7 @@ class SwitchAccessory extends BroadlinkRMAccessory {
this.switchService.setCharacteristic(Characteristic.OutletInUse, 0);
}
})
}, pingFrequency);
}, pingFrequency * 1000);
}

setOutletInUse (value, callback) {
Expand Down

0 comments on commit a948099

Please sign in to comment.