Autor Thema: [GELÖST] Hilfe zu neuem Template dingtian Relayboard 8Chn+8Input  (Gelesen 1004 mal)

Offline rico5588

  • Full Member
  • ***
  • Beiträge: 220
Hallo,

ich benötige für o.g. Relay Board ein MQQT2 Template.
In diversen Beiträgen wurde schon diskutiert, aber noch keine Template zuende gebracht, womit man Relays schalten kann.
Oder ich hab es nicht gefunden 8)

Das hat es automatsich angelegt
defmod MQTT2_dingtian_relay4974 MQTT2_DEVICE dingtian_relay4974
attr MQTT2_dingtian_relay4974 readingList dingtian_relay4974:/dingtian/relay4974/out/lwt_availability:.* lwt_availability\
dingtian_relay4974:/dingtian/relay4974/out/r1:.* r1\
dingtian_relay4974:/dingtian/relay4974/out/r2:.* r2\
dingtian_relay4974:/dingtian/relay4974/out/r3:.* r3\
dingtian_relay4974:/dingtian/relay4974/out/r4:.* r4\
dingtian_relay4974:/dingtian/relay4974/out/r5:.* r5\
dingtian_relay4974:/dingtian/relay4974/out/r6:.* r6\
dingtian_relay4974:/dingtian/relay4974/out/r7:.* r7\
dingtian_relay4974:/dingtian/relay4974/out/r8:.* r8\
dingtian_relay4974:/dingtian/relay4974/out/i1:.* i1\
dingtian_relay4974:/dingtian/relay4974/out/i2:.* i2\
dingtian_relay4974:/dingtian/relay4974/out/i3:.* i3\
dingtian_relay4974:/dingtian/relay4974/out/i4:.* i4\
dingtian_relay4974:/dingtian/relay4974/out/i5:.* i5\
dingtian_relay4974:/dingtian/relay4974/out/i6:.* i6\
dingtian_relay4974:/dingtian/relay4974/out/i7:.* i7\
dingtian_relay4974:/dingtian/relay4974/out/i8:.* i8\
dingtian_relay4974:/dingtian/relay4974/out/relay1:.* { json2nameValue($EVENT) }\
dingtian_relay4974:/dingtian/relay4974/out/relay2:.* { json2nameValue($EVENT) }\
dingtian_relay4974:/dingtian/relay4974/out/relay3:.* { json2nameValue($EVENT) }\
dingtian_relay4974:/dingtian/relay4974/out/relay4:.* { json2nameValue($EVENT) }\
dingtian_relay4974:/dingtian/relay4974/out/relay5:.* { json2nameValue($EVENT) }\
dingtian_relay4974:/dingtian/relay4974/out/relay6:.* { json2nameValue($EVENT) }\
dingtian_relay4974:/dingtian/relay4974/out/relay7:.* { json2nameValue($EVENT) }\
dingtian_relay4974:/dingtian/relay4974/out/relay8:.* { json2nameValue($EVENT) }\
dingtian_relay4974:/dingtian/relay4974/out/input1:.* { json2nameValue($EVENT) }\
dingtian_relay4974:/dingtian/relay4974/out/input2:.* { json2nameValue($EVENT) }\
dingtian_relay4974:/dingtian/relay4974/out/input3:.* { json2nameValue($EVENT) }\
dingtian_relay4974:/dingtian/relay4974/out/input4:.* { json2nameValue($EVENT) }\
dingtian_relay4974:/dingtian/relay4974/out/input5:.* { json2nameValue($EVENT) }\
dingtian_relay4974:/dingtian/relay4974/out/input6:.* { json2nameValue($EVENT) }\
dingtian_relay4974:/dingtian/relay4974/out/input7:.* { json2nameValue($EVENT) }\
dingtian_relay4974:/dingtian/relay4974/out/input8:.* { json2nameValue($EVENT) }\
dingtian_relay4974:/dingtian/relay4974/out/ip:.* ip\
dingtian_relay4974:/dingtian/relay4974/out/sn:.* sn\
dingtian_relay4974:/dingtian/relay4974/out/mac:.* mac\
dingtian_relay4974:/dingtian/relay4974/out/input_cnt:.* input_cnt\
dingtian_relay4974:/dingtian/relay4974/out/relay_cnt:.* relay_cnt
attr MQTT2_dingtian_relay4974 room MQTT2_DEVICE

setstate MQTT2_dingtian_relay4974 2021-10-27 18:06:27 IODev myBroker
setstate MQTT2_dingtian_relay4974 2021-10-27 18:10:40 i1 OFF
setstate MQTT2_dingtian_relay4974 2021-10-27 18:10:40 i2 OFF
setstate MQTT2_dingtian_relay4974 2021-10-27 18:10:40 i3 OFF
setstate MQTT2_dingtian_relay4974 2021-10-27 18:10:40 i4 OFF
setstate MQTT2_dingtian_relay4974 2021-10-27 18:10:40 i5 OFF
setstate MQTT2_dingtian_relay4974 2021-10-27 18:10:40 i6 OFF
setstate MQTT2_dingtian_relay4974 2021-10-27 18:10:40 i7 OFF
setstate MQTT2_dingtian_relay4974 2021-10-27 18:10:40 i8 OFF
setstate MQTT2_dingtian_relay4974 2021-10-27 18:10:40 idx 8
setstate MQTT2_dingtian_relay4974 2021-10-27 18:10:40 input_cnt 8
setstate MQTT2_dingtian_relay4974 2021-10-27 18:10:40 ip 192.168.9.240
setstate MQTT2_dingtian_relay4974 2021-10-27 18:06:27 lwt_availability online
setstate MQTT2_dingtian_relay4974 2021-10-27 18:10:40 mac bc:34:88:00:12:bf
setstate MQTT2_dingtian_relay4974 2021-10-27 18:10:40 r1 ON
setstate MQTT2_dingtian_relay4974 2021-10-27 18:10:40 r2 OFF
setstate MQTT2_dingtian_relay4974 2021-10-27 18:10:40 r3 OFF
setstate MQTT2_dingtian_relay4974 2021-10-27 18:10:40 r4 OFF
setstate MQTT2_dingtian_relay4974 2021-10-27 18:10:40 r5 OFF
setstate MQTT2_dingtian_relay4974 2021-10-27 18:10:40 r6 OFF
setstate MQTT2_dingtian_relay4974 2021-10-27 18:10:40 r7 ON
setstate MQTT2_dingtian_relay4974 2021-10-27 18:10:40 r8 OFF
setstate MQTT2_dingtian_relay4974 2021-10-27 18:10:40 relay_cnt 8
setstate MQTT2_dingtian_relay4974 2021-10-27 18:10:40 sn 4974
setstate MQTT2_dingtian_relay4974 2021-10-27 18:10:40 status HIGH

Ich habe auch gelesen das mit Hilfe des MQTT2 Broker nützliches zu Tage kommen kann. Bitte um Tips wie man das nutzten kann.

MFG Rico
« Letzte Änderung: 30 Oktober 2021, 17:12:42 von rico5588 »
Geht nicht gibt's nicht.
NUC-I3+Proxmox, Fritzbox 7490, Synology DS414
Dimplex Wärmepumpe, Lüftungsanlage, Solarlog 1200
HM,IT,Lacross,EspEasy,und ein bissl Modbus,etc

Offline rudolfkoenig

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 24714
Antw:Hilfe zu neuem Template dingtian Relayboard 8Chn+8Input
« Antwort #1 am: 27 Oktober 2021, 20:09:31 »
Nach "attr m2s rawEvents" (ohne Anfuehrungszeichen) kann man alle MQTT publish Meldungen im Event-Monitor beobachten.
"list m2s" zeigt (auch) alle aktuellen Client-Verbindungen
"list <client-Verbindung>" zeigt die vom Client gesetzten Subscriptions (diese Daten werden an dem Client weitergeleitet) und weitere Infos wie Last-Will&Testament (lwt), ClientID (cid), Benutzer (usr), etc.

Offline Beta-User

  • Developer
  • Hero Member
  • ****
  • Beiträge: 16340
Antw:Hilfe zu neuem Template dingtian Relayboard 8Chn+8Input
« Antwort #2 am: 27 Oktober 2021, 20:21:11 »
Vorab: Vorbildliche Vorbereitung!

