trigger_switch_d 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/COPYING.txt +674 -0
- data/LICENSE.txt +54 -0
- data/README.rdoc +106 -0
- data/bin/teach +44 -0
- data/bin/tsd +68 -0
- data/bin/turn_off +42 -0
- data/bin/turn_on +39 -0
- data/doc/classes/Tellstick/Tellstick.html +117 -0
- data/doc/classes/Tellstick/TellstickIO.html +265 -0
- data/doc/classes/Tellstick/TellstickIO.src/M000020.html +18 -0
- data/doc/classes/Tellstick/TellstickIO.src/M000021.html +20 -0
- data/doc/classes/Tellstick/TellstickIO.src/M000022.html +26 -0
- data/doc/classes/Tellstick/TellstickIO.src/M000023.html +19 -0
- data/doc/classes/Tellstick/TellstickIO.src/M000024.html +26 -0
- data/doc/classes/Tellstick/TellstickIO.src/M000025.html +16 -0
- data/doc/classes/Tellstick/TellstickIO.src/M000026.html +16 -0
- data/doc/classes/Tellstick/TellstickIO.src/M000027.html +24 -0
- data/doc/classes/Tellstick.html +204 -0
- data/doc/classes/Tellstick.src/M000019.html +25 -0
- data/doc/classes/TriggerSwitchD/Action.html +165 -0
- data/doc/classes/TriggerSwitchD/Action.src/M000015.html +28 -0
- data/doc/classes/TriggerSwitchD/Action.src/M000016.html +18 -0
- data/doc/classes/TriggerSwitchD/Application.html +203 -0
- data/doc/classes/TriggerSwitchD/Application.src/M000017.html +21 -0
- data/doc/classes/TriggerSwitchD/Application.src/M000018.html +40 -0
- data/doc/classes/TriggerSwitchD/ConfigFactory/Config.html +127 -0
- data/doc/classes/TriggerSwitchD/ConfigFactory/Config.src/M000014.html +23 -0
- data/doc/classes/TriggerSwitchD/ConfigFactory.html +141 -0
- data/doc/classes/TriggerSwitchD/ConfigFactory.src/M000013.html +24 -0
- data/doc/classes/TriggerSwitchD/IPC.html +134 -0
- data/doc/classes/TriggerSwitchD/IPC.src/M000012.html +32 -0
- data/doc/classes/TriggerSwitchD/Schedule/InstanceMethods.html +242 -0
- data/doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000005.html +19 -0
- data/doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000006.html +18 -0
- data/doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000007.html +23 -0
- data/doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000008.html +19 -0
- data/doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000009.html +19 -0
- data/doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000010.html +18 -0
- data/doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000011.html +18 -0
- data/doc/classes/TriggerSwitchD/Schedule.html +147 -0
- data/doc/classes/TriggerSwitchD/Schedule.src/M000004.html +19 -0
- data/doc/classes/TriggerSwitchD/SwitchFactory.html +135 -0
- data/doc/classes/TriggerSwitchD/SwitchFactory.src/M000003.html +20 -0
- data/doc/classes/TriggerSwitchD.html +212 -0
- data/doc/classes/TriggerSwitchD.src/M000001.html +22 -0
- data/doc/classes/TriggerSwitchD.src/M000002.html +27 -0
- data/doc/created.rid +1 -0
- data/doc/files/lib/tellstick/protocol/nexa_rb.html +126 -0
- data/doc/files/lib/tellstick/protocol/not_connected_rb.html +126 -0
- data/doc/files/lib/tellstick/protocol/null_protocol_rb.html +126 -0
- data/doc/files/lib/tellstick/protocol/plain_text_rb.html +126 -0
- data/doc/files/lib/tellstick/protocol/proove_rb.html +126 -0
- data/doc/files/lib/tellstick/protocol/protocol_loader_rb.html +126 -0
- data/doc/files/lib/tellstick/protocol/rising_sun_rb.html +126 -0
- data/doc/files/lib/tellstick/protocol/waveman_rb.html +126 -0
- data/doc/files/lib/tellstick/tellstick_io_rb.html +135 -0
- data/doc/files/lib/tellstick/tellstick_rb.html +135 -0
- data/doc/files/lib/tellstick_rb.html +134 -0
- data/doc/files/lib/trigger_switch_d/action_rb.html +126 -0
- data/doc/files/lib/trigger_switch_d/application_rb.html +136 -0
- data/doc/files/lib/trigger_switch_d/config_rb.html +126 -0
- data/doc/files/lib/trigger_switch_d/daylight_rb.html +126 -0
- data/doc/files/lib/trigger_switch_d/ipc_rb.html +126 -0
- data/doc/files/lib/trigger_switch_d/schedule_rb.html +126 -0
- data/doc/files/lib/trigger_switch_d/switch_rb.html +126 -0
- data/doc/files/lib/trigger_switch_d/trigger_switch_d_helper_rb.html +126 -0
- data/doc/files/lib/trigger_switch_d_rb.html +140 -0
- data/doc/fr_class_index.html +38 -0
- data/doc/fr_file_index.html +46 -0
- data/doc/fr_method_index.html +53 -0
- data/doc/index.html +24 -0
- data/features/execute_schedule.feature +20 -0
- data/features/group_aliases.feature +31 -0
- data/features/handle_switches.feature +36 -0
- data/features/listen_for_client_call.feature +23 -0
- data/features/persistent_schedule.feature +70 -0
- data/features/proove_protocol.feature +20 -0
- data/features/schedule.feature +25 -0
- data/features/simple_string_protocol.feature +35 -0
- data/features/step_definitions/execute_schedule_steps.rb +16 -0
- data/features/step_definitions/group_aliases_steps.rb +24 -0
- data/features/step_definitions/handle_switches_steps.rb +21 -0
- data/features/step_definitions/listen_for_client_call_steps.rb +34 -0
- data/features/step_definitions/persistent_schedule_steps.rb +18 -0
- data/features/step_definitions/proove_protocol_steps.rb +3 -0
- data/features/step_definitions/schedule_steps.rb +9 -0
- data/features/step_definitions/shared_steps.rb +75 -0
- data/features/step_definitions/simple_string_protocol_steps.rb +3 -0
- data/features/step_definitions/sunrise_steps.rb +22 -0
- data/features/step_definitions/tellstick_connected_steps.rb +21 -0
- data/features/sunrise.feature +22 -0
- data/features/sunset.feature +22 -0
- data/features/support/action_helpers.rb +10 -0
- data/features/support/env.rb +7 -0
- data/features/support/listen_for_client_call_helper.rb +71 -0
- data/features/support/proove_helpers.rb +6 -0
- data/features/support/sunrise_helper.rb +8 -0
- data/features/tellstick_connected.feature +14 -0
- data/lib/tellstick/protocol/nexa.rb +48 -0
- data/lib/tellstick/protocol/not_connected.rb +42 -0
- data/lib/tellstick/protocol/null_protocol.rb +41 -0
- data/lib/tellstick/protocol/plain_text.rb +35 -0
- data/lib/tellstick/protocol/proove.rb +83 -0
- data/lib/tellstick/protocol/protocol_loader.rb +26 -0
- data/lib/tellstick/protocol/rising_sun.rb +42 -0
- data/lib/tellstick/protocol/waveman.rb +29 -0
- data/lib/tellstick/tellstick.rb +73 -0
- data/lib/tellstick/tellstick_io.rb +80 -0
- data/lib/tellstick.rb +20 -0
- data/lib/trigger_switch_d/action.rb +83 -0
- data/lib/trigger_switch_d/application.rb +89 -0
- data/lib/trigger_switch_d/config.rb +83 -0
- data/lib/trigger_switch_d/daylight.rb +114 -0
- data/lib/trigger_switch_d/ipc.rb +39 -0
- data/lib/trigger_switch_d/schedule.rb +95 -0
- data/lib/trigger_switch_d/switch.rb +37 -0
- data/lib/trigger_switch_d/trigger_switch_d_helper.rb +44 -0
- data/lib/trigger_switch_d.rb +26 -0
- data/spec/spec_helper.rb +22 -0
- data/spec/tellstick/protocol/nexa_spec.rb +57 -0
- data/spec/tellstick/protocol/proove_spec.rb +61 -0
- data/spec/tellstick/protocol/rising_sun_spec.rb +56 -0
- data/spec/tellstick/protocol/waveman_spec.rb +57 -0
- data/spec/tellstick/tellstick_io_spec.rb +31 -0
- data/spec/tellstick/tellstick_spec.rb +86 -0
- data/spec/trigger_switch_d/application_spec.rb +144 -0
- data/spec/trigger_switch_d/config_spec.rb +94 -0
- data/spec/trigger_switch_d/daylight_spec.rb +39 -0
- data/spec/trigger_switch_d/ipc_spec.rb +119 -0
- data/spec/trigger_switch_d/schedule_spec.rb +103 -0
- data/spec/trigger_switch_d/trigger_switch_d_spec_helpers.rb +24 -0
- data/trigger_switch_d.gemspec +43 -0
- metadata +206 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
# TriggerSwitchD, executes commands to activate/deactive remote switches.
|
2
|
+
# (c) Copyright 2010 Pontus Strömdahl, AdhocSkill.
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
|
18
|
+
require File.join(File.dirname(__FILE__),"..","spec_helper")
|
19
|
+
|
20
|
+
describe Daylight do
|
21
|
+
before(:each) do
|
22
|
+
year = 2009
|
23
|
+
month = 12
|
24
|
+
day = 14
|
25
|
+
@date = Date.new(year,month,day)
|
26
|
+
latitude = 60.678
|
27
|
+
longitude = 17.142
|
28
|
+
@at_location = {:north => latitude, :west => -longitude}
|
29
|
+
end
|
30
|
+
it "calculates the sunrise for a location and date" do
|
31
|
+
time = @date.extend(Daylight).sunrise(@at_location).localtime
|
32
|
+
"#{0 if time.hour < 10}#{time.hour}:#{0 if time.min < 10}#{time.min}".should == "08:55"
|
33
|
+
end
|
34
|
+
|
35
|
+
it "calculates the sunset for a location and date" do
|
36
|
+
time = @date.extend(Daylight).sunset(@at_location).localtime
|
37
|
+
"#{0 if time.hour < 10}#{time.hour}:#{0 if time.min < 10}#{time.min}".should == "14:39"
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
# TriggerSwitchD, executes commands to activate/deactive remote switches.
|
2
|
+
# (c) Copyright 2010 Pontus Strömdahl, AdhocSkill.
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
require File.join(File.dirname(__FILE__),"..","spec_helper")
|
18
|
+
|
19
|
+
module TriggerSwitchD
|
20
|
+
|
21
|
+
describe "IPC" do
|
22
|
+
before(:each) do
|
23
|
+
mock_listen_sock = mock("UNIXSocket")
|
24
|
+
mock_sock = mock("UNIXSocket")
|
25
|
+
mock_listen_sock.stub!(:recvfrom).with(anything).and_return(["", ["AF_UNIX", ""]])
|
26
|
+
mock_sock.stub!(:accept).and_return(mock_listen_sock)
|
27
|
+
UNIXServer.stub!(:open).with(a_kind_of(String)).and_return(mock_sock)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should respond to []" do
|
31
|
+
IPC.create("some_path")["received"].should == ""
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should respond to []=" do
|
35
|
+
ipc = IPC.create("some_path")
|
36
|
+
ipc["response"] = "..."
|
37
|
+
ipc["response"].should == "..."
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should receive a message" do
|
41
|
+
message = "a message"
|
42
|
+
mock_listen_sock = mock("UNIXSocket")
|
43
|
+
mock_sock = mock("UNIXSocket")
|
44
|
+
mock_listen_sock.stub!(:recvfrom).with(anything).and_return([message, ["AF_UNIX", ""]])
|
45
|
+
mock_sock.stub!(:accept).and_return(mock_listen_sock)
|
46
|
+
UNIXServer.stub!(:open).with(a_kind_of(String)).and_return(mock_sock)
|
47
|
+
|
48
|
+
ipc = IPC.create("some_path")
|
49
|
+
ipc["received"].should == message
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should send a message" do
|
53
|
+
message = "a message"
|
54
|
+
mock_accepted_sock = mock("UNIXSocket")
|
55
|
+
mock_accepted_sock.stub!(:recvfrom).with(anything).and_return([message, ["AF_UNIX", ""]])
|
56
|
+
mock_accepted_sock.stub!(:send).with(a_kind_of(String),0)
|
57
|
+
|
58
|
+
mock_sock = mock("UNIXSocket")
|
59
|
+
mock_sock.stub!(:accept).and_return(mock_accepted_sock)
|
60
|
+
UNIXServer.stub!(:open).with(a_kind_of(String)).and_return(mock_sock)
|
61
|
+
mock_accepted_sock.should_receive(:send).with(message,0)
|
62
|
+
|
63
|
+
ipc = IPC.create("some_path")
|
64
|
+
ipc["response"] = message
|
65
|
+
ipc.run
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should continually respond to received messages" do
|
69
|
+
messages = {"devices" => "first", "schedule" => "second"}
|
70
|
+
mock_accepted_sock = mock("UNIXSocket")
|
71
|
+
mock_accepted_sock.stub!(:recvfrom).with(anything).and_return(["devices", ["AF_UNIX", ""]],
|
72
|
+
["schedule", ["AF_UNIX", ""]],
|
73
|
+
["stop", ["AF_UNIX", ""]])
|
74
|
+
|
75
|
+
mock_sock = mock("UNIXSocket")
|
76
|
+
mock_sock.stub!(:accept).and_return(mock_accepted_sock)
|
77
|
+
UNIXServer.stub!(:open).with(a_kind_of(String)).and_return(mock_sock)
|
78
|
+
mock_accepted_sock.should_receive(:send).with(messages["devices"],0).ordered
|
79
|
+
mock_accepted_sock.should_receive(:send).with(messages["schedule"],0).ordered
|
80
|
+
|
81
|
+
ipc = IPC.create("some_path")
|
82
|
+
ipc["response"] = messages[ipc["received"]]
|
83
|
+
ipc.run
|
84
|
+
ipc["response"] = messages[ipc["received"]]
|
85
|
+
ipc.run
|
86
|
+
end
|
87
|
+
|
88
|
+
context "client is about to disconnect" do
|
89
|
+
it "should respond to bye" do
|
90
|
+
message = "bye"
|
91
|
+
mock_accepted_sock = mock("UNIXSocket")
|
92
|
+
mock_accepted_sock.stub!(:recvfrom).with(anything).and_return([message, ["AF_UNIX", ""]])
|
93
|
+
mock_accepted_sock.stub!(:send).with(a_kind_of(String),0)
|
94
|
+
|
95
|
+
mock_sock = mock("UNIXSocket")
|
96
|
+
mock_sock.stub!(:accept).and_return(mock_accepted_sock)
|
97
|
+
UNIXServer.stub!(:open).with(a_kind_of(String)).and_return(mock_sock)
|
98
|
+
mock_accepted_sock.should_receive(:send).with(message,0)
|
99
|
+
mock_sock.should_receive(:accept).twice
|
100
|
+
|
101
|
+
ipc = IPC.create("some_path")
|
102
|
+
end
|
103
|
+
it "should respond to empty string" do
|
104
|
+
message = ""
|
105
|
+
mock_accepted_sock = mock("UNIXSocket")
|
106
|
+
mock_accepted_sock.stub!(:recvfrom).with(anything).and_return([message, ["AF_UNIX", ""]])
|
107
|
+
mock_accepted_sock.stub!(:send).with(a_kind_of(String),0)
|
108
|
+
|
109
|
+
mock_sock = mock("UNIXSocket")
|
110
|
+
mock_sock.stub!(:accept).and_return(mock_accepted_sock)
|
111
|
+
UNIXServer.stub!(:open).with(a_kind_of(String)).and_return(mock_sock)
|
112
|
+
mock_accepted_sock.should_not_receive(:send).with(message,0)
|
113
|
+
mock_sock.should_receive(:accept).twice
|
114
|
+
|
115
|
+
ipc = IPC.create("some_path")
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# TriggerSwitchD, executes commands to activate/deactive remote switches.
|
2
|
+
# (c) Copyright 2010 Pontus Strömdahl, AdhocSkill.
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
require File.join(File.dirname(__FILE__),"..","spec_helper")
|
18
|
+
|
19
|
+
module TriggerSwitchD
|
20
|
+
|
21
|
+
describe "Schedule" do
|
22
|
+
before(:each) do
|
23
|
+
year = 2009
|
24
|
+
month = 12
|
25
|
+
day = 14
|
26
|
+
@date = Date.new(year,month,day)
|
27
|
+
latitude = 60.678
|
28
|
+
longitude = 17.142
|
29
|
+
@environment = Config.default_environment
|
30
|
+
@environment[:at_location] = {:north => latitude, :west => -longitude}
|
31
|
+
SwitchFactory.new(["house_code", "unit_code", "model_name"])
|
32
|
+
@devices = {"sovrum" => [Switch.new(:house_code => "4", :unit_code => "4", :model_name => "plain_text")],
|
33
|
+
"källare" => [Switch.new(:house_code => "4", :unit_code => "4", :model_name => "plain_text")]}
|
34
|
+
|
35
|
+
end
|
36
|
+
it "should respond to schedule_action" do
|
37
|
+
Schedule.create.schedule_action(Action.new("tänd källare klockan 14:00",@devices,@environment,@date)).should_not be_nil
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should respond to find" do
|
41
|
+
schedule = Schedule.create
|
42
|
+
schedule.schedule_action(Action.new("tänd källare klockan 14:10",@devices,@environment,@date))
|
43
|
+
name = "tänd källare klockan 14:10"
|
44
|
+
event = schedule.find(name)
|
45
|
+
event.should_not be_nil
|
46
|
+
event.to_s.should include(name)
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should respond to delete" do
|
50
|
+
schedule = Schedule.create
|
51
|
+
schedule.schedule_action(Action.new("släck sovrum klockan 14:15",@devices,@environment,@date))
|
52
|
+
name = "släck sovrum klockan 14:15"
|
53
|
+
schedule.find(name).should_not be_nil
|
54
|
+
schedule.delete(name).should_not be_nil
|
55
|
+
schedule.find(name).should be_nil
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should respond to execute" do
|
59
|
+
schedule = Schedule.create
|
60
|
+
output = StringIO.new
|
61
|
+
schedule.schedule_action(Action.new("tänd sovrum klockan 14:45",@devices,@environment,@date))
|
62
|
+
name = "tänd sovrum klockan 14:45"
|
63
|
+
schedule.find(name).should_not be_nil
|
64
|
+
schedule.execute("14:45",output)
|
65
|
+
schedule.find(name).should be_nil
|
66
|
+
output.string.should include("Strömbrytare 44 tänd")
|
67
|
+
end
|
68
|
+
|
69
|
+
context "action scheduled at sunrise" do
|
70
|
+
it "should respond to execute" do
|
71
|
+
schedule = Schedule.create
|
72
|
+
output = StringIO.new
|
73
|
+
action = Action.new("tänd sovrum vid soluppgång",@devices,@environment,@date)
|
74
|
+
schedule.schedule_action(action)
|
75
|
+
schedule.find(action.to_s).should_not be_nil
|
76
|
+
schedule.execute("08:55",output)
|
77
|
+
schedule.find(action.to_s).should be_nil
|
78
|
+
output.string.should include("Strömbrytare 44 tänd")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should not execute action if action deleted" do
|
83
|
+
schedule = Schedule.create
|
84
|
+
output = StringIO.new
|
85
|
+
schedule.schedule_action(Action.new("tänd sovrum klockan 14:45",@devices,@environment,@date))
|
86
|
+
name = "tänd sovrum klockan 14:45"
|
87
|
+
schedule.find(name).should_not be_nil
|
88
|
+
schedule.delete(name)
|
89
|
+
schedule.find(name).should be_nil
|
90
|
+
schedule.execute("14:45",output)
|
91
|
+
output.string.should_not include("Strömbrytare 44 tänd")
|
92
|
+
end
|
93
|
+
|
94
|
+
it "finds next action by hour and minute" do
|
95
|
+
schedule = Schedule.create
|
96
|
+
schedule.schedule_action(Action.new("tänd källare klockan 15:15",@devices,@environment,@date))
|
97
|
+
schedule.schedule_action(Action.new("tänd källare klockan 14:00",@devices,@environment,@date))
|
98
|
+
schedule.next_action_at("13:59").should == "14:00"
|
99
|
+
schedule.next_action_at("14:00").should == "15:15"
|
100
|
+
schedule.next_action_at("15:15").should == "23:59:59"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# TriggerSwitchD, executes commands to activate/deactive remote switches.
|
2
|
+
# (c) Copyright 2010 Pontus Strömdahl, AdhocSkill.
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
module TriggerSwitchD
|
18
|
+
def self.verify_log_includes(pattern,count,expected)
|
19
|
+
in_log = Config.log_object.string.scan(pattern).flatten
|
20
|
+
in_log.length.should == count
|
21
|
+
in_log.select {|str| expected.include? str}.length.should == count
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# TriggerSwitchD, executes commands to activate/deactive remote switches.
|
2
|
+
# (c) Copyright 2010 Pontus Strömdahl, AdhocSkill.
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
|
18
|
+
require 'rubygems'
|
19
|
+
SPEC = Gem::Specification.new do |s|
|
20
|
+
s.name = "trigger_switch_d"
|
21
|
+
s.version = "0.1.0"
|
22
|
+
s.author = "Pontus Strömdahl"
|
23
|
+
s.email = "pontus.stromdahl@adhocskill.com"
|
24
|
+
s.homepage = "http://www.adhocskill.com/"
|
25
|
+
s.platform = Gem::Platform::RUBY
|
26
|
+
s.summary = "Daemon to execute schedule for remote devices"
|
27
|
+
s.description = <<-EOS
|
28
|
+
Schedule remote triggered switches and dimmers to activate/deactivate the lights in your home.\n
|
29
|
+
Type your schedule in plain text and have an USB connected tellstick send the appropriate commands,\n
|
30
|
+
according to your schedule.
|
31
|
+
EOS
|
32
|
+
|
33
|
+
candidates = Dir.glob("{bin,doc,lib,spec,features}/**/*")
|
34
|
+
candidates += ["LICENSE.txt","README.rdoc","COPYING.txt","trigger_switch_d.gemspec"]
|
35
|
+
s.files = candidates.delete_if do |item|
|
36
|
+
item.include?("CVS") || item.include?("rdoc") ||
|
37
|
+
item.include?("devices") || item.include?("scheduled_actions")
|
38
|
+
end
|
39
|
+
s.require_path = "lib"
|
40
|
+
s.has_rdoc = true
|
41
|
+
s.extra_rdoc_files = ["README.rdoc"]
|
42
|
+
s.add_dependency("ruby-ftd2xx", ">= 0.0.1")
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,206 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: trigger_switch_d
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- "Pontus Str\xC3\xB6mdahl"
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-03-24 00:00:00 +01:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: ruby-ftd2xx
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
- 0
|
30
|
+
- 1
|
31
|
+
version: 0.0.1
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
description: " Schedule remote triggered switches and dimmers to activate/deactivate the lights in your home.\n\n Type your schedule in plain text and have an USB connected tellstick send the appropriate commands,\n\n according to your schedule.\n"
|
35
|
+
email: pontus.stromdahl@adhocskill.com
|
36
|
+
executables: []
|
37
|
+
|
38
|
+
extensions: []
|
39
|
+
|
40
|
+
extra_rdoc_files:
|
41
|
+
- README.rdoc
|
42
|
+
files:
|
43
|
+
- bin/teach
|
44
|
+
- bin/tsd
|
45
|
+
- bin/turn_off
|
46
|
+
- bin/turn_on
|
47
|
+
- doc/classes/Tellstick/Tellstick.html
|
48
|
+
- doc/classes/Tellstick/TellstickIO.html
|
49
|
+
- doc/classes/Tellstick/TellstickIO.src/M000020.html
|
50
|
+
- doc/classes/Tellstick/TellstickIO.src/M000021.html
|
51
|
+
- doc/classes/Tellstick/TellstickIO.src/M000022.html
|
52
|
+
- doc/classes/Tellstick/TellstickIO.src/M000023.html
|
53
|
+
- doc/classes/Tellstick/TellstickIO.src/M000024.html
|
54
|
+
- doc/classes/Tellstick/TellstickIO.src/M000025.html
|
55
|
+
- doc/classes/Tellstick/TellstickIO.src/M000026.html
|
56
|
+
- doc/classes/Tellstick/TellstickIO.src/M000027.html
|
57
|
+
- doc/classes/Tellstick.html
|
58
|
+
- doc/classes/Tellstick.src/M000019.html
|
59
|
+
- doc/classes/TriggerSwitchD/Action.html
|
60
|
+
- doc/classes/TriggerSwitchD/Action.src/M000015.html
|
61
|
+
- doc/classes/TriggerSwitchD/Action.src/M000016.html
|
62
|
+
- doc/classes/TriggerSwitchD/Application.html
|
63
|
+
- doc/classes/TriggerSwitchD/Application.src/M000017.html
|
64
|
+
- doc/classes/TriggerSwitchD/Application.src/M000018.html
|
65
|
+
- doc/classes/TriggerSwitchD/ConfigFactory/Config.html
|
66
|
+
- doc/classes/TriggerSwitchD/ConfigFactory/Config.src/M000014.html
|
67
|
+
- doc/classes/TriggerSwitchD/ConfigFactory.html
|
68
|
+
- doc/classes/TriggerSwitchD/ConfigFactory.src/M000013.html
|
69
|
+
- doc/classes/TriggerSwitchD/IPC.html
|
70
|
+
- doc/classes/TriggerSwitchD/IPC.src/M000012.html
|
71
|
+
- doc/classes/TriggerSwitchD/Schedule/InstanceMethods.html
|
72
|
+
- doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000005.html
|
73
|
+
- doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000006.html
|
74
|
+
- doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000007.html
|
75
|
+
- doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000008.html
|
76
|
+
- doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000009.html
|
77
|
+
- doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000010.html
|
78
|
+
- doc/classes/TriggerSwitchD/Schedule/InstanceMethods.src/M000011.html
|
79
|
+
- doc/classes/TriggerSwitchD/Schedule.html
|
80
|
+
- doc/classes/TriggerSwitchD/Schedule.src/M000004.html
|
81
|
+
- doc/classes/TriggerSwitchD/SwitchFactory.html
|
82
|
+
- doc/classes/TriggerSwitchD/SwitchFactory.src/M000003.html
|
83
|
+
- doc/classes/TriggerSwitchD.html
|
84
|
+
- doc/classes/TriggerSwitchD.src/M000001.html
|
85
|
+
- doc/classes/TriggerSwitchD.src/M000002.html
|
86
|
+
- doc/created.rid
|
87
|
+
- doc/files/lib/tellstick/protocol/nexa_rb.html
|
88
|
+
- doc/files/lib/tellstick/protocol/not_connected_rb.html
|
89
|
+
- doc/files/lib/tellstick/protocol/null_protocol_rb.html
|
90
|
+
- doc/files/lib/tellstick/protocol/plain_text_rb.html
|
91
|
+
- doc/files/lib/tellstick/protocol/proove_rb.html
|
92
|
+
- doc/files/lib/tellstick/protocol/protocol_loader_rb.html
|
93
|
+
- doc/files/lib/tellstick/protocol/rising_sun_rb.html
|
94
|
+
- doc/files/lib/tellstick/protocol/waveman_rb.html
|
95
|
+
- doc/files/lib/tellstick/tellstick_io_rb.html
|
96
|
+
- doc/files/lib/tellstick/tellstick_rb.html
|
97
|
+
- doc/files/lib/tellstick_rb.html
|
98
|
+
- doc/files/lib/trigger_switch_d/action_rb.html
|
99
|
+
- doc/files/lib/trigger_switch_d/application_rb.html
|
100
|
+
- doc/files/lib/trigger_switch_d/config_rb.html
|
101
|
+
- doc/files/lib/trigger_switch_d/daylight_rb.html
|
102
|
+
- doc/files/lib/trigger_switch_d/ipc_rb.html
|
103
|
+
- doc/files/lib/trigger_switch_d/schedule_rb.html
|
104
|
+
- doc/files/lib/trigger_switch_d/switch_rb.html
|
105
|
+
- doc/files/lib/trigger_switch_d/trigger_switch_d_helper_rb.html
|
106
|
+
- doc/files/lib/trigger_switch_d_rb.html
|
107
|
+
- doc/fr_class_index.html
|
108
|
+
- doc/fr_file_index.html
|
109
|
+
- doc/fr_method_index.html
|
110
|
+
- doc/index.html
|
111
|
+
- lib/tellstick/protocol/nexa.rb
|
112
|
+
- lib/tellstick/protocol/not_connected.rb
|
113
|
+
- lib/tellstick/protocol/null_protocol.rb
|
114
|
+
- lib/tellstick/protocol/plain_text.rb
|
115
|
+
- lib/tellstick/protocol/proove.rb
|
116
|
+
- lib/tellstick/protocol/protocol_loader.rb
|
117
|
+
- lib/tellstick/protocol/rising_sun.rb
|
118
|
+
- lib/tellstick/protocol/waveman.rb
|
119
|
+
- lib/tellstick/tellstick.rb
|
120
|
+
- lib/tellstick/tellstick_io.rb
|
121
|
+
- lib/tellstick.rb
|
122
|
+
- lib/trigger_switch_d/action.rb
|
123
|
+
- lib/trigger_switch_d/application.rb
|
124
|
+
- lib/trigger_switch_d/config.rb
|
125
|
+
- lib/trigger_switch_d/daylight.rb
|
126
|
+
- lib/trigger_switch_d/ipc.rb
|
127
|
+
- lib/trigger_switch_d/schedule.rb
|
128
|
+
- lib/trigger_switch_d/switch.rb
|
129
|
+
- lib/trigger_switch_d/trigger_switch_d_helper.rb
|
130
|
+
- lib/trigger_switch_d.rb
|
131
|
+
- spec/spec_helper.rb
|
132
|
+
- spec/tellstick/protocol/nexa_spec.rb
|
133
|
+
- spec/tellstick/protocol/proove_spec.rb
|
134
|
+
- spec/tellstick/protocol/rising_sun_spec.rb
|
135
|
+
- spec/tellstick/protocol/waveman_spec.rb
|
136
|
+
- spec/tellstick/tellstick_io_spec.rb
|
137
|
+
- spec/tellstick/tellstick_spec.rb
|
138
|
+
- spec/trigger_switch_d/application_spec.rb
|
139
|
+
- spec/trigger_switch_d/config_spec.rb
|
140
|
+
- spec/trigger_switch_d/daylight_spec.rb
|
141
|
+
- spec/trigger_switch_d/ipc_spec.rb
|
142
|
+
- spec/trigger_switch_d/schedule_spec.rb
|
143
|
+
- spec/trigger_switch_d/trigger_switch_d_spec_helpers.rb
|
144
|
+
- features/execute_schedule.feature
|
145
|
+
- features/group_aliases.feature
|
146
|
+
- features/handle_switches.feature
|
147
|
+
- features/listen_for_client_call.feature
|
148
|
+
- features/persistent_schedule.feature
|
149
|
+
- features/proove_protocol.feature
|
150
|
+
- features/schedule.feature
|
151
|
+
- features/simple_string_protocol.feature
|
152
|
+
- features/step_definitions/execute_schedule_steps.rb
|
153
|
+
- features/step_definitions/group_aliases_steps.rb
|
154
|
+
- features/step_definitions/handle_switches_steps.rb
|
155
|
+
- features/step_definitions/listen_for_client_call_steps.rb
|
156
|
+
- features/step_definitions/persistent_schedule_steps.rb
|
157
|
+
- features/step_definitions/proove_protocol_steps.rb
|
158
|
+
- features/step_definitions/schedule_steps.rb
|
159
|
+
- features/step_definitions/shared_steps.rb
|
160
|
+
- features/step_definitions/simple_string_protocol_steps.rb
|
161
|
+
- features/step_definitions/sunrise_steps.rb
|
162
|
+
- features/step_definitions/tellstick_connected_steps.rb
|
163
|
+
- features/sunrise.feature
|
164
|
+
- features/sunset.feature
|
165
|
+
- features/support/action_helpers.rb
|
166
|
+
- features/support/env.rb
|
167
|
+
- features/support/listen_for_client_call_helper.rb
|
168
|
+
- features/support/proove_helpers.rb
|
169
|
+
- features/support/sunrise_helper.rb
|
170
|
+
- features/tellstick_connected.feature
|
171
|
+
- LICENSE.txt
|
172
|
+
- COPYING.txt
|
173
|
+
- trigger_switch_d.gemspec
|
174
|
+
- README.rdoc
|
175
|
+
has_rdoc: true
|
176
|
+
homepage: http://www.adhocskill.com/
|
177
|
+
licenses: []
|
178
|
+
|
179
|
+
post_install_message:
|
180
|
+
rdoc_options: []
|
181
|
+
|
182
|
+
require_paths:
|
183
|
+
- lib
|
184
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
185
|
+
requirements:
|
186
|
+
- - ">="
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
segments:
|
189
|
+
- 0
|
190
|
+
version: "0"
|
191
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
|
+
requirements:
|
193
|
+
- - ">="
|
194
|
+
- !ruby/object:Gem::Version
|
195
|
+
segments:
|
196
|
+
- 0
|
197
|
+
version: "0"
|
198
|
+
requirements: []
|
199
|
+
|
200
|
+
rubyforge_project:
|
201
|
+
rubygems_version: 1.3.6
|
202
|
+
signing_key:
|
203
|
+
specification_version: 3
|
204
|
+
summary: Daemon to execute schedule for remote devices
|
205
|
+
test_files: []
|
206
|
+
|