ladder_drive 0.6.4 → 0.6.8
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.
- checksums.yaml +5 -5
- data/Gemfile +1 -1
- data/Gemfile.lock +95 -62
- data/README.md +1 -0
- data/README_jp.md +2 -2
- data/ladder_drive.gemspec +12 -9
- data/lib/ladder_drive/cli.rb +16 -4
- data/lib/ladder_drive/config.rb +3 -1
- data/lib/ladder_drive/protocol/keyence/kv_device.rb +1 -1
- data/lib/ladder_drive/protocol/keyence/kv_protocol.rb +1 -1
- data/lib/ladder_drive/protocol/mitsubishi/fx_protocol.rb +0 -1
- data/lib/ladder_drive/protocol/mitsubishi/mc_protocol.rb +1 -1
- data/lib/ladder_drive/protocol/omron/fins_tcp_protocol.rb +3 -1
- data/lib/ladder_drive/protocol/protocol.rb +2 -0
- data/lib/ladder_drive/version.rb +1 -1
- data/lib/ladder_drive.rb +3 -0
- data/lib/plc/emulator/emu_plc_server.rb +3 -1
- data/lib/plc/emulator/plc_plugins.rb +20 -13
- data/lib/plc/emulator/plugin_trigger_state.rb +152 -0
- data/plugins/ambient_plugin.rb +1 -33
- data/plugins/config/ambient.yaml.example +34 -0
- data/plugins/config/google_drive.yaml.example +39 -0
- data/plugins/config/ifttt.yaml.example +24 -0
- data/plugins/config/plc_mapper.yaml.example +36 -0
- data/plugins/config/slack.yaml.example +36 -0
- data/plugins/config/trello.yaml.example +41 -0
- data/plugins/ifttt_plugin.rb +4 -27
- data/plugins/slack_plugin.rb +14 -3
- data/plugins/trello_plugin.rb +25 -42
- metadata +66 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fadb0c39709c720b91a91ed6b977a7583abd7dc6962dc4805a700c8dfef0c0b4
|
4
|
+
data.tar.gz: cee86c1d967c1198bd3bedeb215b7ace6f417e6757e84f65d92e6950851bb31e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bfd5997a940904d6aa25b87e6bfa5765cb408cea83c840a04da5ddd426eb8d793863e205a0b2681d504d2122a84496d35db46a0f41f333494c1ee7b7391fba7
|
7
|
+
data.tar.gz: abbfb718c68c7088e97cc33a35b91e929e1b33ac243e3b65b144d7402192f9b61434eb94e58d6dc1413c4def5e522a218c80a7583c81814be1ddee5da91f5b6d
|
data/Gemfile
CHANGED
@@ -6,7 +6,6 @@ gemspec
|
|
6
6
|
group :test do
|
7
7
|
gem "test-unit"
|
8
8
|
gem "test-unit-rr"
|
9
|
-
#gem "test-unit-notify"
|
10
9
|
end
|
11
10
|
|
12
11
|
gem "activesupport", '>= 4.0'
|
@@ -18,3 +17,4 @@ gem 'serialport'
|
|
18
17
|
gem 'google_drive'
|
19
18
|
gem "ruby-trello"
|
20
19
|
gem 'ambient_iot', ">= 0.1.1"
|
20
|
+
gem 'dotenv'
|
data/Gemfile.lock
CHANGED
@@ -1,135 +1,168 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ladder_drive (0.6.
|
5
|
-
activesupport (~>
|
6
|
-
|
7
|
-
|
4
|
+
ladder_drive (0.6.7)
|
5
|
+
activesupport (~> 6.0)
|
6
|
+
ambient_iot (~> 0.1, >= 0.1.1)
|
7
|
+
dotenv (~> 2.1)
|
8
|
+
ffi (~> 1.9, >= 1.9.24)
|
9
|
+
google_drive (~> 3.0, >= 3.0.3)
|
8
10
|
pi_piper (~> 2.0, >= 2.0.0)
|
9
11
|
ruby-trello (~> 2.1)
|
10
|
-
serialport
|
12
|
+
serialport (~> 1.3, >= 1.3.1)
|
11
13
|
thor (~> 0)
|
12
14
|
|
13
15
|
GEM
|
14
16
|
remote: https://rubygems.org/
|
15
17
|
specs:
|
16
|
-
activemodel (
|
17
|
-
activesupport (=
|
18
|
-
activesupport (
|
18
|
+
activemodel (6.1.4.1)
|
19
|
+
activesupport (= 6.1.4.1)
|
20
|
+
activesupport (6.1.4.1)
|
19
21
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
20
|
-
i18n (>=
|
21
|
-
minitest (
|
22
|
-
tzinfo (~>
|
23
|
-
|
24
|
-
|
22
|
+
i18n (>= 1.6, < 2)
|
23
|
+
minitest (>= 5.1)
|
24
|
+
tzinfo (~> 2.0)
|
25
|
+
zeitwerk (~> 2.3)
|
26
|
+
addressable (2.8.0)
|
27
|
+
public_suffix (>= 2.0.2, < 5.0)
|
25
28
|
ambient_iot (0.1.1)
|
26
|
-
concurrent-ruby (1.1.
|
27
|
-
declarative (0.0.
|
28
|
-
declarative-option (0.1.0)
|
29
|
+
concurrent-ruby (1.1.9)
|
30
|
+
declarative (0.0.20)
|
29
31
|
domain_name (0.5.20190701)
|
30
32
|
unf (>= 0.0.5, < 1.0.0)
|
33
|
+
dotenv (2.7.6)
|
31
34
|
eventmachine (1.0.9)
|
32
|
-
faraday (
|
35
|
+
faraday (1.7.0)
|
36
|
+
faraday-em_http (~> 1.0)
|
37
|
+
faraday-em_synchrony (~> 1.0)
|
38
|
+
faraday-excon (~> 1.1)
|
39
|
+
faraday-httpclient (~> 1.0.1)
|
40
|
+
faraday-net_http (~> 1.0)
|
41
|
+
faraday-net_http_persistent (~> 1.1)
|
42
|
+
faraday-patron (~> 1.0)
|
43
|
+
faraday-rack (~> 1.0)
|
33
44
|
multipart-post (>= 1.2, < 3)
|
45
|
+
ruby2_keywords (>= 0.0.4)
|
46
|
+
faraday-em_http (1.0.0)
|
47
|
+
faraday-em_synchrony (1.0.0)
|
48
|
+
faraday-excon (1.1.0)
|
49
|
+
faraday-httpclient (1.0.1)
|
50
|
+
faraday-net_http (1.0.1)
|
51
|
+
faraday-net_http_persistent (1.2.0)
|
52
|
+
faraday-patron (1.0.0)
|
53
|
+
faraday-rack (1.0.0)
|
34
54
|
ffi (1.9.25)
|
35
|
-
google-
|
55
|
+
google-apis-core (0.4.1)
|
36
56
|
addressable (~> 2.5, >= 2.5.1)
|
37
|
-
googleauth (>= 0.
|
38
|
-
httpclient (>= 2.8.1, < 3.
|
57
|
+
googleauth (>= 0.16.2, < 2.a)
|
58
|
+
httpclient (>= 2.8.1, < 3.a)
|
39
59
|
mini_mime (~> 1.0)
|
40
60
|
representable (~> 3.0)
|
41
|
-
retriable (>= 2.0, < 4.
|
42
|
-
|
43
|
-
|
44
|
-
|
61
|
+
retriable (>= 2.0, < 4.a)
|
62
|
+
rexml
|
63
|
+
webrick
|
64
|
+
google-apis-drive_v3 (0.13.0)
|
65
|
+
google-apis-core (>= 0.4, < 2.a)
|
66
|
+
google-apis-sheets_v4 (0.9.0)
|
67
|
+
google-apis-core (>= 0.4, < 2.a)
|
68
|
+
google_drive (3.0.7)
|
69
|
+
google-apis-drive_v3 (>= 0.5.0, < 1.0.0)
|
70
|
+
google-apis-sheets_v4 (>= 0.4.0, < 1.0.0)
|
45
71
|
googleauth (>= 0.5.0, < 1.0.0)
|
46
72
|
nokogiri (>= 1.5.3, < 2.0.0)
|
47
|
-
googleauth (0.
|
48
|
-
faraday (
|
73
|
+
googleauth (0.17.0)
|
74
|
+
faraday (>= 0.17.3, < 2.0)
|
49
75
|
jwt (>= 1.4, < 3.0)
|
50
76
|
memoist (~> 0.16)
|
51
77
|
multi_json (~> 1.11)
|
52
78
|
os (>= 0.9, < 2.0)
|
53
|
-
signet (~> 0.
|
54
|
-
http-
|
79
|
+
signet (~> 0.14)
|
80
|
+
http-accept (1.7.0)
|
81
|
+
http-cookie (1.0.4)
|
55
82
|
domain_name (~> 0.5)
|
56
83
|
httpclient (2.8.3)
|
57
|
-
i18n (1.
|
84
|
+
i18n (1.8.10)
|
58
85
|
concurrent-ruby (~> 1.0)
|
59
|
-
json (2.
|
60
|
-
jwt (2.2.
|
61
|
-
memoist (0.16.
|
62
|
-
mime-types (3.
|
86
|
+
json (2.5.1)
|
87
|
+
jwt (2.2.3)
|
88
|
+
memoist (0.16.2)
|
89
|
+
mime-types (3.3.1)
|
63
90
|
mime-types-data (~> 3.2015)
|
64
|
-
mime-types-data (3.
|
65
|
-
mini_mime (1.
|
66
|
-
|
67
|
-
|
68
|
-
multi_json (1.13.1)
|
91
|
+
mime-types-data (3.2021.0704)
|
92
|
+
mini_mime (1.1.1)
|
93
|
+
minitest (5.14.4)
|
94
|
+
multi_json (1.15.0)
|
69
95
|
multipart-post (2.1.1)
|
70
96
|
netrc (0.11.0)
|
71
|
-
nokogiri (1.
|
72
|
-
|
73
|
-
oauth (0.5.
|
74
|
-
os (1.
|
97
|
+
nokogiri (1.12.4-x86_64-darwin)
|
98
|
+
racc (~> 1.4)
|
99
|
+
oauth (0.5.6)
|
100
|
+
os (1.1.1)
|
75
101
|
pi_piper (2.0.0)
|
76
102
|
eventmachine (= 1.0.9)
|
77
103
|
ffi
|
78
|
-
power_assert (
|
79
|
-
public_suffix (
|
80
|
-
|
81
|
-
|
104
|
+
power_assert (2.0.1)
|
105
|
+
public_suffix (4.0.6)
|
106
|
+
racc (1.5.2)
|
107
|
+
rake (13.0.6)
|
108
|
+
representable (3.1.1)
|
82
109
|
declarative (< 0.1.0)
|
83
|
-
|
110
|
+
trailblazer-option (>= 0.1.1, < 0.2.0)
|
84
111
|
uber (< 0.2.0)
|
85
|
-
rest-client (2.0
|
112
|
+
rest-client (2.1.0)
|
113
|
+
http-accept (>= 1.7.0, < 2.0)
|
86
114
|
http-cookie (>= 1.0.2, < 2.0)
|
87
115
|
mime-types (>= 1.16, < 4.0)
|
88
116
|
netrc (~> 0.8)
|
89
117
|
retriable (3.1.2)
|
90
|
-
|
91
|
-
|
118
|
+
rexml (3.2.5)
|
119
|
+
rr (3.0.7)
|
120
|
+
ruby-trello (2.3.1)
|
92
121
|
activemodel (>= 3.2.0)
|
93
122
|
addressable (~> 2.3)
|
94
|
-
json
|
123
|
+
json (>= 2.3.0)
|
95
124
|
oauth (>= 0.4.5)
|
96
125
|
rest-client (>= 1.8.0)
|
126
|
+
ruby2_keywords (0.0.5)
|
97
127
|
serialport (1.3.1)
|
98
|
-
signet (0.
|
128
|
+
signet (0.15.0)
|
99
129
|
addressable (~> 2.3)
|
100
|
-
faraday (
|
130
|
+
faraday (>= 0.17.3, < 2.0)
|
101
131
|
jwt (>= 1.5, < 3.0)
|
102
132
|
multi_json (~> 1.10)
|
103
|
-
test-unit (3.
|
133
|
+
test-unit (3.4.4)
|
104
134
|
power_assert
|
105
135
|
test-unit-rr (1.0.5)
|
106
136
|
rr (>= 1.1.1)
|
107
137
|
test-unit (>= 2.5.2)
|
108
138
|
thor (0.20.3)
|
109
|
-
|
110
|
-
tzinfo (
|
111
|
-
|
139
|
+
trailblazer-option (0.1.1)
|
140
|
+
tzinfo (2.0.4)
|
141
|
+
concurrent-ruby (~> 1.0)
|
112
142
|
uber (0.1.0)
|
113
143
|
unf (0.1.4)
|
114
144
|
unf_ext
|
115
|
-
unf_ext (0.0.7.
|
145
|
+
unf_ext (0.0.7.7)
|
146
|
+
webrick (1.7.0)
|
147
|
+
zeitwerk (2.4.2)
|
116
148
|
|
117
149
|
PLATFORMS
|
118
|
-
|
150
|
+
x86_64-darwin-19
|
119
151
|
|
120
152
|
DEPENDENCIES
|
121
153
|
activesupport (>= 4.0)
|
122
154
|
ambient_iot (>= 0.1.1)
|
123
|
-
bundler (~> 1
|
155
|
+
bundler (~> 2.1)
|
156
|
+
dotenv
|
124
157
|
ffi (~> 1.9.24)
|
125
158
|
google_drive
|
126
159
|
ladder_drive!
|
127
160
|
pi_piper (>= 2.0.0)
|
128
|
-
rake (~>
|
161
|
+
rake (~> 13.0)
|
129
162
|
ruby-trello
|
130
163
|
serialport
|
131
164
|
test-unit
|
132
165
|
test-unit-rr
|
133
166
|
|
134
167
|
BUNDLED WITH
|
135
|
-
|
168
|
+
2.2.26
|
data/README.md
CHANGED
data/README_jp.md
CHANGED
@@ -36,8 +36,7 @@ $ cd my_project
|
|
36
36
|
|
37
37
|
ファイルの構成は下の様になっています。
|
38
38
|
plc以下にLadderDriveを実行するPLCプロジェクトの雛形があります。
|
39
|
-
現在はエミュレーターと三菱電機のiQ-RシリーズR08CPUのみの対応となっています。
|
40
|
-
他メーカーや他の機種は今後追加する予定です。
|
39
|
+
現在はエミュレーターと三菱電機のiQ-RシリーズR08CPU、キーエンスKV-5000のみの対応となっています。
|
41
40
|
|
42
41
|
|
43
42
|
```
|
@@ -310,6 +309,7 @@ Ladder DriveをIoT Gateway として機能させるプラグインになりま
|
|
310
309
|
|plc_mapper|複数のPLCのデータをLadder Driveのメモリーに展開します。|
|
311
310
|
|slack|Slackにデータの変化を記録します。|
|
312
311
|
|trello|trelloのカードを指定のリストに移動します。|
|
312
|
+
|ambient|Ambientにデータの変化を記録します。|
|
313
313
|
|
314
314
|
これらの用意されているプラグインをインストールするには
|
315
315
|
|
data/ladder_drive.gemspec
CHANGED
@@ -14,13 +14,16 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.homepage = "https://github.com/ito-soft-design/ladder_drive"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
|
-
spec.add_runtime_dependency 'thor',
|
18
|
-
spec.add_runtime_dependency 'activesupport',
|
19
|
-
spec.add_runtime_dependency 'ffi',
|
20
|
-
spec.add_runtime_dependency 'pi_piper',
|
21
|
-
|
22
|
-
spec.add_runtime_dependency '
|
23
|
-
spec.add_runtime_dependency '
|
17
|
+
spec.add_runtime_dependency 'thor', '~> 0'
|
18
|
+
spec.add_runtime_dependency 'activesupport', '~> 6.0'
|
19
|
+
spec.add_runtime_dependency 'ffi', '~> 1.9', '>= 1.9.24'
|
20
|
+
spec.add_runtime_dependency 'pi_piper', '~> 2.0', '>= 2.0.0'
|
21
|
+
|
22
|
+
spec.add_runtime_dependency 'serialport', '~> 1.3', '>= 1.3.1'
|
23
|
+
spec.add_runtime_dependency 'ambient_iot', '~> 0.1', '>= 0.1.1'
|
24
|
+
spec.add_runtime_dependency 'google_drive', '~> 3.0', '>= 3.0.3'
|
25
|
+
spec.add_runtime_dependency 'ruby-trello', '~>2.1'
|
26
|
+
spec.add_runtime_dependency 'dotenv', '~>2.1'
|
24
27
|
|
25
28
|
spec.required_ruby_version = '>= 2.3.3'
|
26
29
|
|
@@ -29,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
29
32
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
33
|
spec.require_paths = ["lib"]
|
31
34
|
|
32
|
-
spec.add_development_dependency "bundler", "~> 1
|
33
|
-
spec.add_development_dependency "rake", "~>
|
35
|
+
spec.add_development_dependency "bundler", "~> 2.1"
|
36
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
34
37
|
|
35
38
|
end
|
data/lib/ladder_drive/cli.rb
CHANGED
@@ -54,11 +54,23 @@ module LadderDrive
|
|
54
54
|
desc "plugin", "Install the specified plugin."
|
55
55
|
def plugin(name)
|
56
56
|
root_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", ".."))
|
57
|
-
|
58
|
-
|
59
|
-
|
57
|
+
|
58
|
+
# copy plugin
|
59
|
+
plugins_dir = File.join(root_dir, "plugins")
|
60
|
+
plugin_path = File.join(plugins_dir, "#{name}_plugin.rb")
|
61
|
+
if File.exist? plugin_path
|
60
62
|
mkdir_p "plugins"
|
61
|
-
cp
|
63
|
+
cp plugin_path, "plugins/#{name}_plugin.rb"
|
64
|
+
end
|
65
|
+
|
66
|
+
# copy sample settings
|
67
|
+
config_dir = File.join(plugins_dir, "config")
|
68
|
+
config_path = File.join(config_dir, "#{name}.yaml.example")
|
69
|
+
if File.exist? config_path
|
70
|
+
dst_dir = "config/plugins"
|
71
|
+
mkdir_p dst_dir
|
72
|
+
dst_path = "config/plugins/#{name}.yaml.example"
|
73
|
+
cp config_path, dst_path unless File.exist? dst_path
|
62
74
|
end
|
63
75
|
end
|
64
76
|
|
data/lib/ladder_drive/config.rb
CHANGED
@@ -25,6 +25,7 @@ require 'active_support/core_ext/string/inflections'
|
|
25
25
|
require 'yaml'
|
26
26
|
require 'json'
|
27
27
|
require 'protocol/protocol'
|
28
|
+
require 'erb'
|
28
29
|
|
29
30
|
include LadderDrive::Protocol::Mitsubishi
|
30
31
|
include LadderDrive::Protocol::Keyence
|
@@ -46,7 +47,8 @@ module LadderDrive
|
|
46
47
|
def load path
|
47
48
|
h = {}
|
48
49
|
if File.exist?(path)
|
49
|
-
|
50
|
+
erb = ERB.new File.read(path)
|
51
|
+
h = YAML.load(erb.result(binding))
|
50
52
|
h = JSON.parse(h.to_json, symbolize_names: true)
|
51
53
|
end
|
52
54
|
new h || {}
|
@@ -49,7 +49,7 @@ module Keyence
|
|
49
49
|
|
50
50
|
def suffixes_for_dec; SUFFIXES_FOR_DEC; end
|
51
51
|
def suffixes_for_dec_hex; SUFFIXES_FOR_DEC_HEX; end
|
52
|
-
def
|
52
|
+
def suffixes_for_hex; SUFFIXES_FOR_HEX; end
|
53
53
|
def suffixes_for_bit; SUFFIXES_FOR_BIT; end
|
54
54
|
|
55
55
|
end
|
@@ -48,6 +48,8 @@ module Omron
|
|
48
48
|
ETHERNET_CP1L = 2
|
49
49
|
ETHERNET_CP1H = 3
|
50
50
|
|
51
|
+
TIMEOUT = 5.0
|
52
|
+
|
51
53
|
def initialize options={}
|
52
54
|
super
|
53
55
|
@socket = nil
|
@@ -201,7 +203,7 @@ p e
|
|
201
203
|
res = []
|
202
204
|
len = 0
|
203
205
|
begin
|
204
|
-
Timeout.timeout(
|
206
|
+
Timeout.timeout(TIMEOUT) do
|
205
207
|
loop do
|
206
208
|
c = @socket.getc
|
207
209
|
next if c.nil? || c == ""
|
data/lib/ladder_drive/version.rb
CHANGED