Ich schau's mir bei Gelegenheit an, meine aber, dass es bereits zwei "Relay-Board"-Typen geben müßte, die auch von der Struktur her teilweise ähnlich sind. Bitte diese beiden (oder mehreren) Templates mal raussuchen und auch die Threads dazu anschauen, die sollten nicht allzu lang sein.
Server: HP-T620@Debian 10, aktuelles FHEM + ConfigDB | CUL_HM (VCCU) | MQTT2: MiLight@ESP-GW, BT@OpenMQTTGw | MySensors: seriell, v.a. 2.3.1@RS485 | ZWave | ZigBee@deCONZ | SIGNALduino | MapleCUN | RHASSPY
svn:MySensors, Weekday-&RandomTimer, Twilight,  AttrTemplate {u.a. mqtt2, mysensors, zwave}

Offline Beta-User

  • Developer
  • Hero Member
  • ****
  • Beiträge: 16340
Antw:Hilfe zu neuem Template dingtian Relayboard 8Chn+8Input
« Antwort #3 am: 28 Oktober 2021, 22:39:07 »
Mit dem morgigen update kommt ein erster Versuch als attrTemplate 8channel_relay_board_8di_split.
Server: HP-T620@Debian 10, aktuelles FHEM + ConfigDB | CUL_HM (VCCU) | MQTT2: MiLight@ESP-GW, BT@OpenMQTTGw | MySensors: seriell, v.a. 2.3.1@RS485 | ZWave | ZigBee@deCONZ | SIGNALduino | MapleCUN | RHASSPY
svn:MySensors, Weekday-&RandomTimer, Twilight,  AttrTemplate {u.a. mqtt2, mysensors, zwave}

Offline rico5588

  • Full Member
  • ***
  • Beiträge: 220
Antw:Hilfe zu neuem Template dingtian Relayboard 8Chn+8Input
« Antwort #4 am: 29 Oktober 2021, 10:31:57 »
Hallo,

der erste Versuch sieht super aus...
Im 1. Device ist Relay 1 und die 8 Eingänge.
Wenn möglich bitte für das 1. Relay auch ein eigenes Device anlegen und aus dem 1. Device die Schaltfunktion von R1 raus nehemn.

Die 8 Eingänge funktionieren perfekt.
Kommt die Logic zum schalten der Relays durch die Eingänge vom Device/Template oder vom physischen Gerät?
Laut der WEB GUI des Gerätes ist immer der Eingang mit dem jeweiligen Relay verknüpft.
Eingang 1 off = Relay 1 off, Eingang 1 On = Relay 1 On....etc. siehe Foto.
Vermutlich gibt es noch ein paar Fehler im Device.

Eingang 1 schaltet R1+R7+R8
Eingang 2 ist i.o. -> Schaltet R2
Eingang 3 ist i.o. -> Schaltet R3
Eingang 4 ist i.o. -> Schaltet R4
Eingang 5 ist i.o.         "
Eingang 6 schaltet R6 aber ohne Statusänderung im Device
Eingang 7 schaltet R7 aber ohne Statusänderung im Device
Eingang 8 schaltet R6

die Device für R6, R7 und R8 schalten nicht richtig oder gar nicht.

anbei die RAW's der Device.
Relay1 + Eingänge
defmod MQTT2_dingtian_relay4974 MQTT2_DEVICE dingtian_relay4974
attr MQTT2_dingtian_relay4974 comment Channel 1 for MQTT2_dingtian_relay4974, see also MQTT2_dingtian_relay4974_CH2, MQTT2_dingtian_relay4974_CH3, MQTT2_dingtian_relay4974_CH4, MQTT2_dingtian_relay4974_CH5, MQTT2_dingtian_relay4974_CH6, MQTT2_dingtian_relay4974_CH7 and MQTT2_dingtian_relay4974_CH8
attr MQTT2_dingtian_relay4974 devStateIcon offline:rc_STOP@red online:rc_STOP@green
attr MQTT2_dingtian_relay4974 icon on
attr MQTT2_dingtian_relay4974 model 8channel_relay_board_8di_split
attr MQTT2_dingtian_relay4974 readingList /dingtian/relay4974/out/lwt_availability:.* LWT\
  /dingtian/relay4974/out/(relay|input)[1-8]:.* {}\
  /dingtian/relay4974/out/r1:.* { my $state = lc $EVENT;; return if ReadingsVal($NAME,'state','unknown') eq $state;; {state=>$state} }\
  /dingtian/relay4974/out/i1:.* {my $state = lc $EVENT;; return if ReadingsVal($NAME,'di1','unknown') eq $state;; {di1=>$state}}\
  /dingtian/relay4974/out/i2:.* {my $state = lc $EVENT;; return if ReadingsVal($NAME,'di2','unknown') eq $state;; {di2=>$state}}\
  /dingtian/relay4974/out/i3:.* {my $state = lc $EVENT;; return if ReadingsVal($NAME,'di3','unknown') eq $state;; {di3=>$state}}\
  /dingtian/relay4974/out/i4:.* {my $state = lc $EVENT;; return if ReadingsVal($NAME,'di4','unknown') eq $state;; {di4=>$state}}\
  /dingtian/relay4974/out/i5:.* {my $state = lc $EVENT;; return if ReadingsVal($NAME,'di5','unknown') eq $state;; {di5=>$state}}\
  /dingtian/relay4974/out/i6:.* {my $state = lc $EVENT;; return if ReadingsVal($NAME,'di6','unknown') eq $state;; {di6=>$state}}\
  /dingtian/relay4974/out/i7:.* {my $state = lc $EVENT;; return if ReadingsVal($NAME,'di7','unknown') eq $state;; {di7=>$state}}\
  /dingtian/relay4974/out/i8:.* {my $state = lc $EVENT;; return if ReadingsVal($NAME,'di8','unknown') eq $state;; {di8=>$state}}\
  /dingtian/relay4974/out/ip:.* ip\
  /dingtian/relay4974/out/sn:.* sn\
  /dingtian/relay4974/out/mac:.* mac\
  /dingtian/relay4974/out/dicnt:.* dicnt\
  /dingtian/relay4974/out/relay_cnt:.* relay_cnt\
dingtian_relay4974:/dingtian/relay4974/out/r6:.* r6\
dingtian_relay4974:/dingtian/relay4974/out/r7:.* r7\
dingtian_relay4974:/dingtian/relay4974/out/input_cnt:.* input_cnt
attr MQTT2_dingtian_relay4974 room MQTT2_DEVICE
attr MQTT2_dingtian_relay4974 setExtensionsEvent 1
attr MQTT2_dingtian_relay4974 setList on:noArg /dingtian/relay4974/in/r1 ON\
  off:noArg /dingtian/relay4974/in/r1 OFF
attr MQTT2_dingtian_relay4974 stateFormat LWT\
state\
<br>\
DigiIn\
di1\
di2\
di3\
di4\
di5\
di6\
di7\
di8
attr MQTT2_dingtian_relay4974 webCmd :

setstate MQTT2_dingtian_relay4974 LWT\
off\
<br>\
DigiIn\
off\
off\
off\
off\
off\
off\
off\
off
setstate MQTT2_dingtian_relay4974 2021-10-29 09:48:46 IODev myBroker
setstate MQTT2_dingtian_relay4974 2021-10-29 09:51:55 associatedWith MQTT2_dingtian_relay4974_CH1,MQTT2_dingtian_relay4974_CH2,MQTT2_dingtian_relay4974_CH3,MQTT2_dingtian_relay4974_CH4,MQTT2_dingtian_relay4974_CH5,MQTT2_dingtian_relay4974_CH6,MQTT2_dingtian_relay4974_CH7,MQTT2_dingtian_relay4974_CH8
setstate MQTT2_dingtian_relay4974 2021-10-29 09:51:55 attrTemplateVersion 20211028
setstate MQTT2_dingtian_relay4974 2021-10-29 10:10:56 di1 off
setstate MQTT2_dingtian_relay4974 2021-10-29 10:04:21 di2 off
setstate MQTT2_dingtian_relay4974 2021-10-29 10:04:43 di3 off
setstate MQTT2_dingtian_relay4974 2021-10-29 10:04:58 di4 off
setstate MQTT2_dingtian_relay4974 2021-10-29 10:05:12 di5 off
setstate MQTT2_dingtian_relay4974 2021-10-29 10:09:16 di6 off
setstate MQTT2_dingtian_relay4974 2021-10-29 10:09:38 di7 off
setstate MQTT2_dingtian_relay4974 2021-10-29 10:11:19 di8 off
setstate MQTT2_dingtian_relay4974 2021-10-29 10:16:16 input_cnt 8
setstate MQTT2_dingtian_relay4974 2021-10-29 10:16:16 ip 192.168.9.240
setstate MQTT2_dingtian_relay4974 2021-10-29 10:16:16 mac bc:34:88:00:12:bf
setstate MQTT2_dingtian_relay4974 2021-10-29 10:16:16 r6 OFF
setstate MQTT2_dingtian_relay4974 2021-10-29 10:16:16 r7 ON
setstate MQTT2_dingtian_relay4974 2021-10-29 10:16:16 relay_cnt 8
setstate MQTT2_dingtian_relay4974 2021-10-29 10:16:16 sn 4974
setstate MQTT2_dingtian_relay4974 2021-10-29 10:14:30 state off

