Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev ruben #6

Merged
merged 6 commits into from Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 20 additions & 0 deletions .gitattributes
@@ -0,0 +1,20 @@
# Automatically normalize line endings for all text-based files
# http://git-scm.com/docs/gitattributes#_end_of_line_conversion
* text=auto

# For the following file types, normalize line endings to LF on
# checkin and prevent conversion to CRLF when they are checked out
# (this is required in order to prevent newline related issues like,
# for example, after the build script is run)
.* text eol=lf
*.css text eol=lf
*.html text eol=lf
*.jade text eol=lf
*.js text eol=lf
*.json text eol=lf
*.less text eol=lf
*.scss text eol=lf
*.md text eol=lf
*.sh text eol=lf
*.txt text eol=lf
*.xml text eol=lf
5 changes: 4 additions & 1 deletion .gitignore
@@ -1,2 +1,5 @@
node_modules
.env
.idea/*
.DS_Store
npm-debug.log
npm-debug.log
21 changes: 18 additions & 3 deletions README.md
Expand Up @@ -4,9 +4,24 @@ Control your curtains with Slide by Innovation In Motion (https://innovationinmo

Install and setup your Slide device(s) using the official app by Innovation in Motion, on your smartphone. Login using your e-mail address and password of your Slide account, in the Homey app, and select which Slide(s) you want to add to Homey.

Enables the following cards to use in your flows:
- [Trigger] Position changed #level (From fully opened: 0.00 to fully closed: 1.00)
Enables the following cards to use in your flows per curtain device:
- [Trigger] Curtains just closed
- [Trigger] Curtains just opened
- [Trigger] Position changed #level (From fully opened: 1.00 to fully closed: 0.00)
- [Condition] Are curtains closed ?
- [Action] Close curtain
- [Action] Open curtain
- [Action] Toggle between open/closed curtain
- [Action] Set position
- [Action] Immediate stop
- [Action] Immediate motor stop
- [Action] Trigger a re-calibration
- [Action] Enable Touch & Go
- [Action] Disable Touch & Go

Also the follwoing actions are available globally to control your zones:
- [Action] Open all curtains in one zone
- [Action] Close all curtains in one zone
- [Action] Set the position for all curtains in one zone
- [Action] Trigger a re-calibration for all curtains in one zone

Use at your own risk, I accept no responsibility for any damages caused by using this script.
21 changes: 18 additions & 3 deletions README.txt
Expand Up @@ -4,7 +4,22 @@ Make your curtains smart in no-time

Install and setup your Slide device(s) using the official app by Innovation in Motion, on your smartphone. Login using your e-mail address and password of your Slide account, in the Homey app, and select which Slide(s) you want to add to Homey.

Enables the following cards to use in your flows:
- [Trigger] Position changed #level (From fully opened: 0.00 to fully closed: 1.00)
Enables the following cards to use in your flows per curtain device:
- [Trigger] Curtains just closed
- [Trigger] Curtains just opened
- [Trigger] Position changed #level (From fully opened: 1.00 to fully closed: 0.00)
- [Condition] Are curtains closed ?
- [Action] Close curtain
- [Action] Open curtain
- [Action] Toggle between open/closed curtain
- [Action] Set position
- [Action] Immediate stop
- [Action] Immediate motor stop
- [Action] Trigger a re-calibration
- [Action] Enable Touch & Go
- [Action] Disable Touch & Go

Also the follwoing actions are available globally to control your zones:
- [Action] Open all curtains in one zone
- [Action] Close all curtains in one zone
- [Action] Set the position for all curtains in one zone
- [Action] Trigger a re-calibration for all curtains in one zone
55 changes: 52 additions & 3 deletions app.js
@@ -1,12 +1,61 @@
"use strict";

const Homey = require('homey');
const Homey = require('homey');
let SlideZone = require('./include/slidezone');
let SlideHousehold = require('./include/slidehousehold');

class App extends Homey.App {

onInit() {

}
this.log('Slide App init');

let OpenZoneAction = new Homey.FlowCardAction('OpenZone');
OpenZoneAction.register().registerRunListener((args, state) => {
let zone = new SlideZone(Homey.ManagerSettings.get('token'), args.zone.id);
return zone.setPosition(1);
}).getArgument('zone').registerAutocompleteListener(this.zoneAutocompleteListener.bind(this));

let CloseZoneAction = new Homey.FlowCardAction('CloseZone');
CloseZoneAction.register().registerRunListener((args, state) => {
let zone = new SlideZone(Homey.ManagerSettings.get('token'), args.zone.id);
return zone.setPosition(0);
}).getArgument('zone').registerAutocompleteListener(this.zoneAutocompleteListener.bind(this));

let SetZoneAction = new Homey.FlowCardAction('SetZone');
SetZoneAction.register().registerRunListener((args, state) => {
let zone = new SlideZone(Homey.ManagerSettings.get('token'), args.zone.id);
return zone.setPosition(args.windowcoverings_set);
}).getArgument('zone').registerAutocompleteListener(this.zoneAutocompleteListener.bind(this));

let CalibrateZoneAction = new Homey.FlowCardAction('CalibrateZone');
CalibrateZoneAction.register().registerRunListener((args, state) => {
let zone = new SlideZone(Homey.ManagerSettings.get('token'), args.zone.id);
return zone.calibrate();
}).getArgument('zone').registerAutocompleteListener(this.zoneAutocompleteListener.bind(this));
}

/**
* Fill autocomplete for all zone flowcards
*
* @param query
* @param args
* @return {Promise<[{some_value_for_myself: string, icon: string, name: string, description: string}, {}]>}
*/
zoneAutocompleteListener(query, args) {
return new Promise(function (resolve, reject) {
let household = new SlideHousehold(Homey.ManagerSettings.get('token'));
household.getZones().then(body => {
let zones = [];
Object.values(body.data).forEach(function (zone) {
zones.push({
id: zone.id,
name: zone.name,
});
});
resolve(zones);
}).catch(reject);
});
}
}

module.exports = App;