-
Notifications
You must be signed in to change notification settings - Fork 0
/
fhem_plc881.cfg
73 lines (61 loc) · 2.55 KB
/
fhem_plc881.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
###############################################################################
# #
# fhem_plc881.cfg Wolfram Plettscher 07/2016 #
# included into fhem_main.cfg #
# #
# communicate with Wago 881 Test-PLC #
# #
###############################################################################
###############################################################################
### Wago 881 test system ###
###############################################################################
define Wago881 ModbusAttr 2 900 172.20.80.5:502 TCP
### holding registers - 16bit input / output
attr Wago881 obj-h768-reading testsps_data1
attr Wago881 obj-h768-set 1
attr Wago881 obj-c6400-reading testsps_trigger1
attr Wago881 obj-c6400-set 1
### discrete Bit inputs
#attr Wago881 obj-d0-reading input_test1
#attr Wago881 obj-d0-poll
#attr Wago881 obj-d0-showget 1
#attr Wago881 obj-d1-reading input_test2
#attr Wago881 obj-d1-poll
#attr Wago881 obj-d1-showget 1
#attr Wago881 obj-d512-reading coil1_r
#attr Wago881 obj-d512-poll
#attr Wago881 obj-d512-showget 1
#attr Wago881 obj-d513-reading coil2_r
#attr Wago881 obj-d513-poll
#attr Wago881 obj-d513-showget 1
#attr Wago881 dev-d-defPoll 1
attr Wago881 room SPS
### coils - Bit outputs
#attr Wago881 obj-c5120-reading coil1_w
#attr Wago881 obj-c5120-set 1
#attr Wago881 obj-c5121-reading coil2_w
#attr Wago881 obj-c5121-set 1
###############################################################################
### Dimmer __test to build Wago SPS Dimmer
define Dimmer__test dummy
attr Dimmer__test room Licht,Bad,SPS
attr Dimmer__test group Licht
attr Dimmer__test webCmd off:25:50:on
attr Dimmer__test eventMap /off:0/25:25/50:50/on:85/
attr Dimmer__test userattr plcflag
# react on Dimmer__test
# only transmit status to PLC, if PLC is not origin of change (plcflag)
define actOn_Dimmer__test_Val notify Dimmer__test.* {\
if (AttrVal ("Dimmer__test", "plcflag", "true") eq "true") { \
fhem (" \
attr Dimmer__test plcflag false \
") \
} else { \
fhem (" \
set Wago881 testsps_trigger1 0;; \
set Wago881 testsps_data1 $EVENT;; \
set Wago881 testsps_trigger1 1;; \
sleep 3;; set Wago881 testsps_trigger1 0;; \
") \
} \
}