Relay 2
defmod MQTT2_dingtian_relay4974_CH2 MQTT2_DEVICE dingtian_relay4974
attr MQTT2_dingtian_relay4974_CH2 comment Channel 2 for MQTT2_dingtian_relay4974, see also MQTT2_dingtian_relay4974, MQTT2_dingtian_relay4974_CH3, MQTT2_dingtian_relay4974_CH4, MQTT2_dingtian_relay4974_CH5, MQTT2_dingtian_relay4974_CH6, MQTT2_dingtian_relay4974_CH7 and MQTT2_dingtian_relay4974_CH8
attr MQTT2_dingtian_relay4974_CH2 icon on
attr MQTT2_dingtian_relay4974_CH2 model 8channel_relay_board_8di_split
attr MQTT2_dingtian_relay4974_CH2 readingList /dingtian/relay4974/out/r2:.* { my $state = lc $EVENT;; return if ReadingsVal($NAME,'state','unknown') eq $state;; {state=>$state} }\
dingtian_relay4974:/dingtian/relay4974/out/r6:.* r6\
dingtian_relay4974:/dingtian/relay4974/out/r7:.* r7\
dingtian_relay4974:/dingtian/relay4974/out/input_cnt:.* input_cnt
attr MQTT2_dingtian_relay4974_CH2 room MQTT2_DEVICE
attr MQTT2_dingtian_relay4974_CH2 setExtensionsEvent 1
attr MQTT2_dingtian_relay4974_CH2 setList on:noArg /dingtian/relay4974/in/r2 ON\
  off:noArg /dingtian/relay4974/in/r2 OFF
attr MQTT2_dingtian_relay4974_CH2 webCmd :

setstate MQTT2_dingtian_relay4974_CH2 off
setstate MQTT2_dingtian_relay4974_CH2 2021-10-29 09:51:55 IODev myBroker
setstate MQTT2_dingtian_relay4974_CH2 2021-10-29 09:51:55 associatedWith MQTT2_dingtian_relay4974,MQTT2_dingtian_relay4974_CH1,MQTT2_dingtian_relay4974_CH3,MQTT2_dingtian_relay4974_CH4,MQTT2_dingtian_relay4974_CH5,MQTT2_dingtian_relay4974_CH6,MQTT2_dingtian_relay4974_CH7,MQTT2_dingtian_relay4974_CH8
setstate MQTT2_dingtian_relay4974_CH2 2021-10-29 09:51:55 attrTemplateVersion 20211028
setstate MQTT2_dingtian_relay4974_CH2 2021-10-29 10:16:46 input_cnt 8
setstate MQTT2_dingtian_relay4974_CH2 2021-10-29 10:16:46 r6 OFF
setstate MQTT2_dingtian_relay4974_CH2 2021-10-29 10:16:46 r7 ON
setstate MQTT2_dingtian_relay4974_CH2 2021-10-29 10:14:38 state off

Relay3
defmod MQTT2_dingtian_relay4974_CH3 MQTT2_DEVICE dingtian_relay4974
attr MQTT2_dingtian_relay4974_CH3 comment Channel 3 for MQTT2_dingtian_relay4974, see also MQTT2_dingtian_relay4974, MQTT2_dingtian_relay4974_CH2, MQTT2_dingtian_relay4974_CH4, MQTT2_dingtian_relay4974_CH5, MQTT2_dingtian_relay4974_CH6, MQTT2_dingtian_relay4974_CH7 and MQTT2_dingtian_relay4974_CH8
attr MQTT2_dingtian_relay4974_CH3 icon on
attr MQTT2_dingtian_relay4974_CH3 model 8channel_relay_board_8di_split
attr MQTT2_dingtian_relay4974_CH3 readingList /dingtian/relay4974/out/r3:.* { my $state = lc $EVENT;; return if ReadingsVal($NAME,'state','unknown') eq $state;; {state=>$state} }\
dingtian_relay4974:/dingtian/relay4974/out/r6:.* r6\
dingtian_relay4974:/dingtian/relay4974/out/r7:.* r7\
dingtian_relay4974:/dingtian/relay4974/out/input_cnt:.* input_cnt
attr MQTT2_dingtian_relay4974_CH3 room MQTT2_DEVICE
attr MQTT2_dingtian_relay4974_CH3 setExtensionsEvent 1
attr MQTT2_dingtian_relay4974_CH3 setList on:noArg /dingtian/relay4974/in/r3 ON\
  off:noArg /dingtian/relay4974/in/r3 OFF
attr MQTT2_dingtian_relay4974_CH3 webCmd :

setstate MQTT2_dingtian_relay4974_CH3 off
setstate MQTT2_dingtian_relay4974_CH3 2021-10-29 09:51:55 IODev myBroker
setstate MQTT2_dingtian_relay4974_CH3 2021-10-29 09:51:55 associatedWith MQTT2_dingtian_relay4974,MQTT2_dingtian_relay4974_CH1,MQTT2_dingtian_relay4974_CH2,MQTT2_dingtian_relay4974_CH4,MQTT2_dingtian_relay4974_CH5,MQTT2_dingtian_relay4974_CH6,MQTT2_dingtian_relay4974_CH7,MQTT2_dingtian_relay4974_CH8
setstate MQTT2_dingtian_relay4974_CH3 2021-10-29 09:51:55 attrTemplateVersion 20211028
setstate MQTT2_dingtian_relay4974_CH3 2021-10-29 10:18:46 input_cnt 8
setstate MQTT2_dingtian_relay4974_CH3 2021-10-29 10:18:46 r6 OFF
setstate MQTT2_dingtian_relay4974_CH3 2021-10-29 10:18:46 r7 ON
setstate MQTT2_dingtian_relay4974_CH3 2021-10-29 10:14:40 state off

Relay 4
defmod MQTT2_dingtian_relay4974_CH4 MQTT2_DEVICE dingtian_relay4974
attr MQTT2_dingtian_relay4974_CH4 comment Channel 4 for MQTT2_dingtian_relay4974, see also MQTT2_dingtian_relay4974, MQTT2_dingtian_relay4974_CH2, MQTT2_dingtian_relay4974_CH3, MQTT2_dingtian_relay4974_CH5, MQTT2_dingtian_relay4974_CH6, MQTT2_dingtian_relay4974_CH7 and MQTT2_dingtian_relay4974_CH8
attr MQTT2_dingtian_relay4974_CH4 icon on
attr MQTT2_dingtian_relay4974_CH4 model 8channel_relay_board_8di_split
attr MQTT2_dingtian_relay4974_CH4 readingList /dingtian/relay4974/out/r4:.* { my $state = lc $EVENT;; return if ReadingsVal($NAME,'state','unknown') eq $state;; {state=>$state} }\
dingtian_relay4974:/dingtian/relay4974/out/r6:.* r6\
dingtian_relay4974:/dingtian/relay4974/out/r7:.* r7\
dingtian_relay4974:/dingtian/relay4974/out/input_cnt:.* input_cnt
attr MQTT2_dingtian_relay4974_CH4 room MQTT2_DEVICE
attr MQTT2_dingtian_relay4974_CH4 setExtensionsEvent 1
attr MQTT2_dingtian_relay4974_CH4 setList on:noArg /dingtian/relay4974/in/r4 ON\
  off:noArg /dingtian/relay4974/in/r4 OFF
