Skip to content

Commit

Permalink
Release 1.2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
jghaanstra committed Mar 4, 2019
1 parent 178da4f commit c05008c
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 80 deletions.
3 changes: 2 additions & 1 deletion APPSTORE.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ For support please use the official support topic on the forum [here](https://co
- When using multiple IP Webcameras only one global image token is registered and available. This is due to current limitations of Homey core and will hopefully become available in the future.

## Changelog
### v1.2.8 - 2019-02-xx
### v1.2.8 - 2019-03-04
* FIX: improvements to pairing and settings template for firmware 2.x
* FIX: code improvements to avoid continous spinner on email snapshot action card
73 changes: 68 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,77 @@
"use strict";

const Homey = require('homey');
const flowActions = require("/lib/flow/actions.js");
const util = require('/lib/util.js');

class IpwebcamApp extends Homey.App {

onInit() {
this.log('Initializing Android IP Webcam app ...');
flowActions.init();
}
onInit() {
this.log('Initializing Android IP Webcam app ...');

new Homey.FlowCardAction('emailsnapshot')
.register()
.registerRunListener(async (args) => {
const image = await util.createSnapshot(args.device.getSetting('address'), args.device.getSetting('port'), args.device.getSetting('username'), args.device.getSetting('password'))
if (image) {
return util.sendSnapshot(image, args);
} else {
throw new Error('Snapshot not created succesfully');
}
});

new Homey.FlowCardAction('sensor_threshold')
.register()
.registerRunListener((args) => {
if(args.sensor_type == 'motion') {
var path = "settings/motion_limit?set=" + args.threshold;
} else if (args.sensor_type == 'sound') {
var path = "settings/adet_limit?set=" + args.threshold;
}
return util.singleCommand(args.device.getSetting('address'), args.device.getSetting('port'), args.device.getSetting('username'), args.device.getSetting('password'), args, path);
});

new Homey.FlowCardAction('nightvision')
.register()
.registerRunListener((args) => {
return util.nightvision(args.device.getSetting('address'), args.device.getSetting('port'), args.device.getSetting('username'), args.device.getSetting('password'), args);
});

new Homey.FlowCardAction('zoom')
.register()
.registerRunListener((args) => {
var path = "ptz?zoom=" + args.zoom;
return util.singleCommand(args.device.getSetting('address'), args.device.getSetting('port'), args.device.getSetting('username'), args.device.getSetting('password'), args, path);
});

new Homey.FlowCardAction('quality')
.register()
.registerRunListener((args) => {
var path = "settings/quality?set=" + args.quality;
return util.singleCommand(args.device.getSetting('address'), args.device.getSetting('port'), args.device.getSetting('username'), args.device.getSetting('password'), args, path);
});

new Homey.FlowCardAction('led')
.register()
.registerRunListener((args) => {
if(args.led == 'on') {
var path = "enabletorch";
} else if (args.led == 'off') {
var path = "disabletorch";
}
return util.singleCommand(args.device.getSetting('address'), args.device.getSetting('port'), args.device.getSetting('username'), args.device.getSetting('password'), args, path);
});

new Homey.FlowCardAction('whichcamera')
.register()
.registerRunListener((args) => {
if(args.whichcamera == 'on') {
var path = "settings/ffc?set=on";
} else if (args.whichcamera == 'off') {
var path = "settings/ffc?set=off";
}
return util.singleCommand(args.device.getSetting('address'), args.device.getSetting('port'), args.device.getSetting('username'), args.device.getSetting('password'), args, path);
});
}
}

module.exports = IpwebcamApp;
73 changes: 0 additions & 73 deletions lib/flow/actions.js

This file was deleted.

3 changes: 2 additions & 1 deletion lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ exports.testEmail = function (args, callback) {
transporter.sendMail(mailOptions, function(error, info) {
if(error) {
callback (error, false);
} else {
callback (false, "OK");
}
callback (false, "OK");
});
}

Expand Down

0 comments on commit c05008c

Please sign in to comment.