somfy_sdn 2.3.2 → 2.4.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.
- checksums.yaml +4 -4
- data/exe/somfy_sdn +5 -1
- data/lib/sdn/cli/mqtt/read.rb +1 -1
- data/lib/sdn/cli/mqtt.rb +504 -415
- data/lib/sdn/version.rb +1 -1
- metadata +3 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce1312b5758303a3565e861d79f1f0a0fb4cbce238405b56e6b644c930d05fd4
|
4
|
+
data.tar.gz: b1b3fce4edc972acd8fd11c9a3ffd5cbcd2666a835ea65467aeb46d017d81920
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72f289a280b71351c8391509f0423fbc3393116c1da282b33770b28a628cbedc986653ab6aa057a29bf93a90d3f18c7ca819ac6134fb04e0d15df8a66d2c148e
|
7
|
+
data.tar.gz: af1a38f012980b98561f02d1df8c26183878a81bec0b61e4adf6164117500175cd35a1555cd1e33bd12766e6d7e8161beca7fceb23d24fa62ff84d1246b16935
|
data/exe/somfy_sdn
CHANGED
@@ -27,6 +27,8 @@ class SomfySDNCLI < Thor
|
|
27
27
|
option :"base-topic", default: "homie", desc: "The base Homie topic"
|
28
28
|
option :"auto-discover", type: :boolean, default: true, desc: "Do a discovery at startup"
|
29
29
|
option :address, type: :array, desc: "Specify a known motor address to speed discovery"
|
30
|
+
option :homie, type: :boolean, desc: "Enable Homie discovery", default: true
|
31
|
+
option :"home-assistant", type: :boolean, desc: "Enable Home Assistant discovery", default: true
|
30
32
|
def mqtt(port, mqtt_uri)
|
31
33
|
sdn = handle_global_options(port)
|
32
34
|
|
@@ -37,7 +39,9 @@ class SomfySDNCLI < Thor
|
|
37
39
|
device_id: options["device-id"],
|
38
40
|
base_topic: options["base-topic"],
|
39
41
|
auto_discover: options["auto-discover"],
|
40
|
-
known_motors: options["address"]
|
42
|
+
known_motors: options["address"],
|
43
|
+
homie: options["homie"],
|
44
|
+
home_assistant: options["home-assistant"])
|
41
45
|
end
|
42
46
|
|
43
47
|
desc "provision PORT [ADDRESS]", "Provision a motor (label and set limits) at PORT"
|
data/lib/sdn/cli/mqtt/read.rb
CHANGED
@@ -19,7 +19,7 @@ module SDN
|
|
19
19
|
follow_ups = []
|
20
20
|
case message
|
21
21
|
when Message::PostNodeLabel
|
22
|
-
publish("#{motor.addr}/$name", message.label) if motor.publish(:label, message.label)
|
22
|
+
publish("#{motor.addr}/$name", message.label) if motor.publish(:label, message.label) && @homie
|
23
23
|
when Message::PostMotorPosition,
|
24
24
|
Message::ILT2::PostMotorPosition
|
25
25
|
if message.is_a?(Message::ILT2::PostMotorPosition)
|
data/lib/sdn/cli/mqtt.rb
CHANGED
@@ -32,7 +32,11 @@ module SDN
|
|
32
32
|
device_id: "somfy",
|
33
33
|
base_topic: "homie",
|
34
34
|
auto_discover: true,
|
35
|
-
known_motors: []
|
35
|
+
known_motors: [],
|
36
|
+
homie: true,
|
37
|
+
home_assistant: true)
|
38
|
+
@homie = homie
|
39
|
+
@home_assistant = home_assistant
|
36
40
|
@base_topic = "#{base_topic}/#{device_id}"
|
37
41
|
@device_id = device_id
|
38
42
|
@mqtt = ::MQTT::Client.new(mqtt_uri)
|
@@ -95,35 +99,39 @@ module SDN
|
|
95
99
|
|
96
100
|
def publish_basic_attributes
|
97
101
|
@mqtt.batch_publish do
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
102
|
+
if @homie
|
103
|
+
publish("$homie", "4.0.0")
|
104
|
+
publish("$name", "Somfy SDN Network")
|
105
|
+
publish("$state", "init")
|
106
|
+
publish("$nodes", "FFFFFF")
|
107
|
+
|
108
|
+
publish("FFFFFF/$name", "Broadcast")
|
109
|
+
publish("FFFFFF/$type", "sdn")
|
110
|
+
publish("FFFFFF/$properties", "discover")
|
111
|
+
|
112
|
+
publish("FFFFFF/discover/$name", "Trigger Motor Discovery")
|
113
|
+
publish("FFFFFF/discover/$datatype", "enum")
|
114
|
+
publish("FFFFFF/discover/$format", "discover")
|
115
|
+
publish("FFFFFF/discover/$settable", "true")
|
116
|
+
publish("FFFFFF/discover/$retained", "false")
|
117
|
+
end
|
112
118
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
119
|
+
if @home_assistant
|
120
|
+
hass_device = {
|
121
|
+
name: "Somfy SDN Bridge",
|
122
|
+
identifiers: @device_id,
|
123
|
+
sw_version: SDN::VERSION
|
124
|
+
}
|
125
|
+
@mqtt.publish_hass_button("discover",
|
126
|
+
command_topic: "#{@base_topic}/FFFFFF/discover/set",
|
127
|
+
device: hass_device,
|
128
|
+
icon: "mdi:search-add",
|
129
|
+
name: "Discover Motors",
|
130
|
+
node_id: @device_id,
|
131
|
+
object_id: "discover",
|
132
|
+
unique_id: "#{@device_id}_discover",
|
133
|
+
payload_press: "true")
|
134
|
+
end
|
127
135
|
|
128
136
|
subscribe_all
|
129
137
|
|
@@ -172,8 +180,10 @@ module SDN
|
|
172
180
|
}
|
173
181
|
node_id = "#{@device_id}_#{addr}"
|
174
182
|
|
175
|
-
|
176
|
-
|
183
|
+
if @homie
|
184
|
+
publish("#{addr}/$name", addr)
|
185
|
+
publish("#{addr}/$type", node_type.to_s)
|
186
|
+
end
|
177
187
|
properties = %w[
|
178
188
|
discover
|
179
189
|
label
|
@@ -200,313 +210,374 @@ module SDN
|
|
200
210
|
"slow-speed")
|
201
211
|
end
|
202
212
|
|
203
|
-
|
213
|
+
if @homie
|
214
|
+
publish("#{addr}/$properties", properties.join(","))
|
204
215
|
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
216
|
+
publish("#{addr}/discover/$name", "Trigger Motor Discovery")
|
217
|
+
publish("#{addr}/discover/$datatype", "enum")
|
218
|
+
publish("#{addr}/discover/$format", "discover")
|
219
|
+
publish("#{addr}/discover/$settable", "true")
|
220
|
+
publish("#{addr}/discover/$retained", "false")
|
221
|
+
end
|
210
222
|
|
211
|
-
@
|
212
|
-
|
213
|
-
|
214
|
-
icon: "mdi:search-add",
|
215
|
-
name: "Rediscover",
|
216
|
-
node_id: node_id,
|
217
|
-
object_id: "discover",
|
218
|
-
payload_press: "true",
|
219
|
-
unique_id: "#{node_id}_discover")
|
220
|
-
|
221
|
-
publish("#{addr}/label/$name", "Node label")
|
222
|
-
publish("#{addr}/label/$datatype", "string")
|
223
|
-
publish("#{addr}/label/$settable", "true")
|
224
|
-
@mqtt.publish_hass_text("label",
|
225
|
-
command_topic: "#{@base_topic}/#{addr}/label/set",
|
226
|
-
device: hass_device,
|
227
|
-
entity_category: :config,
|
228
|
-
icon: "mdi:rename",
|
229
|
-
max: 16,
|
230
|
-
name: "Label",
|
231
|
-
node_id: node_id,
|
232
|
-
unique_id: "#{node_id}_label")
|
233
|
-
|
234
|
-
publish("#{addr}/state/$name", "Current state of the motor")
|
235
|
-
publish("#{addr}/state/$datatype", "enum")
|
236
|
-
publish("#{addr}/state/$format", Message::PostMotorStatus::STATE.keys.join(","))
|
237
|
-
|
238
|
-
publish("#{addr}/control/$name", "Control motor")
|
239
|
-
publish("#{addr}/control/$datatype", "enum")
|
240
|
-
publish("#{addr}/control/$format", "up,down,stop,wink,next_ip,previous_ip,refresh")
|
241
|
-
publish("#{addr}/control/$settable", "true")
|
242
|
-
publish("#{addr}/control/$retained", "false")
|
243
|
-
|
244
|
-
publish("#{addr}/jog-ms/$name", "Jog motor by ms")
|
245
|
-
publish("#{addr}/jog-ms/$datatype", "integer")
|
246
|
-
publish("#{addr}/jog-ms/$format", "-65535:65535")
|
247
|
-
publish("#{addr}/jog-ms/$unit", "ms")
|
248
|
-
publish("#{addr}/jog-ms/$settable", "true")
|
249
|
-
publish("#{addr}/jog-ms/$retained", "false")
|
250
|
-
|
251
|
-
publish("#{addr}/jog-pulses/$name", "Jog motor by pulses")
|
252
|
-
publish("#{addr}/jog-pulses/$datatype", "integer")
|
253
|
-
publish("#{addr}/jog-pulses/$format", "-65535:65535")
|
254
|
-
publish("#{addr}/jog-pulses/$unit", "pulses")
|
255
|
-
publish("#{addr}/jog-pulses/$settable", "true")
|
256
|
-
publish("#{addr}/jog-pulses/$retained", "false")
|
257
|
-
|
258
|
-
publish("#{addr}/position-percent/$name", "Position (in %)")
|
259
|
-
publish("#{addr}/position-percent/$datatype", "integer")
|
260
|
-
publish("#{addr}/position-percent/$format", "0:100")
|
261
|
-
publish("#{addr}/position-percent/$unit", "%")
|
262
|
-
publish("#{addr}/position-percent/$settable", "true")
|
263
|
-
|
264
|
-
@mqtt.publish_hass_cover("motor",
|
265
|
-
command_topic: "#{@base_topic}/#{addr}/control/set",
|
266
|
-
device: hass_device,
|
267
|
-
icon: "mdi:roller-shade",
|
268
|
-
name: "Motor",
|
269
|
-
node_id: node_id,
|
270
|
-
payload_close: "down",
|
271
|
-
payload_open: "up",
|
272
|
-
payload_stop: "stop",
|
273
|
-
position_open: 0,
|
274
|
-
position_closed: 100,
|
275
|
-
position_topic: "#{@base_topic}/#{addr}/position-percent",
|
276
|
-
set_position_topic: "#{@base_topic}/#{addr}/position-percent/set",
|
277
|
-
state_topic: "#{@base_topic}/#{addr}/hass-state",
|
278
|
-
unique_id: "#{node_id}_motor")
|
279
|
-
{
|
280
|
-
Wink: "mdi:emoticon-wink",
|
281
|
-
Next_IP: "mdi:skip-next",
|
282
|
-
Previous_IP: "mdi:skip-previous",
|
283
|
-
Refresh: "mdi:refresh"
|
284
|
-
}.each do |command, icon|
|
285
|
-
@mqtt.publish_hass_button(command.to_s.downcase,
|
286
|
-
command_topic: "#{@base_topic}/#{addr}/control/set",
|
223
|
+
if @home_assistant
|
224
|
+
@mqtt.publish_hass_button("discover",
|
225
|
+
command_topic: "#{@base_topic}/#{addr}/discover/set",
|
287
226
|
device: hass_device,
|
288
|
-
icon:
|
289
|
-
name:
|
227
|
+
icon: "mdi:search-add",
|
228
|
+
name: "Rediscover",
|
290
229
|
node_id: node_id,
|
291
|
-
|
292
|
-
|
230
|
+
object_id: "discover",
|
231
|
+
payload_press: "true",
|
232
|
+
unique_id: "#{node_id}_discover")
|
293
233
|
end
|
294
234
|
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
235
|
+
if @homie
|
236
|
+
publish("#{addr}/label/$name", "Node label")
|
237
|
+
publish("#{addr}/label/$datatype", "string")
|
238
|
+
publish("#{addr}/label/$settable", "true")
|
239
|
+
end
|
300
240
|
|
301
|
-
@
|
302
|
-
|
303
|
-
|
304
|
-
enabled_by_default: false,
|
305
|
-
max: 65_536,
|
306
|
-
min: 0,
|
307
|
-
name: "Position (Pulses)",
|
308
|
-
node_id: node_id,
|
309
|
-
object_id: "position-pulses",
|
310
|
-
state_topic: "#{@base_topic}/#{addr}/position-pulses",
|
311
|
-
step: 10,
|
312
|
-
unit_of_measurement: "pulses",
|
313
|
-
unique_id: "#{node_id}_position-pulses")
|
314
|
-
|
315
|
-
publish("#{addr}/ip/$name", "Intermediate Position")
|
316
|
-
publish("#{addr}/ip/$datatype", "integer")
|
317
|
-
publish("#{addr}/ip/$format", "1:16")
|
318
|
-
publish("#{addr}/ip/$settable", "true")
|
319
|
-
publish("#{addr}/ip/$retained", "false") if node_type == :st50ilt2
|
320
|
-
|
321
|
-
@mqtt.publish_hass_number("ip",
|
322
|
-
command_topic: "#{@base_topic}/#{addr}/ip/set",
|
323
|
-
device: hass_device,
|
324
|
-
name: "Intermediate Position",
|
325
|
-
max: 16,
|
326
|
-
min: 0,
|
327
|
-
node_id: node_id,
|
328
|
-
object_id: "ip",
|
329
|
-
payload_reset: "",
|
330
|
-
state_topic: "#{@base_topic}/#{addr}/ip",
|
331
|
-
unique_id: "#{node_id}_ip")
|
332
|
-
|
333
|
-
publish("#{addr}/down-limit/$name", "Down limit")
|
334
|
-
publish("#{addr}/down-limit/$datatype", "integer")
|
335
|
-
publish("#{addr}/down-limit/$format", "0:65535")
|
336
|
-
publish("#{addr}/down-limit/$unit", "pulses")
|
337
|
-
publish("#{addr}/down-limit/$settable", "true")
|
338
|
-
|
339
|
-
@mqtt.publish_hass_number("down-limit",
|
340
|
-
command_topic: "#{@base_topic}/#{addr}/down-limit/set",
|
241
|
+
if @home_assistant
|
242
|
+
@mqtt.publish_hass_text("label",
|
243
|
+
command_topic: "#{@base_topic}/#{addr}/label/set",
|
341
244
|
device: hass_device,
|
342
245
|
entity_category: :config,
|
343
|
-
icon: "mdi:
|
344
|
-
max:
|
345
|
-
|
246
|
+
icon: "mdi:rename",
|
247
|
+
max: 16,
|
248
|
+
name: "Label",
|
346
249
|
node_id: node_id,
|
347
|
-
|
348
|
-
|
349
|
-
step: 10,
|
350
|
-
unit_of_measurement: "pulses",
|
351
|
-
unique_id: "#{node_id}_down-limit")
|
250
|
+
unique_id: "#{node_id}_label")
|
251
|
+
end
|
352
252
|
|
353
|
-
|
354
|
-
|
355
|
-
|
253
|
+
if @homie
|
254
|
+
publish("#{addr}/state/$name", "Current state of the motor")
|
255
|
+
publish("#{addr}/state/$datatype", "enum")
|
256
|
+
publish("#{addr}/state/$format", Message::PostMotorStatus::STATE.keys.join(","))
|
257
|
+
|
258
|
+
publish("#{addr}/control/$name", "Control motor")
|
259
|
+
publish("#{addr}/control/$datatype", "enum")
|
260
|
+
publish("#{addr}/control/$format", "up,down,stop,wink,next_ip,previous_ip,refresh")
|
261
|
+
publish("#{addr}/control/$settable", "true")
|
262
|
+
publish("#{addr}/control/$retained", "false")
|
263
|
+
|
264
|
+
publish("#{addr}/jog-ms/$name", "Jog motor by ms")
|
265
|
+
publish("#{addr}/jog-ms/$datatype", "integer")
|
266
|
+
publish("#{addr}/jog-ms/$format", "-65535:65535")
|
267
|
+
publish("#{addr}/jog-ms/$unit", "ms")
|
268
|
+
publish("#{addr}/jog-ms/$settable", "true")
|
269
|
+
publish("#{addr}/jog-ms/$retained", "false")
|
270
|
+
|
271
|
+
publish("#{addr}/jog-pulses/$name", "Jog motor by pulses")
|
272
|
+
publish("#{addr}/jog-pulses/$datatype", "integer")
|
273
|
+
publish("#{addr}/jog-pulses/$format", "-65535:65535")
|
274
|
+
publish("#{addr}/jog-pulses/$unit", "pulses")
|
275
|
+
publish("#{addr}/jog-pulses/$settable", "true")
|
276
|
+
publish("#{addr}/jog-pulses/$retained", "false")
|
277
|
+
|
278
|
+
publish("#{addr}/position-percent/$name", "Position (in %)")
|
279
|
+
publish("#{addr}/position-percent/$datatype", "integer")
|
280
|
+
publish("#{addr}/position-percent/$format", "0:100")
|
281
|
+
publish("#{addr}/position-percent/$unit", "%")
|
282
|
+
publish("#{addr}/position-percent/$settable", "true")
|
283
|
+
end
|
356
284
|
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
285
|
+
if @home_assistant
|
286
|
+
@mqtt.publish_hass_cover("motor",
|
287
|
+
command_topic: "#{@base_topic}/#{addr}/control/set",
|
288
|
+
device: hass_device,
|
289
|
+
icon: "mdi:roller-shade",
|
290
|
+
name: "Motor",
|
291
|
+
node_id: node_id,
|
292
|
+
payload_close: "down",
|
293
|
+
payload_open: "up",
|
294
|
+
payload_stop: "stop",
|
295
|
+
position_open: 0,
|
296
|
+
position_closed: 100,
|
297
|
+
position_topic: "#{@base_topic}/#{addr}/position-percent",
|
298
|
+
set_position_topic: "#{@base_topic}/#{addr}/position-percent/set",
|
299
|
+
state_topic: "#{@base_topic}/#{addr}/hass-state",
|
300
|
+
unique_id: "#{node_id}_motor")
|
301
|
+
{
|
302
|
+
Wink: "mdi:emoticon-wink",
|
303
|
+
Next_IP: "mdi:skip-next",
|
304
|
+
Previous_IP: "mdi:skip-previous",
|
305
|
+
Refresh: "mdi:refresh"
|
306
|
+
}.each do |command, icon|
|
307
|
+
@mqtt.publish_hass_button(command.to_s.downcase,
|
308
|
+
command_topic: "#{@base_topic}/#{addr}/control/set",
|
367
309
|
device: hass_device,
|
368
|
-
|
369
|
-
|
370
|
-
name: "Reset #{key.to_s.sub("_", " ")}",
|
310
|
+
icon: icon,
|
311
|
+
name: command.to_s.sub("_", " "),
|
371
312
|
node_id: node_id,
|
372
|
-
payload_press:
|
373
|
-
unique_id: "#{node_id}_#{
|
313
|
+
payload_press: command.to_s.downcase,
|
314
|
+
unique_id: "#{node_id}_#{command.to_s.downcase}")
|
374
315
|
end
|
316
|
+
end
|
375
317
|
|
376
|
-
|
377
|
-
publish("#{addr}/
|
378
|
-
publish("#{addr}/
|
318
|
+
if @homie
|
319
|
+
publish("#{addr}/position-pulses/$name", "Position from up limit (in pulses)")
|
320
|
+
publish("#{addr}/position-pulses/$datatype", "integer")
|
321
|
+
publish("#{addr}/position-pulses/$format", "0:65535")
|
322
|
+
publish("#{addr}/position-pulses/$unit", "pulses")
|
323
|
+
publish("#{addr}/position-pulses/$settable", "true")
|
324
|
+
end
|
379
325
|
|
380
|
-
|
326
|
+
if @home_assistant
|
327
|
+
@mqtt.publish_hass_number("position-pulses",
|
328
|
+
command_topic: "#{@base_topic}/#{addr}/position-pulses/set",
|
381
329
|
device: hass_device,
|
382
|
-
|
383
|
-
|
384
|
-
|
330
|
+
enabled_by_default: false,
|
331
|
+
max: 65_536,
|
332
|
+
min: 0,
|
333
|
+
name: "Position (Pulses)",
|
385
334
|
node_id: node_id,
|
386
|
-
object_id: "
|
387
|
-
|
388
|
-
|
389
|
-
|
335
|
+
object_id: "position-pulses",
|
336
|
+
state_topic: "#{@base_topic}/#{addr}/position-pulses",
|
337
|
+
step: 10,
|
338
|
+
unit_of_measurement: "pulses",
|
339
|
+
unique_id: "#{node_id}_position-pulses")
|
340
|
+
end
|
390
341
|
|
391
|
-
|
392
|
-
publish("#{addr}/
|
393
|
-
publish("#{addr}/
|
342
|
+
if @homie
|
343
|
+
publish("#{addr}/ip/$name", "Intermediate Position")
|
344
|
+
publish("#{addr}/ip/$datatype", "integer")
|
345
|
+
publish("#{addr}/ip/$format", "1:16")
|
346
|
+
publish("#{addr}/ip/$settable", "true")
|
347
|
+
publish("#{addr}/ip/$retained", "false") if node_type == :st50ilt2
|
348
|
+
end
|
394
349
|
|
395
|
-
|
350
|
+
if @home_assistant
|
351
|
+
@mqtt.publish_hass_number("ip",
|
352
|
+
command_topic: "#{@base_topic}/#{addr}/ip/set",
|
396
353
|
device: hass_device,
|
397
|
-
|
398
|
-
|
399
|
-
|
354
|
+
name: "Intermediate Position",
|
355
|
+
max: 16,
|
356
|
+
min: 0,
|
400
357
|
node_id: node_id,
|
401
|
-
object_id: "
|
402
|
-
|
403
|
-
state_topic: "#{@base_topic}/#{addr}/
|
404
|
-
unique_id: "#{node_id}
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
publish("#{addr}/
|
409
|
-
publish("#{addr}/
|
410
|
-
publish("#{addr}/
|
411
|
-
|
412
|
-
|
413
|
-
|
358
|
+
object_id: "ip",
|
359
|
+
payload_reset: "",
|
360
|
+
state_topic: "#{@base_topic}/#{addr}/ip",
|
361
|
+
unique_id: "#{node_id}_ip")
|
362
|
+
end
|
363
|
+
|
364
|
+
if @homie
|
365
|
+
publish("#{addr}/down-limit/$name", "Down limit")
|
366
|
+
publish("#{addr}/down-limit/$datatype", "integer")
|
367
|
+
publish("#{addr}/down-limit/$format", "0:65535")
|
368
|
+
publish("#{addr}/down-limit/$unit", "pulses")
|
369
|
+
publish("#{addr}/down-limit/$settable", "true")
|
370
|
+
end
|
371
|
+
|
372
|
+
if @home_assistant
|
373
|
+
@mqtt.publish_hass_number("down-limit",
|
374
|
+
command_topic: "#{@base_topic}/#{addr}/down-limit/set",
|
414
375
|
device: hass_device,
|
415
376
|
entity_category: :config,
|
416
|
-
icon: "mdi:roller-shade-
|
377
|
+
icon: "mdi:roller-shade-closed",
|
417
378
|
max: 65_536,
|
418
379
|
min: 0,
|
419
|
-
name: "Up Limit",
|
420
380
|
node_id: node_id,
|
421
381
|
payload_reset: "",
|
422
|
-
state_topic: "#{@base_topic}/#{addr}/
|
382
|
+
state_topic: "#{@base_topic}/#{addr}/down-limit",
|
423
383
|
step: 10,
|
424
384
|
unit_of_measurement: "pulses",
|
425
|
-
unique_id: "#{node_id}
|
385
|
+
unique_id: "#{node_id}_down-limit")
|
386
|
+
end
|
426
387
|
|
427
|
-
|
428
|
-
publish("#{addr}/direction/$
|
429
|
-
publish("#{addr}/direction/$
|
430
|
-
publish("#{addr}/direction/$
|
388
|
+
if @homie
|
389
|
+
publish("#{addr}/last-direction/$name", "Direction of last motion")
|
390
|
+
publish("#{addr}/last-direction/$datatype", "enum")
|
391
|
+
publish("#{addr}/last-direction/$format", Message::PostMotorStatus::DIRECTION.keys.join(","))
|
392
|
+
end
|
431
393
|
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
394
|
+
unless node_type == :st50ilt2
|
395
|
+
if @homie
|
396
|
+
publish("#{addr}/reset/$name", "Recall factory settings")
|
397
|
+
publish("#{addr}/reset/$datatype", "enum")
|
398
|
+
publish("#{addr}/reset/$format", Message::SetFactoryDefault::RESET.keys.join(","))
|
399
|
+
publish("#{addr}/reset/$settable", "true")
|
400
|
+
publish("#{addr}/reset/$retained", "false")
|
401
|
+
end
|
402
|
+
|
403
|
+
if @home_assistant
|
404
|
+
Message::SetFactoryDefault::RESET.each_key do |key|
|
405
|
+
@mqtt.publish_hass_button("reset_#{key}",
|
406
|
+
command_topic: "#{@base_topic}/#{addr}/reset/set",
|
407
|
+
device: hass_device,
|
408
|
+
enabled_by_default: false,
|
409
|
+
entity_category: :config,
|
410
|
+
name: "Reset #{key.to_s.sub("_", " ")}",
|
411
|
+
node_id: node_id,
|
412
|
+
payload_press: key,
|
413
|
+
unique_id: "#{node_id}_#{key}")
|
414
|
+
end
|
415
|
+
end
|
416
|
+
|
417
|
+
if @homie
|
418
|
+
publish("#{addr}/last-action-source/$name", "Source of last action")
|
419
|
+
publish("#{addr}/last-action-source/$datatype", "enum")
|
420
|
+
publish("#{addr}/last-action-source/$format", Message::PostMotorStatus::SOURCE.keys.join(","))
|
421
|
+
end
|
422
|
+
|
423
|
+
if @home_assistant
|
424
|
+
@mqtt.publish_hass_sensor("last-action-source",
|
425
|
+
device: hass_device,
|
426
|
+
device_class: :enum,
|
427
|
+
entity_category: :diagnostic,
|
428
|
+
name: "Source of last action",
|
429
|
+
node_id: node_id,
|
430
|
+
object_id: "last-action-source",
|
431
|
+
options: Message::PostMotorStatus::SOURCE.keys,
|
432
|
+
state_topic: "#{@base_topic}/#{addr}/last-action-source",
|
433
|
+
unique_id: "#{node_id}_last-action-source")
|
434
|
+
end
|
435
|
+
|
436
|
+
if @homie
|
437
|
+
publish("#{addr}/last-action-cause/$name", "Cause of last action")
|
438
|
+
publish("#{addr}/last-action-cause/$datatype", "enum")
|
439
|
+
publish("#{addr}/last-action-cause/$format", Message::PostMotorStatus::CAUSE.keys.join(","))
|
440
|
+
end
|
441
|
+
|
442
|
+
if @home_assistant
|
443
|
+
@mqtt.publish_hass_sensor("last-action-cause",
|
444
|
+
device: hass_device,
|
445
|
+
device_class: :enum,
|
446
|
+
entity_category: :diagnostic,
|
447
|
+
name: "Cause of last action",
|
448
|
+
node_id: node_id,
|
449
|
+
object_id: "last-action-cause",
|
450
|
+
options: Message::PostMotorStatus::CAUSE.keys,
|
451
|
+
state_topic: "#{@base_topic}/#{addr}/last-action-cause",
|
452
|
+
unique_id: "#{node_id}_last-action-cause")
|
453
|
+
end
|
454
|
+
|
455
|
+
if @homie
|
456
|
+
publish("#{addr}/up-limit/$name", "Up limit (always = 0)")
|
457
|
+
publish("#{addr}/up-limit/$datatype", "integer")
|
458
|
+
publish("#{addr}/up-limit/$format", "0:65535")
|
459
|
+
publish("#{addr}/up-limit/$unit", "pulses")
|
460
|
+
publish("#{addr}/up-limit/$settable", "true")
|
461
|
+
end
|
462
|
+
|
463
|
+
if @homie
|
464
|
+
@mqtt.publish_hass_number("up-limit",
|
465
|
+
command_topic: "#{@base_topic}/#{addr}/up-limit/set",
|
465
466
|
device: hass_device,
|
466
467
|
entity_category: :config,
|
467
|
-
icon: "mdi:
|
468
|
-
max:
|
469
|
-
min:
|
470
|
-
name: "
|
468
|
+
icon: "mdi:roller-shade-open",
|
469
|
+
max: 65_536,
|
470
|
+
min: 0,
|
471
|
+
name: "Up Limit",
|
471
472
|
node_id: node_id,
|
472
|
-
|
473
|
-
|
474
|
-
|
473
|
+
payload_reset: "",
|
474
|
+
state_topic: "#{@base_topic}/#{addr}/up-limit",
|
475
|
+
step: 10,
|
476
|
+
unit_of_measurement: "pulses",
|
477
|
+
unique_id: "#{node_id}_up-limit")
|
478
|
+
end
|
479
|
+
|
480
|
+
if @homie
|
481
|
+
publish("#{addr}/direction/$name", "Motor rotation direction")
|
482
|
+
publish("#{addr}/direction/$datatype", "enum")
|
483
|
+
publish("#{addr}/direction/$format", "standard,reversed")
|
484
|
+
publish("#{addr}/direction/$settable", "true")
|
485
|
+
end
|
486
|
+
|
487
|
+
if @homie
|
488
|
+
@mqtt.publish_hass_select("direction",
|
489
|
+
command_topic: "#{@base_topic}/#{addr}/direction/set",
|
490
|
+
device: hass_device,
|
491
|
+
entity_category: :config,
|
492
|
+
icon: "mdi:circle-arrows",
|
493
|
+
name: "Motor rotation direction",
|
494
|
+
node_id: node_id,
|
495
|
+
object_id: "direction",
|
496
|
+
options: %w[standard reversed],
|
497
|
+
state_topic: "#{@base_topic}/#{addr}/direction",
|
498
|
+
unique_id: "#{node_id}_direction")
|
499
|
+
end
|
500
|
+
|
501
|
+
if @homie
|
502
|
+
publish("#{addr}/up-speed/$name", "Up speed")
|
503
|
+
publish("#{addr}/up-speed/$datatype", "integer")
|
504
|
+
publish("#{addr}/up-speed/$format", "6:28")
|
505
|
+
publish("#{addr}/up-speed/$unit", "RPM")
|
506
|
+
publish("#{addr}/up-speed/$settable", "true")
|
507
|
+
|
508
|
+
publish("#{addr}/down-speed/$name", "Down speed, always = Up speed")
|
509
|
+
publish("#{addr}/down-speed/$datatype", "integer")
|
510
|
+
publish("#{addr}/down-speed/$format", "6:28")
|
511
|
+
publish("#{addr}/down-speed/$unit", "RPM")
|
512
|
+
publish("#{addr}/down-speed/$settable", "true")
|
513
|
+
|
514
|
+
publish("#{addr}/slow-speed/$name", "Slow speed")
|
515
|
+
publish("#{addr}/slow-speed/$datatype", "integer")
|
516
|
+
publish("#{addr}/slow-speed/$format", "6:28")
|
517
|
+
publish("#{addr}/slow-speed/$unit", "RPM")
|
518
|
+
publish("#{addr}/slow-speed/$settable", "true")
|
519
|
+
end
|
520
|
+
|
521
|
+
if @home_assistant
|
522
|
+
%w[Up Slow].each do |speed_type|
|
523
|
+
@mqtt.publish_hass_number("#{speed_type.downcase}-speed",
|
524
|
+
command_topic: "#{@base_topic}/#{addr}/#{speed_type.downcase}-speed/set",
|
525
|
+
device: hass_device,
|
526
|
+
entity_category: :config,
|
527
|
+
icon: "mdi:car-speed-limiter",
|
528
|
+
max: 28,
|
529
|
+
min: 6,
|
530
|
+
name: "#{speed_type} speed",
|
531
|
+
node_id: node_id,
|
532
|
+
state_topic: "#{@base_topic}/#{addr}/#{speed_type.downcase}-speed",
|
533
|
+
unit_of_measurement: "RPM",
|
534
|
+
unique_id: "#{node_id}_#{speed_type.downcase}-speed")
|
535
|
+
end
|
475
536
|
end
|
476
537
|
end
|
477
538
|
|
478
|
-
|
479
|
-
|
480
|
-
|
539
|
+
if @homie
|
540
|
+
publish("#{addr}/groups/$name", "Group Memberships (comma separated, address must start 0101xx)")
|
541
|
+
publish("#{addr}/groups/$datatype", "string")
|
542
|
+
publish("#{addr}/groups/$settable", "true")
|
543
|
+
end
|
481
544
|
|
482
545
|
(1..16).each do |ip|
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
546
|
+
if @homie
|
547
|
+
publish("#{addr}/ip#{ip}-pulses/$name", "Intermediate Position #{ip}")
|
548
|
+
publish("#{addr}/ip#{ip}-pulses/$datatype", "integer")
|
549
|
+
publish("#{addr}/ip#{ip}-pulses/$format", "0:65535")
|
550
|
+
publish("#{addr}/ip#{ip}-pulses/$unit", "pulses")
|
551
|
+
publish("#{addr}/ip#{ip}-pulses/$settable", "true")
|
552
|
+
end
|
553
|
+
|
554
|
+
if @home_assistant
|
555
|
+
@mqtt.publish_hass_number("ip#{ip}-pulses",
|
556
|
+
command_topic: "#{@base_topic}/#{addr}/ip#{ip}-pulses/set",
|
557
|
+
device: hass_device,
|
558
|
+
enabled_by_default: false,
|
559
|
+
entity_category: :config,
|
560
|
+
max: 65_536,
|
561
|
+
min: 0,
|
562
|
+
name: "Intermediation Position #{ip} (Pulses)",
|
563
|
+
node_id: node_id,
|
564
|
+
object_id: "ip#{ip}-pulses",
|
565
|
+
payload_reset: "",
|
566
|
+
state_topic: "#{@base_topic}/#{addr}/ip#{ip}-pulses",
|
567
|
+
step: 10,
|
568
|
+
unit_of_measurement: "pulses",
|
569
|
+
unique_id: "#{node_id}_ip#{ip}-pulses")
|
570
|
+
end
|
504
571
|
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
572
|
+
if @homie
|
573
|
+
publish("#{addr}/ip#{ip}-percent/$name", "Intermediate Position #{ip}")
|
574
|
+
publish("#{addr}/ip#{ip}-percent/$datatype", "integer")
|
575
|
+
publish("#{addr}/ip#{ip}-percent/$format", "0:100")
|
576
|
+
publish("#{addr}/ip#{ip}-percent/$unit", "%")
|
577
|
+
publish("#{addr}/ip#{ip}-percent/$settable", "true")
|
578
|
+
end
|
579
|
+
|
580
|
+
next unless @homie
|
510
581
|
|
511
582
|
@mqtt.publish_hass_number("ip#{ip}-percent",
|
512
583
|
command_topic: "#{@base_topic}/#{addr}/ip#{ip}-percent/set",
|
@@ -525,7 +596,7 @@ module SDN
|
|
525
596
|
|
526
597
|
motor = Motor.new(self, addr, node_type)
|
527
598
|
@motors[addr] = motor
|
528
|
-
publish("$nodes", (["FFFFFF"] + @motors.keys.sort + @groups.keys.sort).join(","))
|
599
|
+
publish("$nodes", (["FFFFFF"] + @motors.keys.sort + @groups.keys.sort).join(",")) if @homie
|
529
600
|
end
|
530
601
|
|
531
602
|
sdn_addr = Message.parse_address(addr)
|
@@ -592,135 +663,153 @@ module SDN
|
|
592
663
|
}
|
593
664
|
node_id = "#{@device_id}_#{addr}"
|
594
665
|
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
666
|
+
if @homie
|
667
|
+
publish("#{addr}/$name", addr)
|
668
|
+
publish("#{addr}/$type", "Shade Group")
|
669
|
+
publish("#{addr}/$properties",
|
670
|
+
"discover,control,jog-ms,jog-pulses,position-pulses,position-percent," \
|
671
|
+
"ip,reset,state,last-direction,motors")
|
672
|
+
|
673
|
+
publish("#{addr}/discover/$name", "Trigger Motor Discovery")
|
674
|
+
publish("#{addr}/discover/$datatype", "enum")
|
675
|
+
publish("#{addr}/discover/$format", "discover")
|
676
|
+
publish("#{addr}/discover/$settable", "true")
|
677
|
+
publish("#{addr}/discover/$retained", "false")
|
678
|
+
end
|
600
679
|
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
680
|
+
if @home_assistant
|
681
|
+
@mqtt.publish_hass_button("discover",
|
682
|
+
command_topic: "#{@base_topic}/#{addr}/discover/set",
|
683
|
+
device: hass_device,
|
684
|
+
icon: "mdi:search-add",
|
685
|
+
name: "Rediscover",
|
686
|
+
node_id: node_id,
|
687
|
+
object_id: "discover",
|
688
|
+
payload_press: "discover",
|
689
|
+
unique_id: "#{node_id}_discover")
|
690
|
+
end
|
606
691
|
|
607
|
-
@
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
692
|
+
if @homie
|
693
|
+
publish("#{addr}/control/$name", "Control motors")
|
694
|
+
publish("#{addr}/control/$datatype", "enum")
|
695
|
+
publish("#{addr}/control/$format", "up,down,stop,wink,next_ip,previous_ip,refresh")
|
696
|
+
publish("#{addr}/control/$settable", "true")
|
697
|
+
publish("#{addr}/control/$retained", "false")
|
698
|
+
end
|
699
|
+
|
700
|
+
if @home_assistant
|
701
|
+
@mqtt.publish_hass_cover("group",
|
702
|
+
command_topic: "#{@base_topic}/#{addr}/control/set",
|
703
|
+
device: hass_device,
|
704
|
+
icon: "mdi:roller-shade",
|
705
|
+
name: "Group",
|
706
|
+
node_id: node_id,
|
707
|
+
payload_close: "down",
|
708
|
+
payload_open: "up",
|
709
|
+
payload_stop: "stop",
|
710
|
+
position_open: 0,
|
711
|
+
position_closed: 100,
|
712
|
+
position_topic: "#{@base_topic}/#{addr}/position-percent",
|
713
|
+
set_position_topic: "#{@base_topic}/#{addr}/position-percent/set",
|
714
|
+
state_topic: "#{@base_topic}/#{addr}/hass-state",
|
715
|
+
unique_id: "#{node_id}_group")
|
716
|
+
{
|
717
|
+
Wink: "mdi:emoticon-wink",
|
718
|
+
Next_IP: "mdi:skip-next",
|
719
|
+
Previous_IP: "mdi:skip-previous",
|
720
|
+
Refresh: "mdi:refresh"
|
721
|
+
}.each do |command, icon|
|
722
|
+
@mqtt.publish_hass_button(command.to_s.downcase,
|
723
|
+
command_topic: "#{@base_topic}/#{addr}/control/set",
|
724
|
+
device: hass_device,
|
725
|
+
icon: icon,
|
726
|
+
name: command.to_s.sub("_", " "),
|
727
|
+
node_id: node_id,
|
728
|
+
payload_press: command.to_s.downcase,
|
729
|
+
unique_id: "#{node_id}_#{command.to_s.downcase}")
|
730
|
+
end
|
731
|
+
end
|
732
|
+
|
733
|
+
if @homie
|
734
|
+
publish("#{addr}/jog-ms/$name", "Jog motors by ms")
|
735
|
+
publish("#{addr}/jog-ms/$datatype", "integer")
|
736
|
+
publish("#{addr}/jog-ms/$format", "-65535:65535")
|
737
|
+
publish("#{addr}/jog-ms/$unit", "ms")
|
738
|
+
publish("#{addr}/jog-ms/$settable", "true")
|
739
|
+
publish("#{addr}/jog-ms/$retained", "false")
|
740
|
+
|
741
|
+
publish("#{addr}/jog-pulses/$name", "Jog motors by pulses")
|
742
|
+
publish("#{addr}/jog-pulses/$datatype", "integer")
|
743
|
+
publish("#{addr}/jog-pulses/$format", "-65535:65535")
|
744
|
+
publish("#{addr}/jog-pulses/$unit", "pulses")
|
745
|
+
publish("#{addr}/jog-pulses/$settable", "true")
|
746
|
+
publish("#{addr}/jog-pulses/$retained", "false")
|
747
|
+
|
748
|
+
publish("#{addr}/position-pulses/$name", "Position from up limit (in pulses)")
|
749
|
+
publish("#{addr}/position-pulses/$datatype", "integer")
|
750
|
+
publish("#{addr}/position-pulses/$format", "0:65535")
|
751
|
+
publish("#{addr}/position-pulses/$unit", "pulses")
|
752
|
+
publish("#{addr}/position-pulses/$settable", "true")
|
753
|
+
end
|
754
|
+
|
755
|
+
if @home_assistant
|
756
|
+
@mqtt.publish_hass_number("position-pulses",
|
757
|
+
command_topic: "#{@base_topic}/#{addr}/position-pulses/set",
|
646
758
|
device: hass_device,
|
647
|
-
|
648
|
-
|
759
|
+
enabled_by_default: false,
|
760
|
+
max: 65_536,
|
761
|
+
min: 0,
|
762
|
+
name: "Position (Pulses)",
|
649
763
|
node_id: node_id,
|
650
|
-
|
651
|
-
|
764
|
+
object_id: "position-pulses",
|
765
|
+
state_topic: "#{@base_topic}/#{addr}/position-pulses",
|
766
|
+
step: 10,
|
767
|
+
unit_of_measurement: "pulses",
|
768
|
+
unique_id: "#{node_id}_position-pulses")
|
652
769
|
end
|
653
770
|
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
publish("#{addr}/jog-pulses/$retained", "false")
|
667
|
-
|
668
|
-
publish("#{addr}/position-pulses/$name", "Position from up limit (in pulses)")
|
669
|
-
publish("#{addr}/position-pulses/$datatype", "integer")
|
670
|
-
publish("#{addr}/position-pulses/$format", "0:65535")
|
671
|
-
publish("#{addr}/position-pulses/$unit", "pulses")
|
672
|
-
publish("#{addr}/position-pulses/$settable", "true")
|
673
|
-
|
674
|
-
@mqtt.publish_hass_number("position-pulses",
|
675
|
-
command_topic: "#{@base_topic}/#{addr}/position-pulses/set",
|
676
|
-
device: hass_device,
|
677
|
-
enabled_by_default: false,
|
678
|
-
max: 65_536,
|
679
|
-
min: 0,
|
680
|
-
name: "Position (Pulses)",
|
681
|
-
node_id: node_id,
|
682
|
-
object_id: "position-pulses",
|
683
|
-
state_topic: "#{@base_topic}/#{addr}/position-pulses",
|
684
|
-
step: 10,
|
685
|
-
unit_of_measurement: "pulses",
|
686
|
-
unique_id: "#{node_id}_position-pulses")
|
687
|
-
|
688
|
-
publish("#{addr}/position-percent/$name", "Position (in %)")
|
689
|
-
publish("#{addr}/position-percent/$datatype", "integer")
|
690
|
-
publish("#{addr}/position-percent/$format", "0:100")
|
691
|
-
publish("#{addr}/position-percent/$unit", "%")
|
692
|
-
publish("#{addr}/position-percent/$settable", "true")
|
693
|
-
|
694
|
-
publish("#{addr}/ip/$name", "Intermediate Position")
|
695
|
-
publish("#{addr}/ip/$datatype", "integer")
|
696
|
-
publish("#{addr}/ip/$format", "1:16")
|
697
|
-
publish("#{addr}/ip/$settable", "true")
|
698
|
-
|
699
|
-
@mqtt.publish_hass_number("ip",
|
700
|
-
command_topic: "#{@base_topic}/#{addr}/ip/set",
|
701
|
-
device: hass_device,
|
702
|
-
name: "Intermediate Position",
|
703
|
-
max: 16,
|
704
|
-
min: 0,
|
705
|
-
node_id: node_id,
|
706
|
-
object_id: "ip",
|
707
|
-
payload_reset: "",
|
708
|
-
state_topic: "#{@base_topic}/#{addr}/ip",
|
709
|
-
unique_id: "#{node_id}_ip")
|
771
|
+
if @homie
|
772
|
+
publish("#{addr}/position-percent/$name", "Position (in %)")
|
773
|
+
publish("#{addr}/position-percent/$datatype", "integer")
|
774
|
+
publish("#{addr}/position-percent/$format", "0:100")
|
775
|
+
publish("#{addr}/position-percent/$unit", "%")
|
776
|
+
publish("#{addr}/position-percent/$settable", "true")
|
777
|
+
|
778
|
+
publish("#{addr}/ip/$name", "Intermediate Position")
|
779
|
+
publish("#{addr}/ip/$datatype", "integer")
|
780
|
+
publish("#{addr}/ip/$format", "1:16")
|
781
|
+
publish("#{addr}/ip/$settable", "true")
|
782
|
+
end
|
710
783
|
|
711
|
-
|
712
|
-
|
713
|
-
|
784
|
+
if @home_assistant
|
785
|
+
@mqtt.publish_hass_number("ip",
|
786
|
+
command_topic: "#{@base_topic}/#{addr}/ip/set",
|
787
|
+
device: hass_device,
|
788
|
+
name: "Intermediate Position",
|
789
|
+
max: 16,
|
790
|
+
min: 0,
|
791
|
+
node_id: node_id,
|
792
|
+
object_id: "ip",
|
793
|
+
payload_reset: "",
|
794
|
+
state_topic: "#{@base_topic}/#{addr}/ip",
|
795
|
+
unique_id: "#{node_id}_ip")
|
796
|
+
end
|
797
|
+
|
798
|
+
if @homie
|
799
|
+
publish("#{addr}/state/$name", "State of the motors")
|
800
|
+
publish("#{addr}/state/$datatype", "enum")
|
801
|
+
publish("#{addr}/state/$format", "#{Message::PostMotorStatus::STATE.keys.join(",")},mixed")
|
714
802
|
|
715
|
-
|
716
|
-
|
717
|
-
|
803
|
+
publish("#{addr}/last-direction/$name", "Direction of last motion")
|
804
|
+
publish("#{addr}/last-direction/$datatype", "enum")
|
805
|
+
publish("#{addr}/last-direction/$format", "#{Message::PostMotorStatus::DIRECTION.keys.join(",")},mixed")
|
718
806
|
|
719
|
-
|
720
|
-
|
807
|
+
publish("#{addr}/motors/$name", "Comma separated motor addresses that are members of this group")
|
808
|
+
publish("#{addr}/motors/$datatype", "string")
|
809
|
+
end
|
721
810
|
|
722
811
|
group = @groups[addr] = Group.new(self, addr)
|
723
|
-
publish("$nodes", (["FFFFFF"] + @motors.keys.sort + @groups.keys.sort).join(","))
|
812
|
+
publish("$nodes", (["FFFFFF"] + @motors.keys.sort + @groups.keys.sort).join(",")) if @homie
|
724
813
|
end
|
725
814
|
group
|
726
815
|
end
|
data/lib/sdn/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: somfy_sdn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cody Cutrer
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date: 2025-
|
10
|
+
date: 2025-04-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: ccutrer-serialport
|
@@ -94,7 +93,6 @@ dependencies:
|
|
94
93
|
- - "~>"
|
95
94
|
- !ruby/object:Gem::Version
|
96
95
|
version: '13.0'
|
97
|
-
description:
|
98
96
|
email: cody@cutrer.com'
|
99
97
|
executables:
|
100
98
|
- somfy_sdn
|
@@ -130,7 +128,6 @@ licenses:
|
|
130
128
|
- MIT
|
131
129
|
metadata:
|
132
130
|
rubygems_mfa_required: 'true'
|
133
|
-
post_install_message:
|
134
131
|
rdoc_options: []
|
135
132
|
require_paths:
|
136
133
|
- lib
|
@@ -145,8 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
142
|
- !ruby/object:Gem::Version
|
146
143
|
version: '0'
|
147
144
|
requirements: []
|
148
|
-
rubygems_version: 3.
|
149
|
-
signing_key:
|
145
|
+
rubygems_version: 3.6.3
|
150
146
|
specification_version: 4
|
151
147
|
summary: Library for communication with Somfy SDN RS-485 motorized shades
|
152
148
|
test_files: []
|