attr MQTT2_dingtian_relay4974_CH4 webCmd :

setstate MQTT2_dingtian_relay4974_CH4 off
setstate MQTT2_dingtian_relay4974_CH4 2021-10-29 09:51:55 IODev myBroker
setstate MQTT2_dingtian_relay4974_CH4 2021-10-29 09:51:55 associatedWith MQTT2_dingtian_relay4974,MQTT2_dingtian_relay4974_CH1,MQTT2_dingtian_relay4974_CH2,MQTT2_dingtian_relay4974_CH3,MQTT2_dingtian_relay4974_CH5,MQTT2_dingtian_relay4974_CH6,MQTT2_dingtian_relay4974_CH7,MQTT2_dingtian_relay4974_CH8
setstate MQTT2_dingtian_relay4974_CH4 2021-10-29 09:51:55 attrTemplateVersion 20211028
setstate MQTT2_dingtian_relay4974_CH4 2021-10-29 10:19:16 input_cnt 8
setstate MQTT2_dingtian_relay4974_CH4 2021-10-29 10:19:16 r6 OFF
setstate MQTT2_dingtian_relay4974_CH4 2021-10-29 10:19:16 r7 ON
setstate MQTT2_dingtian_relay4974_CH4 2021-10-29 10:14:41 state off

Relay 5
defmod MQTT2_dingtian_relay4974_CH5 MQTT2_DEVICE dingtian_relay4974
attr MQTT2_dingtian_relay4974_CH5 comment Channel 5 for MQTT2_dingtian_relay4974, see also MQTT2_dingtian_relay4974, MQTT2_dingtian_relay4974_CH2, MQTT2_dingtian_relay4974_CH3, MQTT2_dingtian_relay4974_CH4, MQTT2_dingtian_relay4974_CH6, MQTT2_dingtian_relay4974_CH7 and MQTT2_dingtian_relay4974_CH8
attr MQTT2_dingtian_relay4974_CH5 icon on
attr MQTT2_dingtian_relay4974_CH5 model 8channel_relay_board_8di_split
attr MQTT2_dingtian_relay4974_CH5 readingList /dingtian/relay4974/out/r5:.* { my $state = lc $EVENT;; return if ReadingsVal($NAME,'state','unknown') eq $state;; {state=>$state} }\
dingtian_relay4974:/dingtian/relay4974/out/r6:.* r6\
dingtian_relay4974:/dingtian/relay4974/out/r7:.* r7\
dingtian_relay4974:/dingtian/relay4974/out/input_cnt:.* input_cnt
attr MQTT2_dingtian_relay4974_CH5 room MQTT2_DEVICE
attr MQTT2_dingtian_relay4974_CH5 setExtensionsEvent 1
attr MQTT2_dingtian_relay4974_CH5 setList on:noArg /dingtian/relay4974/in/r5 ON\
  off:noArg /dingtian/relay4974/in/r5 OFF
attr MQTT2_dingtian_relay4974_CH5 webCmd :

setstate MQTT2_dingtian_relay4974_CH5 off
setstate MQTT2_dingtian_relay4974_CH5 2021-10-29 09:51:55 IODev myBroker
setstate MQTT2_dingtian_relay4974_CH5 2021-10-29 09:51:55 associatedWith MQTT2_dingtian_relay4974,MQTT2_dingtian_relay4974_CH1,MQTT2_dingtian_relay4974_CH2,MQTT2_dingtian_relay4974_CH3,MQTT2_dingtian_relay4974_CH4,MQTT2_dingtian_relay4974_CH6,MQTT2_dingtian_relay4974_CH7,MQTT2_dingtian_relay4974_CH8
setstate MQTT2_dingtian_relay4974_CH5 2021-10-29 09:51:55 attrTemplateVersion 20211028
setstate MQTT2_dingtian_relay4974_CH5 2021-10-29 10:19:46 input_cnt 8
setstate MQTT2_dingtian_relay4974_CH5 2021-10-29 10:19:46 r6 OFF
setstate MQTT2_dingtian_relay4974_CH5 2021-10-29 10:19:46 r7 ON
setstate MQTT2_dingtian_relay4974_CH5 2021-10-29 10:14:42 state off

Relay 6
defmod MQTT2_dingtian_relay4974_CH6 MQTT2_DEVICE dingtian_relay4974
attr MQTT2_dingtian_relay4974_CH6 comment Channel 6 for MQTT2_dingtian_relay4974, see also MQTT2_dingtian_relay4974, MQTT2_dingtian_relay4974_CH2, MQTT2_dingtian_relay4974_CH3, MQTT2_dingtian_relay4974_CH4, MQTT2_dingtian_relay4974_CH5, MQTT2_dingtian_relay4974_CH7 and MQTT2_dingtian_relay4974_CH8
attr MQTT2_dingtian_relay4974_CH6 icon on
attr MQTT2_dingtian_relay4974_CH6 model 8channel_relay_board_8di_split
attr MQTT2_dingtian_relay4974_CH6 readingList /dingtian/relay4974/out/r8:.* { my $state = lc $EVENT;; return if ReadingsVal($NAME,'state','unknown') eq $state;; {state=>$state} }\
dingtian_relay4974:/dingtian/relay4974/out/r6:.* r6\
dingtian_relay4974:/dingtian/relay4974/out/r7:.* r7\
dingtian_relay4974:/dingtian/relay4974/out/input_cnt:.* input_cnt
attr MQTT2_dingtian_relay4974_CH6 room MQTT2_DEVICE
attr MQTT2_dingtian_relay4974_CH6 setExtensionsEvent 1
attr MQTT2_dingtian_relay4974_CH6 setList on:noArg /dingtian/relay4974/in/r6 ON\
  off:noArg /dingtian/relay4974/in/r6 OFF
attr MQTT2_dingtian_relay4974_CH6 webCmd :

setstate MQTT2_dingtian_relay4974_CH6 off
setstate MQTT2_dingtian_relay4974_CH6 2021-10-29 09:51:55 IODev myBroker
setstate MQTT2_dingtian_relay4974_CH6 2021-10-29 09:51:55 associatedWith MQTT2_dingtian_relay4974,MQTT2_dingtian_relay4974_CH1,MQTT2_dingtian_relay4974_CH2,MQTT2_dingtian_relay4974_CH3,MQTT2_dingtian_relay4974_CH4,MQTT2_dingtian_relay4974_CH5,MQTT2_dingtian_relay4974_CH7,MQTT2_dingtian_relay4974_CH8
setstate MQTT2_dingtian_relay4974_CH6 2021-10-29 09:51:55 attrTemplateVersion 20211028
setstate MQTT2_dingtian_relay4974_CH6 2021-10-29 10:20:16 input_cnt 8
setstate MQTT2_dingtian_relay4974_CH6 2021-10-29 10:20:16 r6 OFF
setstate MQTT2_dingtian_relay4974_CH6 2021-10-29 10:20:16 r7 ON
setstate MQTT2_dingtian_relay4974_CH6 2021-10-29 10:14:50 state off

