ladder_drive 0.6.3 → 0.6.7
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 +7 -2
- data/Gemfile.lock +107 -62
- data/README.md +1 -0
- data/README_jp.md +2 -2
- data/ladder_drive.gemspec +12 -8
- data/lib/ladder_drive/cli.rb +16 -4
- data/lib/ladder_drive/config.rb +4 -1
- data/lib/ladder_drive/config_target.rb +1 -0
- data/lib/ladder_drive/plc_device.rb +11 -0
- data/lib/ladder_drive/protocol/keyence/kv_protocol.rb +1 -11
- data/lib/ladder_drive/protocol/mitsubishi/fx_protocol.rb +0 -11
- data/lib/ladder_drive/protocol/mitsubishi/mc_protocol.rb +1 -11
- data/lib/ladder_drive/protocol/omron/c_mode_protocol.rb +224 -0
- data/lib/ladder_drive/protocol/omron/fins_tcp_protocol.rb +380 -0
- data/lib/ladder_drive/protocol/omron/omron.rb +28 -0
- data/lib/ladder_drive/protocol/omron/omron_device.rb +139 -0
- data/lib/ladder_drive/protocol/protocol.rb +16 -5
- data/lib/ladder_drive/tasks/build.rb +1 -1
- 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 +155 -0
- 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/plc_mapper_plugin.rb +27 -15
- data/plugins/slack_plugin.rb +14 -3
- data/plugins/trello_plugin.rb +30 -42
- metadata +72 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4b46aba6a1c2e5ec981226750e08bd8bf08bc30e8a26f6a225f2dcfd921e0262
|
4
|
+
data.tar.gz: 49c7ea2044feb923c3c2f905e20a653ec313195b04de2368ed1fca629cd800db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7c62e3002101eccb744165505c4b86cda09e0584bafd47dea8d85c94a50c6f0f02f5e5ac8b40fbfad648b9b1073be578e9b6003262f8a76395544083d7364a5
|
7
|
+
data.tar.gz: ff89eac27a06e14e4fd1150a206a2602e9d70d0e73f279cbdad539a9f6b991122e3531e89cdc1c6fbed8782fa0c1faf272516ca2bc4234a793e1bdc014df578a
|
data/Gemfile
CHANGED
@@ -3,9 +3,12 @@ source 'https://rubygems.org'
|
|
3
3
|
# Specify your gem's dependencies in ladder_drive.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
|
6
|
+
group :test do
|
7
|
+
gem "test-unit"
|
8
|
+
gem "test-unit-rr"
|
9
|
+
end
|
7
10
|
|
8
|
-
gem "activesupport", '
|
11
|
+
gem "activesupport", '>= 4.0'
|
9
12
|
|
10
13
|
gem 'pi_piper', ">= 2.0.0"
|
11
14
|
gem "ffi", "~> 1.9.24"
|
@@ -13,3 +16,5 @@ gem "ffi", "~> 1.9.24"
|
|
13
16
|
gem 'serialport'
|
14
17
|
gem 'google_drive'
|
15
18
|
gem "ruby-trello"
|
19
|
+
gem 'ambient_iot', ">= 0.1.1"
|
20
|
+
gem 'dotenv'
|
data/Gemfile.lock
CHANGED
@@ -1,125 +1,170 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ladder_drive (0.6.
|
5
|
-
activesupport (~>
|
6
|
-
|
4
|
+
ladder_drive (0.6.6)
|
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)
|
7
10
|
pi_piper (~> 2.0, >= 2.0.0)
|
8
|
-
|
11
|
+
ruby-trello (~> 2.1)
|
12
|
+
serialport (~> 1.3, >= 1.3.1)
|
9
13
|
thor (~> 0)
|
10
14
|
|
11
15
|
GEM
|
12
16
|
remote: https://rubygems.org/
|
13
17
|
specs:
|
14
|
-
activemodel (
|
15
|
-
activesupport (=
|
16
|
-
activesupport (
|
18
|
+
activemodel (6.1.4.1)
|
19
|
+
activesupport (= 6.1.4.1)
|
20
|
+
activesupport (6.1.4.1)
|
17
21
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
|
-
i18n (>=
|
19
|
-
minitest (
|
20
|
-
tzinfo (~>
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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)
|
28
|
+
ambient_iot (0.1.1)
|
29
|
+
concurrent-ruby (1.1.9)
|
30
|
+
declarative (0.0.20)
|
31
|
+
domain_name (0.5.20190701)
|
27
32
|
unf (>= 0.0.5, < 1.0.0)
|
33
|
+
dotenv (2.7.6)
|
28
34
|
eventmachine (1.0.9)
|
29
|
-
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)
|
30
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)
|
31
54
|
ffi (1.9.25)
|
32
|
-
google-
|
55
|
+
google-apis-core (0.4.1)
|
33
56
|
addressable (~> 2.5, >= 2.5.1)
|
34
|
-
googleauth (>= 0.
|
35
|
-
httpclient (>= 2.8.1, < 3.
|
36
|
-
|
57
|
+
googleauth (>= 0.16.2, < 2.a)
|
58
|
+
httpclient (>= 2.8.1, < 3.a)
|
59
|
+
mini_mime (~> 1.0)
|
37
60
|
representable (~> 3.0)
|
38
|
-
retriable (>= 2.0, < 4.
|
39
|
-
|
40
|
-
|
41
|
-
|
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)
|
42
71
|
googleauth (>= 0.5.0, < 1.0.0)
|
43
72
|
nokogiri (>= 1.5.3, < 2.0.0)
|
44
|
-
googleauth (0.
|
45
|
-
faraday (
|
73
|
+
googleauth (0.17.0)
|
74
|
+
faraday (>= 0.17.3, < 2.0)
|
46
75
|
jwt (>= 1.4, < 3.0)
|
47
76
|
memoist (~> 0.16)
|
48
77
|
multi_json (~> 1.11)
|
49
78
|
os (>= 0.9, < 2.0)
|
50
|
-
signet (~> 0.
|
51
|
-
http-
|
79
|
+
signet (~> 0.14)
|
80
|
+
http-accept (1.7.0)
|
81
|
+
http-cookie (1.0.4)
|
52
82
|
domain_name (~> 0.5)
|
53
83
|
httpclient (2.8.3)
|
54
|
-
i18n (1.
|
84
|
+
i18n (1.8.10)
|
55
85
|
concurrent-ruby (~> 1.0)
|
56
|
-
json (2.
|
57
|
-
jwt (2.
|
58
|
-
memoist (0.16.
|
59
|
-
mime-types (3.
|
86
|
+
json (2.5.1)
|
87
|
+
jwt (2.2.3)
|
88
|
+
memoist (0.16.2)
|
89
|
+
mime-types (3.3.1)
|
60
90
|
mime-types-data (~> 3.2015)
|
61
|
-
mime-types-data (3.
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
91
|
+
mime-types-data (3.2021.0704)
|
92
|
+
mini_mime (1.1.1)
|
93
|
+
mini_portile2 (2.6.1)
|
94
|
+
minitest (5.14.4)
|
95
|
+
multi_json (1.15.0)
|
96
|
+
multipart-post (2.1.1)
|
66
97
|
netrc (0.11.0)
|
67
|
-
nokogiri (1.
|
68
|
-
mini_portile2 (~> 2.
|
69
|
-
|
70
|
-
|
98
|
+
nokogiri (1.12.3)
|
99
|
+
mini_portile2 (~> 2.6.1)
|
100
|
+
racc (~> 1.4)
|
101
|
+
oauth (0.5.6)
|
102
|
+
os (1.1.1)
|
71
103
|
pi_piper (2.0.0)
|
72
104
|
eventmachine (= 1.0.9)
|
73
105
|
ffi
|
74
|
-
power_assert (
|
75
|
-
public_suffix (
|
106
|
+
power_assert (2.0.0)
|
107
|
+
public_suffix (4.0.6)
|
108
|
+
racc (1.5.2)
|
76
109
|
rake (10.5.0)
|
77
|
-
representable (3.
|
110
|
+
representable (3.1.1)
|
78
111
|
declarative (< 0.1.0)
|
79
|
-
|
112
|
+
trailblazer-option (>= 0.1.1, < 0.2.0)
|
80
113
|
uber (< 0.2.0)
|
81
|
-
rest-client (2.0
|
114
|
+
rest-client (2.1.0)
|
115
|
+
http-accept (>= 1.7.0, < 2.0)
|
82
116
|
http-cookie (>= 1.0.2, < 2.0)
|
83
117
|
mime-types (>= 1.16, < 4.0)
|
84
118
|
netrc (~> 0.8)
|
85
119
|
retriable (3.1.2)
|
86
|
-
|
120
|
+
rexml (3.2.5)
|
121
|
+
rr (3.0.7)
|
122
|
+
ruby-trello (2.3.1)
|
87
123
|
activemodel (>= 3.2.0)
|
88
124
|
addressable (~> 2.3)
|
89
|
-
json
|
125
|
+
json (>= 2.3.0)
|
90
126
|
oauth (>= 0.4.5)
|
91
127
|
rest-client (>= 1.8.0)
|
128
|
+
ruby2_keywords (0.0.5)
|
92
129
|
serialport (1.3.1)
|
93
|
-
signet (0.
|
130
|
+
signet (0.15.0)
|
94
131
|
addressable (~> 2.3)
|
95
|
-
faraday (
|
132
|
+
faraday (>= 0.17.3, < 2.0)
|
96
133
|
jwt (>= 1.5, < 3.0)
|
97
134
|
multi_json (~> 1.10)
|
98
|
-
test-unit (3.
|
135
|
+
test-unit (3.4.4)
|
99
136
|
power_assert
|
137
|
+
test-unit-rr (1.0.5)
|
138
|
+
rr (>= 1.1.1)
|
139
|
+
test-unit (>= 2.5.2)
|
100
140
|
thor (0.20.3)
|
101
|
-
|
102
|
-
tzinfo (
|
103
|
-
|
141
|
+
trailblazer-option (0.1.1)
|
142
|
+
tzinfo (2.0.4)
|
143
|
+
concurrent-ruby (~> 1.0)
|
104
144
|
uber (0.1.0)
|
105
145
|
unf (0.1.4)
|
106
146
|
unf_ext
|
107
|
-
unf_ext (0.0.7.
|
147
|
+
unf_ext (0.0.7.7)
|
148
|
+
webrick (1.7.0)
|
149
|
+
zeitwerk (2.4.2)
|
108
150
|
|
109
151
|
PLATFORMS
|
110
152
|
ruby
|
111
153
|
|
112
154
|
DEPENDENCIES
|
113
|
-
activesupport
|
114
|
-
|
115
|
-
|
155
|
+
activesupport (>= 4.0)
|
156
|
+
ambient_iot (>= 0.1.1)
|
157
|
+
bundler
|
158
|
+
dotenv
|
159
|
+
ffi (~> 1.9.24)
|
116
160
|
google_drive
|
117
161
|
ladder_drive!
|
118
|
-
pi_piper
|
162
|
+
pi_piper (>= 2.0.0)
|
119
163
|
rake (~> 10.0)
|
120
164
|
ruby-trello
|
121
165
|
serialport
|
122
166
|
test-unit
|
167
|
+
test-unit-rr
|
123
168
|
|
124
169
|
BUNDLED WITH
|
125
|
-
1.
|
170
|
+
2.1.4
|
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,21 +14,25 @@ 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
|
-
spec.add_runtime_dependency 'serialport'
|
22
|
-
spec.add_runtime_dependency 'google_drive', '~> 3.0'
|
23
|
-
spec.add_runtime_dependency 'ruby-trello', '~>2.1'
|
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'
|
24
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'
|
27
|
+
|
28
|
+
spec.required_ruby_version = '>= 2.3.3'
|
25
29
|
|
26
30
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
27
31
|
spec.bindir = "exe"
|
28
32
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
33
|
spec.require_paths = ["lib"]
|
30
34
|
|
31
|
-
spec.add_development_dependency "bundler"
|
35
|
+
spec.add_development_dependency "bundler"
|
32
36
|
spec.add_development_dependency "rake", "~> 10.0"
|
33
37
|
|
34
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,9 +25,11 @@ 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
|
32
|
+
include LadderDrive::Protocol::Omron
|
31
33
|
include LadderDrive::Protocol::Emulator
|
32
34
|
|
33
35
|
module LadderDrive
|
@@ -45,7 +47,8 @@ module LadderDrive
|
|
45
47
|
def load path
|
46
48
|
h = {}
|
47
49
|
if File.exist?(path)
|
48
|
-
|
50
|
+
erb = ERB.new File.read(path)
|
51
|
+
h = YAML.load(erb.result(binding))
|
49
52
|
h = JSON.parse(h.to_json, symbolize_names: true)
|
50
53
|
end
|
51
54
|
new h || {}
|
@@ -50,11 +50,6 @@ module Keyence
|
|
50
50
|
@socket = nil
|
51
51
|
end
|
52
52
|
|
53
|
-
def get_bit_from_device device
|
54
|
-
device = device_by_name device
|
55
|
-
get_bits_from_device(1, device).first
|
56
|
-
end
|
57
|
-
|
58
53
|
def get_bits_from_device count, device
|
59
54
|
c = (count + 15) / 16
|
60
55
|
words = get_words_from_device c, device
|
@@ -89,11 +84,6 @@ module Keyence
|
|
89
84
|
alias :set_bit_to_device :set_bits_to_device
|
90
85
|
|
91
86
|
|
92
|
-
def get_word_from_device device
|
93
|
-
device = device_by_name device
|
94
|
-
get_words_from_device(1, device).first
|
95
|
-
end
|
96
|
-
|
97
87
|
def get_words_from_device(count, device)
|
98
88
|
device = local_device device
|
99
89
|
packet = "RDS #{device.name}.H #{count}\r\n"
|
@@ -134,7 +124,7 @@ module Keyence
|
|
134
124
|
def receive
|
135
125
|
res = ""
|
136
126
|
begin
|
137
|
-
Timeout.timeout(
|
127
|
+
Timeout.timeout(TIMEOUT) do
|
138
128
|
res = @socket.gets
|
139
129
|
end
|
140
130
|
rescue Timeout::Error
|
@@ -42,7 +42,6 @@ module Mitsubishi
|
|
42
42
|
NAK = "\u0015"
|
43
43
|
|
44
44
|
DELIMITER = "\r\n"
|
45
|
-
TIMEOUT = 1.0
|
46
45
|
|
47
46
|
def initialize options={}
|
48
47
|
super
|
@@ -79,11 +78,6 @@ module Mitsubishi
|
|
79
78
|
@comm = nil
|
80
79
|
end
|
81
80
|
|
82
|
-
def get_bit_from_device device
|
83
|
-
device = device_by_name device
|
84
|
-
get_bits_from_device(1, device).first
|
85
|
-
end
|
86
|
-
|
87
81
|
def get_bits_from_device count, device
|
88
82
|
raise ArgumentError.new("A count #{count} must be between #{available_bits_range.first} and #{available_bits_range.last} for #{__method__}") unless available_bits_range.include? count
|
89
83
|
|
@@ -130,11 +124,6 @@ module Mitsubishi
|
|
130
124
|
end
|
131
125
|
end
|
132
126
|
|
133
|
-
def get_word_from_device device
|
134
|
-
device = device_by_name device
|
135
|
-
get_words_from_device(1, device).first
|
136
|
-
end
|
137
|
-
|
138
127
|
def get_words_from_device(count, device)
|
139
128
|
raise ArgumentError.new("A count #{count} must be between #{available_words_range.first} and #{available_words_range.last} for #{__method__}") unless available_words_range.include? count
|
140
129
|
|