somfy_sdn 1.0.12 → 2.1.2
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 +4 -4
- data/bin/somfy_sdn +60 -0
- data/lib/sdn/cli/mqtt/group.rb +31 -0
- data/lib/sdn/cli/mqtt/motor.rb +103 -0
- data/lib/sdn/cli/mqtt/read.rb +156 -0
- data/lib/sdn/cli/mqtt/subscriptions.rb +156 -0
- data/lib/sdn/cli/mqtt/write.rb +93 -0
- data/lib/sdn/cli/mqtt.rb +397 -0
- data/lib/sdn/cli/provisioner.rb +234 -0
- data/lib/sdn/cli/simulator.rb +197 -0
- data/lib/sdn/client.rb +86 -0
- data/lib/sdn/{messages → message}/control.rb +79 -38
- data/lib/sdn/{messages → message}/get.rb +48 -40
- data/lib/sdn/{messages → message}/helpers.rb +33 -3
- data/lib/sdn/message/ilt2/get.rb +48 -0
- data/lib/sdn/message/ilt2/master_control.rb +35 -0
- data/lib/sdn/message/ilt2/post.rb +127 -0
- data/lib/sdn/message/ilt2/set.rb +192 -0
- data/lib/sdn/{messages → message}/post.rb +127 -61
- data/lib/sdn/{messages → message}/set.rb +99 -84
- data/lib/sdn/message.rb +81 -30
- data/lib/sdn/version.rb +1 -1
- data/lib/sdn.rb +16 -1
- metadata +63 -26
- data/bin/sdn_mqtt_bridge +0 -5
- data/lib/sdn/messages/ilt2/get.rb +0 -9
- data/lib/sdn/messages/ilt2/post.rb +0 -18
- data/lib/sdn/messages/ilt2/set.rb +0 -59
- data/lib/sdn/mqtt_bridge.rb +0 -711
@@ -1,18 +0,0 @@
|
|
1
|
-
module SDN
|
2
|
-
class Message
|
3
|
-
module ILT2
|
4
|
-
class PostMotorPosition < Message
|
5
|
-
MSG = 0x64
|
6
|
-
PARAMS_LENGTH = 3
|
7
|
-
|
8
|
-
attr_accessor :position_pulses, :position_percent
|
9
|
-
|
10
|
-
def parse(params)
|
11
|
-
super
|
12
|
-
self.position_pulses = to_number(params[0..1])
|
13
|
-
self.position_percent = to_number(params[2]).to_f / 255 * 100
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
module SDN
|
2
|
-
class Message
|
3
|
-
module ILT2
|
4
|
-
class SetMotorPosition < Message
|
5
|
-
MSG = 0x54
|
6
|
-
PARAMS_LENGTH = 3
|
7
|
-
TARGET_TYPE = {
|
8
|
-
up_limit: 1,
|
9
|
-
down_limit: 2,
|
10
|
-
stop: 3,
|
11
|
-
ip: 4,
|
12
|
-
next_ip_up: 5,
|
13
|
-
next_ip_down: 6,
|
14
|
-
jog_up: 10,
|
15
|
-
jog_down: 11,
|
16
|
-
position_percent: 16,
|
17
|
-
}.freeze
|
18
|
-
|
19
|
-
attr_reader :target_type, :target
|
20
|
-
|
21
|
-
def initialize(dest = nil, target_type = :up_limit, target = 0, **kwargs)
|
22
|
-
kwargs[:dest] ||= dest
|
23
|
-
super(**kwargs)
|
24
|
-
self.target_type = target_type
|
25
|
-
self.target = target
|
26
|
-
end
|
27
|
-
|
28
|
-
def parse(params)
|
29
|
-
super
|
30
|
-
self.target_type = TARGET_TYPE.invert[to_number(params[0])]
|
31
|
-
target = to_number(params[1..2])
|
32
|
-
if target_type == :position_percent
|
33
|
-
target = target.to_f / 255 * 100
|
34
|
-
end
|
35
|
-
self.target = target
|
36
|
-
end
|
37
|
-
|
38
|
-
def target_type=(value)
|
39
|
-
raise ArgumentError, "target_type must be one of :up_limit, :down_limit, :stop, :ip, :next_ip_up, :next_ip_down, :jog_up, :jog_down, or :position_percent" unless TARGET_TYPE.keys.include?(value)
|
40
|
-
@target_type = value
|
41
|
-
end
|
42
|
-
|
43
|
-
def target=(value)
|
44
|
-
if target_type == :position_percent && value
|
45
|
-
@target = [[0, value].max, 100].min
|
46
|
-
else
|
47
|
-
@target = value&. & 0xffff
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def params
|
52
|
-
param = target
|
53
|
-
param = (param * 255 / 100).to_i if target_type == :position_percent
|
54
|
-
transform_param(TARGET_TYPE[target_type]) + from_number(param, 2)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|