Relay 7
defmod MQTT2_dingtian_relay4974_CH7 MQTT2_DEVICE dingtian_relay4974
attr MQTT2_dingtian_relay4974_CH7 comment Channel 7 for MQTT2_dingtian_relay4974, see also MQTT2_dingtian_relay4974, MQTT2_dingtian_relay4974_CH2, MQTT2_dingtian_relay4974_CH3, MQTT2_dingtian_relay4974_CH4, MQTT2_dingtian_relay4974_CH5, MQTT2_dingtian_relay4974_CH6, and MQTT2_dingtian_relay4974_CH8
attr MQTT2_dingtian_relay4974_CH7 icon on
attr MQTT2_dingtian_relay4974_CH7 model 8channel_relay_board_8di_split
attr MQTT2_dingtian_relay4974_CH7 readingList /dingtian/relay4974/out/lwt_availability:.* LWT\
  /dingtian/relay4974/out/(relay|input)[1-8]:.* {}\
  /dingtian/relay4974/out/r1:.* { my $state = lc $EVENT;; return if ReadingsVal($NAME,'state','unknown') eq $state;; {state=>$state} }\
  /dingtian/relay4974/out/i1:.* {my $state = lc $EVENT;; return if ReadingsVal($NAME,'di1','unknown') eq $state;; {di1=>$state}}\
  /dingtian/relay4974/out/i2:.* {my $state = lc $EVENT;; return if ReadingsVal($NAME,'di2','unknown') eq $state;; {di2=>$state}}\
  /dingtian/relay4974/out/i3:.* {my $state = lc $EVENT;; return if ReadingsVal($NAME,'di3','unknown') eq $state;; {di3=>$state}}\
  /dingtian/relay4974/out/i4:.* {my $state = lc $EVENT;; return if ReadingsVal($NAME,'di4','unknown') eq $state;; {di4=>$state}}\
  /dingtian/relay4974/out/i5:.* {my $state = lc $EVENT;; return if ReadingsVal($NAME,'di5','unknown') eq $state;; {di5=>$state}}\
  /dingtian/relay4974/out/i6:.* {my $state = lc $EVENT;; return if ReadingsVal($NAME,'di6','unknown') eq $state;; {di6=>$state}}\
  /dingtian/relay4974/out/i7:.* {my $state = lc $EVENT;; return if ReadingsVal($NAME,'di7','unknown') eq $state;; {di7=>$state}}\
  /dingtian/relay4974/out/i8:.* {my $state = lc $EVENT;; return if ReadingsVal($NAME,'di8','unknown') eq $state;; {di8=>$state}}\
  /dingtian/relay4974/out/ip:.* ip\
  /dingtian/relay4974/out/sn:.* sn\
  /dingtian/relay4974/out/mac:.* mac\
  /dingtian/relay4974/out/dicnt:.* dicnt\
  /dingtian/relay4974/out/relay_cnt:.* relay_cnt\
dingtian_relay4974:/dingtian/relay4974/out/r6:.* r6\
dingtian_relay4974:/dingtian/relay4974/out/r7:.* r7\
dingtian_relay4974:/dingtian/relay4974/out/input_cnt:.* input_cnt
attr MQTT2_dingtian_relay4974_CH7 room MQTT2_DEVICE
attr MQTT2_dingtian_relay4974_CH7 setExtensionsEvent 1
attr MQTT2_dingtian_relay4974_CH7 setList on:noArg /dingtian/relay4974/in/r7 ON\
  off:noArg /dingtian/relay4974/in/r7 OFF
attr MQTT2_dingtian_relay4974_CH7 webCmd :

setstate MQTT2_dingtian_relay4974_CH7 off
setstate MQTT2_dingtian_relay4974_CH7 2021-10-29 09:51:55 IODev myBroker
setstate MQTT2_dingtian_relay4974_CH7 2021-10-29 09:51:55 associatedWith MQTT2_dingtian_relay4974,MQTT2_dingtian_relay4974_CH1,MQTT2_dingtian_relay4974_CH2,MQTT2_dingtian_relay4974_CH3,MQTT2_dingtian_relay4974_CH4,MQTT2_dingtian_relay4974_CH5,MQTT2_dingtian_relay4974_CH6,MQTT2_dingtian_relay4974_CH8
setstate MQTT2_dingtian_relay4974_CH7 2021-10-29 09:51:55 attrTemplateVersion 20211028
setstate MQTT2_dingtian_relay4974_CH7 2021-10-29 10:10:56 di1 off
setstate MQTT2_dingtian_relay4974_CH7 2021-10-29 10:04:21 di2 off
setstate MQTT2_dingtian_relay4974_CH7 2021-10-29 10:04:43 di3 off
setstate MQTT2_dingtian_relay4974_CH7 2021-10-29 10:04:58 di4 off
setstate MQTT2_dingtian_relay4974_CH7 2021-10-29 10:05:12 di5 off
setstate MQTT2_dingtian_relay4974_CH7 2021-10-29 10:09:16 di6 off
setstate MQTT2_dingtian_relay4974_CH7 2021-10-29 10:09:38 di7 off
setstate MQTT2_dingtian_relay4974_CH7 2021-10-29 10:11:19 di8 off
setstate MQTT2_dingtian_relay4974_CH7 2021-10-29 10:20:16 input_cnt 8
setstate MQTT2_dingtian_relay4974_CH7 2021-10-29 10:20:16 ip 192.168.9.240
setstate MQTT2_dingtian_relay4974_CH7 2021-10-29 10:20:16 mac bc:34:88:00:12:bf
setstate MQTT2_dingtian_relay4974_CH7 2021-10-29 10:20:16 r6 OFF
setstate MQTT2_dingtian_relay4974_CH7 2021-10-29 10:20:16 r7 ON
setstate MQTT2_dingtian_relay4974_CH7 2021-10-29 10:20:16 relay_cnt 8
setstate MQTT2_dingtian_relay4974_CH7 2021-10-29 10:20:16 sn 4974
setstate MQTT2_dingtian_relay4974_CH7 2021-10-29 10:14:46 state off

Relay8
defmod MQTT2_dingtian_relay4974_CH8 MQTT2_DEVICE dingtian_relay4974
attr MQTT2_dingtian_relay4974_CH8 comment Channel 8 for MQTT2_dingtian_relay4974, see also MQTT2_dingtian_relay4974, MQTT2_dingtian_relay4974_CH2, MQTT2_dingtian_relay4974_CH3, MQTT2_dingtian_relay4974_CH4, MQTT2_dingtian_relay4974_CH5, MQTT2_dingtian_relay4974_CH6 and MQTT2_dingtian_relay4974_CH7
attr MQTT2_dingtian_relay4974_CH8 icon on
attr MQTT2_dingtian_relay4974_CH8 model 8channel_relay_board_8di_split
attr MQTT2_dingtian_relay4974_CH8 readingList /dingtian/relay4974/out/lwt_availability:.* LWT\
  /dingtian/relay4974/out/(relay|input)[1-8]:.* {}\
  /dingtian/relay4974/out/r1:.* { my $state = lc $EVENT;; return if ReadingsVal($NAME,'state','unknown') eq $state;; {state=>$state} }\
  /dingtian/relay4974/out/i1:.* {my $state = lc $EVENT;; return if ReadingsVal($NAME,'di1','unknown') eq $state;; {di1=>$state}}\
  /dingtian/relay4974/out/i2:.* {my $state = lc $EVENT;; return if ReadingsVal($NAME,'di2','unknown') eq $state;; {di2=>$state}}\
  /dingtian/relay4974/out/i3:.* {my $state = lc $EVENT;; return if ReadingsVal($NAME,'di3','unknown') eq $state;; {di3=>$state}}\
  /dingtian/relay4974/out/i4:.* {my $state = lc $EVENT;; return if ReadingsVal($NAME,'di4','unknown') eq $state;; {di4=>$state}}\
  /dingtian/relay4974/out/i5:.* {my $state = lc $EVENT;; return if ReadingsVal($NAME,'di5','unknown') eq $state;; {di5=>$state}}\
  /dingtian/relay4974/out/i6:.* {my $state = lc $EVENT;; return if ReadingsVal($NAME,'di6','unknown') eq $state;; {di6=>$state}}\
  /dingtian/relay4974/out/i7:.* {my $state = lc $EVENT;; return if ReadingsVal($NAME,'di7','unknown') eq $state;; {di7=>$state}}\
  /dingtian/relay4974/out/i8:.* {my $state = lc $EVENT;; return if ReadingsVal($NAME,'di8','unknown') eq $state;; {di8=>$state}}\
  /dingtian/relay4974/out/ip:.* ip\
  /dingtian/relay4974/out/sn:.* sn\
  /dingtian/relay4974/out/mac:.* mac\
  /dingtian/relay4974/out/dicnt:.* dicnt\
  /dingtian/relay4974/out/relay_cnt:.* relay_cnt\
dingtian_relay4974:/dingtian/relay4974/out/r6:.* r6\
dingtian_relay4974:/dingtian/relay4974/out/r7:.* r7\
dingtian_relay4974:/dingtian/relay4974/out/input_cnt:.* input_cnt
attr MQTT2_dingtian_relay4974_CH8 room MQTT2_DEVICE
attr MQTT2_dingtian_relay4974_CH8 setExtensionsEvent 1
attr MQTT2_dingtian_relay4974_CH8 setList on:noArg /dingtian/relay4974/in/r8 ON\
  off:noArg /dingtian/relay4974/in/r8 OFF
