Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // K1 - Up, K2 - Down!
- var yourdevice = "ssr8_cover";
- //var ssr8_id = "wb-mio-gpio_116:1/";
- var ssr8_id = "wb-gpio/EXT1_";
- defineVirtualDevice(yourdevice, {
- title: yourdevice ,
- cells: {
- Up1: {
- title: "Up 1",
- type: "pushbutton",
- value: "false"
- },
- Stop1: {
- title: "Stop 1",
- type: "pushbutton",
- value: "false"
- },
- Down1: {
- title: "Down 1",
- type: "pushbutton",
- value: "false"
- },
- Up2: {
- title: "Up 2",
- type: "pushbutton",
- value: "false"
- },
- Stop2: {
- title: "Stop 2",
- type: "pushbutton",
- value: "false"
- },
- Down2: {
- title: "Down 2",
- type: "pushbutton",
- value: "false"
- },
- Up3: {
- title: "Up 3",
- type: "pushbutton",
- value: "false"
- },
- Stop3: {
- title: "Stop 3",
- type: "pushbutton",
- value: "false"
- },
- Down3: {
- title: "Down 3",
- type: "pushbutton",
- value: "false"
- },
- Up4: {
- title: "Up 4",
- type: "pushbutton",
- value: "false"
- },
- Stop4: {
- title: "Stop 4",
- type: "pushbutton",
- value: "false"
- },
- Down4: {
- title: "Down 4",
- type: "pushbutton",
- value: "false"
- },
- }
- })
- // 1
- defineRule({
- whenChanged: [yourdevice + "/Up 1"],
- then: function (newValue, devName, cellName) {
- dev[ssr8_id + "K1"] = true;
- setTimeout(function () {
- dev[ssr8_id + "K1"] = false;
- }, 500);
- }
- })
- defineRule({
- whenChanged: [yourdevice + "/Stop 1"],
- then: function (newValue, devName, cellName) {
- dev[ssr8_id + "K2"] = true;
- dev[ssr8_id + "K1"] = true;
- setTimeout(function () {
- dev[ssr8_id + "K2"] = false;
- dev[ssr8_id + "K1"] = false;
- }, 500);
- }
- })
- defineRule({
- whenChanged: [yourdevice + "/Down 1"],
- then: function (newValue, devName, cellName) {
- dev[ssr8_id + "K2"] = true;
- setTimeout(function () {
- dev[ssr8_id + "K2"] = false;
- }, 500);
- }
- })
- // 2
- defineRule({
- whenChanged: [yourdevice + "/Up 2"],
- then: function (newValue, devName, cellName) {
- dev[ssr8_id + "K3"] = true;
- setTimeout(function () {
- dev[ssr8_id + "K3"] = false;
- }, 500);
- }
- })
- defineRule({
- whenChanged: [yourdevice + "/Stop 2"],
- then: function (newValue, devName, cellName) {
- dev[ssr8_id + "K4"] = true;
- dev[ssr8_id + "K3"] = true;
- setTimeout(function () {
- dev[ssr8_id + "K4"] = false;
- dev[ssr8_id + "K3"] = false;
- }, 500);
- }
- })
- defineRule({
- whenChanged: [yourdevice + "/Down 2"],
- then: function (newValue, devName, cellName) {
- dev[ssr8_id + "K4"] = true;
- setTimeout(function () {
- dev[ssr8_id + "K4"] = false;
- }, 500);
- }
- })
- // 3
- defineRule({
- whenChanged: [yourdevice + "/Up 3"],
- then: function (newValue, devName, cellName) {
- dev[ssr8_id + "K5"] = true;
- setTimeout(function () {
- dev[ssr8_id + "K5"] = false;
- }, 500);
- }
- })
- defineRule({
- whenChanged: [yourdevice + "/Stop 3"],
- then: function (newValue, devName, cellName) {
- dev[ssr8_id + "K6"] = true;
- dev[ssr8_id + "K5"] = true;
- setTimeout(function () {
- dev[ssr8_id + "K6"] = false;
- dev[ssr8_id + "K5"] = false;
- }, 500);
- }
- })
- defineRule({
- whenChanged: [yourdevice + "/Down 3"],
- then: function (newValue, devName, cellName) {
- dev[ssr8_id + "K6"] = true;
- setTimeout(function () {
- dev[ssr8_id + "K6"] = false;
- }, 500);
- }
- })
- // 4
- defineRule({
- whenChanged: [yourdevice + "/Up 4"],
- then: function (newValue, devName, cellName) {
- dev[ssr8_id + "K7"] = true;
- setTimeout(function () {
- dev[ssr8_id + "K7"] = false;
- }, 500);
- }
- })
- defineRule({
- whenChanged: [yourdevice + "/Stop 4"],
- then: function (newValue, devName, cellName) {
- dev[ssr8_id + "K8"] = true;
- dev[ssr8_id + "K7"] = true;
- setTimeout(function () {
- dev[ssr8_id + "K8"] = false;
- dev[ssr8_id + "K7"] = false;
- }, 500);
- }
- })
- defineRule({
- whenChanged: [yourdevice + "/Down 4"],
- then: function (newValue, devName, cellName) {
- log(yourdevice + "/Down 4 was pressed");
- dev[ssr8_id + "K8"] = true;
- setTimeout(function () {
- dev[ssr8_id + "K8"] = false;
- }, 500);
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment