File: dli4.dev

package info (click to toggle)
powerman 2.4.4-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,432 kB
  • sloc: ansic: 19,458; sh: 7,225; yacc: 694; makefile: 455; lex: 272
file content (58 lines) | stat: -rw-r--r-- 1,236 bytes parent folder | download | duplicates (2)
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
52
53
54
55
56
57
58
# Support for 8-port Digital Loggers, Inc. web power switch III or IV
#
# Powerman.conf should look something like this:
#   include "/etc/powerman/dli4.dev"
#   device "lpc" "dli4" "/usr/sbin/httppower -u http://192.168.0.100 |&"
#   node "p[1-8]" "lpc" "[1-8]"
#
# Thanks to Gaylord Holder for providing info to create this script.
#
specification "dli4" {
	timeout 	30

	plug name { "1" "2" "3" "4" "5" "6" "7" "8" }

	script login {
		expect "httppower> "
		send "auth admin:1234\n"
		expect "httppower> "
	}
	script logout {
		send "quit\n"
	}
	script status_all {
		send "get index.htm\n"
		expect "Controller:"
		foreachplug {
			expect "Outlet ([1-8]+)[^O]*(ON|OFF)"
                        setplugstate $1 $2 on="ON" off="OFF"
                }
		expect "httppower> "
	}
	script on {
		send "post outlet %s=ON\n"
		expect "httppower> "
	}
	script off {
		send "post outlet %s=OFF\n"
		expect "httppower> "
	}
	script cycle {
		send "post outlet %s=OFF\n"
		expect "httppower> "
		delay 4
		send "post outlet %s=ON\n"
		expect "httppower> "
	}
	script cycle_all {
		foreachplug {
			send "post outlet %s=OFF\n"
			expect "httppower> "
		}
		delay 4
		foreachplug {
			send "post outlet %s=ON\n"
			expect "httppower> "
		}
	}
}