attr MQTT2_dingtian_relay4974_CH8 webCmd :

setstate MQTT2_dingtian_relay4974_CH8 off
setstate MQTT2_dingtian_relay4974_CH8 2021-10-29 09:51:55 IODev myBroker
setstate MQTT2_dingtian_relay4974_CH8 2021-10-29 09:51:55 associatedWith MQTT2_dingtian_relay4974,MQTT2_dingtian_relay4974_CH1,MQTT2_dingtian_relay4974_CH2,MQTT2_dingtian_relay4974_CH3,MQTT2_dingtian_relay4974_CH4,MQTT2_dingtian_relay4974_CH5,MQTT2_dingtian_relay4974_CH6,MQTT2_dingtian_relay4974_CH7
setstate MQTT2_dingtian_relay4974_CH8 2021-10-29 09:51:55 attrTemplateVersion 20211028
setstate MQTT2_dingtian_relay4974_CH8 2021-10-29 10:10:56 di1 off
setstate MQTT2_dingtian_relay4974_CH8 2021-10-29 10:04:21 di2 off
setstate MQTT2_dingtian_relay4974_CH8 2021-10-29 10:04:43 di3 off
setstate MQTT2_dingtian_relay4974_CH8 2021-10-29 10:04:58 di4 off
setstate MQTT2_dingtian_relay4974_CH8 2021-10-29 10:05:12 di5 off
setstate MQTT2_dingtian_relay4974_CH8 2021-10-29 10:09:16 di6 off
setstate MQTT2_dingtian_relay4974_CH8 2021-10-29 10:09:38 di7 off
setstate MQTT2_dingtian_relay4974_CH8 2021-10-29 10:11:19 di8 off
setstate MQTT2_dingtian_relay4974_CH8 2021-10-29 10:20:46 input_cnt 8
setstate MQTT2_dingtian_relay4974_CH8 2021-10-29 10:20:46 ip 192.168.9.240
setstate MQTT2_dingtian_relay4974_CH8 2021-10-29 10:20:46 mac bc:34:88:00:12:bf
setstate MQTT2_dingtian_relay4974_CH8 2021-10-29 10:20:46 r6 OFF
setstate MQTT2_dingtian_relay4974_CH8 2021-10-29 10:20:46 r7 ON
setstate MQTT2_dingtian_relay4974_CH8 2021-10-29 10:20:46 relay_cnt 8
setstate MQTT2_dingtian_relay4974_CH8 2021-10-29 10:20:46 sn 4974
setstate MQTT2_dingtian_relay4974_CH8 2021-10-29 10:14:50 state off


Danke vorab schonmal für das Template. Rico
Geht nicht gibt's nicht.
NUC-I3+Proxmox, Fritzbox 7490, Synology DS414
Dimplex Wärmepumpe, Lüftungsanlage, Solarlog 1200
HM,IT,Lacross,EspEasy,und ein bissl Modbus,etc

Offline herrmannj

  • Global Moderator
  • Hero Member
  • ****
  • Beiträge: 6009
Antw:Hilfe zu neuem Template dingtian Relayboard 8Chn+8Input
« Antwort #5 am: 29 Oktober 2021, 10:57:10 »
Interessehalber: hast du Mal einen Link zu so einer Platine? Danke
smartVisu mit fronthem, einiges an HM, RFXTRX, Oregon, CUL, Homeeasy, ganz viele LED + Diverse

Offline Beta-User

  • Developer
  • Hero Member
  • ****
  • Beiträge: 16340
Antw:Hilfe zu neuem Template dingtian Relayboard 8Chn+8Input
« Antwort #6 am: 29 Oktober 2021, 11:15:01 »
Danke erst mal für die Rückmeldung!

Ursache für manche Kleinigkeiten ist der "copy"-Befehl.

@Rudi: Evtl. würde es helfen, wenn man einen einfachen defmod nach dem copy ausführen könnte, um v.a. die CID "loszuwerden". Sonst muss man eine "manuelle Kopie" anfertigen...
(Ok, geklärt, man kann auch einfach was phantastisches angeben...)

Was die Zuordnung der Input/Relay-Geschichte angeht, ist es m.E. dann sinnvoll, die jeweiligen Inputs und Relays in einem Device zusammenzufassen. Dann kann man auch feststellen, ob eine Schaltung von FHEM aus erfolgt ist oder durch lokale Bedienung. Das insgesamt in (9 oder) 16 Devices zu trennen ist m.E. nicht sinnvoll.
Mehr wie die passende Abbildung des "defaults" (also Zuordnung der Relays zum jeweiligen Input) wird man über attrTemplate dann nicht hinbekommen, wer das anders haben will, muss dann selbst ran, sollte dann aber (in dem template) eine Grundlage haben, wie man das machen kann.

Eine Erklärung für die diversen "Schaltirrläufer" habe ich auf die Schnelle nicht anzubieten, da ist entweder auf der Platine was faul oder es ist einfach eine Falschanzeige in FHEM wegen der CID-Problematik (die Erweiterungen der readingList mit "dingtian_relay4974:" kommen da her).

EDIT:
Da war noch ein c/p-Fehler drin wg. R7/8. So sollte es klappen (Du kannst die Datei mqtt2.template selbst editieren und dann {AttrTemplate_Initialize()} ausführen. Update im svn folgt bei Gelegenheit).
###############
#dingtian 8ch relay board
#
#specials: event-on-change-reading and timestamp-on-change-reading via Perl...
#
# input by rico5588, see forum https://forum.fhem.de/index.php/topic,123709.msg1182787.html#msg1182787
name:8channel_relay_board_8di_split
filter:TYPE=MQTT2_DEVICE
desc:For use with dingtian 8-ch digital Input and 8-ch relay output ethernet board.<br>NOTE: First experimental version, for configuration and to contribute see <a href="https://forum.fhem.de/index.php/topic,123709.msg1182787.html#msg1182787">Forum Thread</a>. You have to configure MQTT first as described in product manual.<br>Split version - you'll get 8 independent devices.
order:W_05
par:DEVNAME;Device's name in the topic tree;{ AttrVal('DEVICE','readingList','') =~ m,dingtian/([^/]+)/, ? $1 : undef }
par:ICON;ICON as set, defaults to on;{ AttrVal('DEVICE','icon','on') }
attr DEVICE icon ICON
deletereading -q DEVICE (?!associatedWith|IODev).*
attr DEVICE readingList /dingtian/DEVNAME/out/lwt_availability:.* LWT\
  /dingtian/DEVNAME/out/(relay|input)[1-8]:.* {}\
  /dingtian/DEVNAME/out/r1:.* { my $state = lc $EVENT; return if ReadingsVal($NAME,'state','unknown') eq $state; {state=>$state} }\
  /dingtian/DEVNAME/out/i1:.* {my $state = lc $EVENT; return if ReadingsVal($NAME,'input','unknown') eq $state; {input=>$state}}\
  /dingtian/DEVNAME/out/ip:.* ip\
  /dingtian/DEVNAME/out/sn:.* sn\
  /dingtian/DEVNAME/out/mac:.* mac\
  /dingtian/DEVNAME/out/dicnt:.* dicnt\
  /dingtian/DEVNAME/out/relay_cnt:.* relay_cnt
attr DEVICE setExtensionsEvent 1
attr DEVICE setList on:noArg /dingtian/DEVNAME/in/r1 ON\
  off:noArg /dingtian/DEVNAME/in/r1 OFF
attr DEVICE webCmd :
copy DEVICE DEVICE_CH2
defmod DEVICE_CH2 MQTT2_\DEVICE DEVICE_channels
copy DEVICE_CH2 DEVICE_CH3
copy DEVICE_CH2 DEVICE_CH4
copy DEVICE_CH2 DEVICE_CH5
copy DEVICE_CH2 DEVICE_CH6
copy DEVICE_CH2 DEVICE_CH7
copy DEVICE_CH2 DEVICE_CH8
attr DEVICE_CH2 readingList /dingtian/DEVNAME/out/r2:.* { my $state = lc $EVENT; return if ReadingsVal($NAME,'state','unknown') eq $state; {state=>$state} }\
  /dingtian/DEVNAME/out/i2:.* {my $state = lc $EVENT; return if ReadingsVal($NAME,'input','unknown') eq $state; {input=>$state}}
