This repository has been archived by the owner on Feb 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.js
51 lines (44 loc) · 2.48 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"use strict";
const Homey = require('homey');
class SolaredgeModbusApp extends Homey.App {
onInit() {
this.log('Initializing Solaredge Modbus app ...');
this.log('Registering flows');
new Homey.FlowCardTriggerDevice('changedConsumption').register();
new Homey.FlowCardTriggerDevice('changedStatus').register();
new Homey.FlowCardTriggerDevice('changedExportPower').register();
new Homey.FlowCardTriggerDevice('changedImportPower').register();
// new Homey.FlowCardTriggerDevice('changedBattery').register();
// new Homey.FlowCardTriggerDevice('changedBatteryCharging').register();
// new Homey.FlowCardTriggerDevice('changedBatteryDischarging').register();
// new Homey.FlowCardTriggerDevice('changedBatteryCapacity').register();
}
}
module.exports = SolaredgeModbusApp;
// this.ownconsumption.register();
/*
this.Homey.Flow.getcard('isOperationalStatus')
.register()
.registerRunListener((args, state) => {
if (args.device.getCapabilityValue('status') == Homey.__('Off') && args.status == '1') {
return Promise.resolve(true);
} else if (args.device.getCapabilityValue('status') == Homey.__('Sleeping (auto-shutdown) – Night mode') && args.status == '2') {
return Promise.resolve(true);
} else if (args.device.getCapabilityValue('status') == Homey.__('Grid Monitoring/wake-up') && args.status == '3') {
return Promise.resolve(true);
} else if (args.device.getCapabilityValue('status') == Homey.__('Inverter is ON and producing power') && args.status == '4') {
return Promise.resolve(true);
} else if (args.device.getCapabilityValue('status') == Homey.__('Production (curtailed)') && args.status == '5') {
return Promise.resolve(true);
} else if (args.device.getCapabilityValue('status') == Homey.__('Shutting down') && args.status == '6') {
return Promise.resolve(true);
} else if (args.device.getCapabilityValue('status') == Homey.__('Fault') && args.status == '7') {
return Promise.resolve(true);
} else if (args.device.getCapabilityValue('status') == Homey.__('Maintenance/setup') && args.status == '8') {
return Promise.resolve(true);
} else {
return Promise.resolve(false);
}
})
*/
// changedConsumptiontrigger.register().registerRunListener(async (args,state) => {return true});