attr DEVICE_CH3 readingList /dingtian/DEVNAME/out/r3:.* { my $state = lc $EVENT; return if ReadingsVal($NAME,'state','unknown') eq $state; {state=>$state} }\
  /dingtian/DEVNAME/out/i3:.* {my $state = lc $EVENT; return if ReadingsVal($NAME,'input','unknown') eq $state; {input=>$state}}
attr DEVICE_CH4 readingList /dingtian/DEVNAME/out/r4:.* { my $state = lc $EVENT; return if ReadingsVal($NAME,'state','unknown') eq $state; {state=>$state} }\
  /dingtian/DEVNAME/out/i4:.* {my $state = lc $EVENT; return if ReadingsVal($NAME,'input','unknown') eq $state; {input=>$state}}
attr DEVICE_CH5 readingList /dingtian/DEVNAME/out/r5:.* { my $state = lc $EVENT; return if ReadingsVal($NAME,'state','unknown') eq $state; {state=>$state} }\
  /dingtian/DEVNAME/out/i5:.* {my $state = lc $EVENT; return if ReadingsVal($NAME,'input','unknown') eq $state; {input=>$state}}
attr DEVICE_CH6 readingList /dingtian/DEVNAME/out/r6:.* { my $state = lc $EVENT; return if ReadingsVal($NAME,'state','unknown') eq $state; {state=>$state} }\
  /dingtian/DEVNAME/out/i6:.* {my $state = lc $EVENT; return if ReadingsVal($NAME,'input','unknown') eq $state; {input=>$state}}
attr DEVICE_CH7 readingList /dingtian/DEVNAME/out/r7:.* { my $state = lc $EVENT; return if ReadingsVal($NAME,'state','unknown') eq $state; {state=>$state} }\
  /dingtian/DEVNAME/out/i7:.* {my $state = lc $EVENT; return if ReadingsVal($NAME,'input','unknown') eq $state; {input=>$state}}
attr DEVICE_CH8 readingList /dingtian/DEVNAME/out/r8:.* { my $state = lc $EVENT; return if ReadingsVal($NAME,'state','unknown') eq $state; {state=>$state} }\
  /dingtian/DEVNAME/out/i8:.* {my $state = lc $EVENT; return if ReadingsVal($NAME,'input','unknown') eq $state; {input=>$state}}
attr DEVICE_CH2 setList on:noArg /dingtian/DEVNAME/in/r2 ON\
  off:noArg /dingtian/DEVNAME/in/r2 OFF
attr DEVICE_CH3 setList on:noArg /dingtian/DEVNAME/in/r3 ON\
  off:noArg /dingtian/DEVNAME/in/r3 OFF
attr DEVICE_CH4 setList on:noArg /dingtian/DEVNAME/in/r4 ON\
  off:noArg /dingtian/DEVNAME/in/r4 OFF
attr DEVICE_CH5 setList on:noArg /dingtian/DEVNAME/in/r5 ON\
  off:noArg /dingtian/DEVNAME/in/r5 OFF
attr DEVICE_CH6 setList on:noArg /dingtian/DEVNAME/in/r6 ON\
  off:noArg /dingtian/DEVNAME/in/r6 OFF
attr DEVICE_CH7 setList on:noArg /dingtian/DEVNAME/in/r7 ON\
  off:noArg /dingtian/DEVNAME/in/r7 OFF
attr DEVICE_CH8 setList on:noArg /dingtian/DEVNAME/in/r8 ON\
  off:noArg /dingtian/DEVNAME/in/r8 OFF
set DEVICE attrTemplate set_associatedWith \CHANNELS=8
attr DEVICE devStateIcon {my $onl = ReadingsVal($name,'LWT','offline') eq 'online'?'10px-kreis-gruen':'10px-kreis-rot'; my $light = ReadingsVal($name,'state','off'); '<a href="http://'.ReadingsVal($name,'ip','none').' "target="_blank">'.FW_makeImage($onl).'"</a> <a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($light)."</a>"}
set DEVICE attrTemplate speechcontrol_type_switch
setreading DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH7,DEVICE_CH8 attrTemplateVersion 20211029
attr DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH7,DEVICE_CH8 model 8channel_relay_board_8di_split
« Letzte Änderung: 29 Oktober 2021, 11:34:33 von Beta-User »
Server: HP-T620@Debian 10, aktuelles FHEM + ConfigDB | CUL_HM (VCCU) | MQTT2: MiLight@ESP-GW, BT@OpenMQTTGw | MySensors: seriell, v.a. 2.3.1@RS485 | ZWave | ZigBee@deCONZ | SIGNALduino | MapleCUN | RHASSPY
svn:MySensors, Weekday-&RandomTimer, Twilight,  AttrTemplate {u.a. mqtt2, mysensors, zwave}

Offline rico5588

  • Full Member
  • ***
  • Beiträge: 220
Antw:Hilfe zu neuem Template dingtian Relayboard 8Chn+8Input
« Antwort #7 am: 29 Oktober 2021, 14:31:59 »
Hier mal der Link...

war das günstigste Board mit 8 Relays, Ethernet und MQTT was ich so gefunden habe.
Im Gehäuse für Hutschiene für ~35€
https://de.aliexpress.com/item/4000999069820.html?spm=a2g0s.9042311.0.0.2ef34c4dp3ClYj

Sorry das ich blöd Frage aber die Datei ändern "mqtt2.template" lokal auf dem Fhem Server oder direkt in Fhem?

(Ich warte einfach auf das nächste svn Update.)

Gruß Rico.
Geht nicht gibt's nicht.
NUC-I3+Proxmox, Fritzbox 7490, Synology DS414
Dimplex Wärmepumpe, Lüftungsanlage, Solarlog 1200
HM,IT,Lacross,EspEasy,und ein bissl Modbus,etc

Offline Beta-User

  • Developer
  • Hero Member
  • ****
  • Beiträge: 16340
Antw:Hilfe zu neuem Template dingtian Relayboard 8Chn+8Input
« Antwort #8 am: 29 Oktober 2021, 14:38:30 »
(Ich warte einfach auf das nächste svn Update.)
...mir wäre es deutlich lieber, ich könnte eine getestete Version einchecken, zumal ich noch nicht weiß, wann ich mir die Zeit dafür nehmen will...

Etwas ausführlichere Anleitung ist hier zu finden, da steht auch der Pfad, wo die Datei zu finden ist:
https://forum.fhem.de/index.php/topic,94495.msg872201.html#msg872201

Einfach den alten Abschnitt durch den neuen Tauschen (+ "initialize" ausführen oder FHEM neu starten), das sollte es schon gewesen sein.
Server: HP-T620@Debian 10, aktuelles FHEM + ConfigDB | CUL_HM (VCCU) | MQTT2: MiLight@ESP-GW, BT@OpenMQTTGw | MySensors: seriell, v.a. 2.3.1@RS485 | ZWave | ZigBee@deCONZ | SIGNALduino | MapleCUN | RHASSPY
svn:MySensors, Weekday-&RandomTimer, Twilight,  AttrTemplate {u.a. mqtt2, mysensors, zwave}

Offline rudolfkoenig

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 24714
Antw:Hilfe zu neuem Template dingtian Relayboard 8Chn+8Input
« Antwort #9 am: 29 Oktober 2021, 16:13:39 »
Ich habe in AttrTemplate die loop: Direktive eingebaut, damit koennte man den o.g. Template etwas verkuerzen:

###############
#dingtian 8ch relay board
#
#specials: event-on-change-reading and timestamp-on-change-reading via Perl...
#
# input by rico5588, see forum https://forum.fhem.de/index.php/topic,123709.msg1182787.html#msg1182787
name:8channel_relay_board_8di_split
filter:TYPE=MQTT2_DEVICE
desc:For use with dingtian 8-ch digital Input and 8-ch relay output ethernet board.<br>NOTE: First experimental version, for configuration and to contribute see <a href="https://forum.fhem.de/index.php/topic,123709.msg1182787.html#msg1182787">Forum Thread</a>. You have to configure MQTT first as described in product manual.<br>Split version - you'll get 8 independent devices.
order:W_05par:DEVNAME;Device's name in the topic tree;{ AttrVal('DEVICE','readingList','') =~ m,dingtian/([^/]+)/, ? $1 : undef }
par:ICON;ICON as set, defaults to on;{ AttrVal('DEVICE','icon','on') }
attr DEVICE icon ICON
deletereading -q DEVICE (?!associatedWith|IODev).*
attr DEVICE readingList /dingtian/DEVNAME/out/lwt_availability:.* LWT\
  /dingtian/DEVNAME/out/(relay|input)[1-8]:.* {}\
  /dingtian/DEVNAME/out/r1:.* { my $state = lc $EVENT; return if ReadingsVal($NAME,'state','unknown') eq $state; {state=>$state} }\
  /dingtian/DEVNAME/out/i1:.* {my $state = lc $EVENT; return if ReadingsVal($NAME,'input','unknown') eq $state; {input=>$state}}\
  /dingtian/DEVNAME/out/ip:.* ip\
  /dingtian/DEVNAME/out/sn:.* sn\
  /dingtian/DEVNAME/out/mac:.* mac\
  /dingtian/DEVNAME/out/dicnt:.* dicnt\
  /dingtian/DEVNAME/out/relay_cnt:.* relay_cnt
attr DEVICE setExtensionsEvent 1
attr DEVICE setList on:noArg /dingtian/DEVNAME/in/r1 ON\
  off:noArg /dingtian/DEVNAME/in/r1 OFF
attr DEVICE webCmd :
copy DEVICE DEVICE_CH2
defmod DEVICE_CH2 MQTT2_\DEVICE DEVICE_channels
loop:#:3:4:5:6:7:8
copy DEVICE_CH2 DEVICE_CH#
loop:END
loop:chNo:2:3:4:5:6:7:8
attr DEVICE_CHchNo readingList /dingtian/DEVNAME/out/rchNo:.* { my $state = lc $EVENT; return if ReadingsVal($NAME,'state','unknown') eq $state; {state=>$state} }\
  /dingtian/DEVNAME/out/ichNo:.* {my $state = lc $EVENT; return if ReadingsVal($NAME,'input','unknown') eq $state; {input=>$state}}
attr DEVICE_CHchNo setList on:noArg /dingtian/DEVNAME/in/rchNo ON\
  off:noArg /dingtian/DEVNAME/in/rchNo OFF
loop:END
set DEVICE attrTemplate set_associatedWith \CHANNELS=8
attr DEVICE devStateIcon {my $onl = ReadingsVal($name,'LWT','offline') eq 'online'?'10px-kreis-gruen':'10px-kreis-rot'; my $light = ReadingsVal($name,'state','off'); '<a href="http://'.ReadingsVal($name,'ip','none').' "target="_blank">'.FW_makeImage($onl)."</a> <a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($light)."</a>"}
set DEVICE attrTemplate speechcontrol_type_switch
setreading DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH7,DEVICE_CH8 attrTemplateVersion 20211029
attr DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH7,DEVICE_CH8 model 8channel_relay_board_8di_split

Ich habe bei devStateIcon ein ' entfernen muessen, damit ich keine Fehler kriege.
Ob das richtig ist, kann ich nicht beurteilen.
Gefällt mir Gefällt mir x 1 Liste anzeigen

Offline rico5588

  • Full Member
  • ***
  • Beiträge: 220
Antw:Hilfe zu neuem Template dingtian Relayboard 8Chn+8Input
« Antwort #10 am: 29 Oktober 2021, 16:18:40 »
OK ich versuch mich mal und melde mich wieder.
Geht nicht gibt's nicht.
NUC-I3+Proxmox, Fritzbox 7490, Synology DS414
Dimplex Wärmepumpe, Lüftungsanlage, Solarlog 1200
HM,IT,Lacross,EspEasy,und ein bissl Modbus,etc

Offline Beta-User

  • Developer
  • Hero Member
  • ****
  • Beiträge: 16340
Antw:Hilfe zu neuem Template dingtian Relayboard 8Chn+8Input
« Antwort #11 am: 29 Oktober 2021, 16:32:21 »
Ich habe bei devStateIcon ein ' entfernen muessen, damit ich keine Fehler kriege.
Ob das richtig ist, kann ich nicht beurteilen.
::) hatte dasselbe Problem, als ich das loop-feature ausgetestet habe... War ein Fehler meinerseits.

DANKE für die Erweiterung, das dürfte helfen, das eine oder andere template etwas zu entschlacken (und auch aus Enduser-Sicht lesbarer zu machen)!

Da wir grade beim "loopen" sind: Da AttrTemplate versucht, alle Variablen möglichst gesammelt zu ermitteln und alles auf einen Rutsch auszuführen, klappt es nicht (mehr?), für jeden Kanal auch gleich noch die Sprachsteuerungs-Ergänzung aufzurufen, mehr wie der erste Kanal geht nicht (oder ich habe bisher den Trick nicht herausgefunden ;D ).

a) ist es verständlich, wie ich das meine?
b) irgendeine Idee, wie man das lösen kann?
Server: HP-T620@Debian 10, aktuelles FHEM + ConfigDB | CUL_HM (VCCU) | MQTT2: MiLight@ESP-GW, BT@OpenMQTTGw | MySensors: seriell, v.a. 2.3.1@RS485 | ZWave | ZigBee@deCONZ | SIGNALduino | MapleCUN | RHASSPY
svn:MySensors, Weekday-&RandomTimer, Twilight,  AttrTemplate {u.a. mqtt2, mysensors, zwave}

Offline rudolfkoenig

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 24714
Antw:Hilfe zu neuem Template dingtian Relayboard 8Chn+8Input
« Antwort #12 am: 29 Oktober 2021, 16:35:27 »
Zitat
a) ist es verständlich, wie ich das meine?
Nicht fuer mich :), ich brauche ein Beispiel.

Offline Beta-User

  • Developer
  • Hero Member
  • ****
  • Beiträge: 16340
Antw:Hilfe zu neuem Template dingtian Relayboard 8Chn+8Input
« Antwort #13 am: 29 Oktober 2021, 16:58:09 »
 ::) das hatte ich befürchtet...

Also: Z.B. im aktuellen "6channel_ethernet_board_6input_split" steht (derzeit noch):
set DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6 attrTemplate speechcontrol_type_switch
Irgendwann hat mich dann TomLee darauf gestoßen, dass das so nicht funktioniert, weil man dann Dialogfelder wie dieses präsentiert bekommt (dort nur 2 Kanäle, aber im Prinzip dieselbe Logik): https://forum.fhem.de/index.php/topic,108999.msg1172751.html#msg1172751

Das Ergebnis ist dementsprechend auch - nennen wir es - gewöhnungsbedürftig....
Ziel wäre es, jedem Device einen eigenen Namen geben zu können (ggf. noch unterschiedlich für die einzelnen Assistenten...).

Das ganze ist an vielen Stellen (noch) zu finden, an einigen habe ich das mangels besserer Lösungen zwischenzeitlich einfach ausgebaut und setze halt nur noch für den ersten Kanal, den Rest muss dann der User jeweils separat aufrufen (was jetzt einfacher ist, weil das im Hintergrund genutzte Ausgangstemplate in der Auswahlliste erscheint).

Wunsch wäre, für jeden Kanal dann jeweils ein Dialogfeld angezeigt zu bekommen und das ganze abbrechen zu können.

Jetzt klarer?
« Letzte Änderung: 29 Oktober 2021, 16:59:51 von Beta-User »
Server: HP-T620@Debian 10, aktuelles FHEM + ConfigDB | CUL_HM (VCCU) | MQTT2: MiLight@ESP-GW, BT@OpenMQTTGw | MySensors: seriell, v.a. 2.3.1@RS485 | ZWave | ZigBee@deCONZ | SIGNALduino | MapleCUN | RHASSPY
svn:MySensors, Weekday-&RandomTimer, Twilight,  AttrTemplate {u.a. mqtt2, mysensors, zwave}

Offline rudolfkoenig

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 24714
Antw:Hilfe zu neuem Template dingtian Relayboard 8Chn+8Input
« Antwort #14 am: 29 Oktober 2021, 17:31:05 »
Leider :)