MQTT2_DEVICE und Espurna

Begonnen von Beta-User, 03 Februar 2020, 12:04:42

Vorheriges Thema - Nächstes Thema

Beta-User

Hallo zusammen,

nachdem ich per pm nach support für Espurna gefragt wurde:

Als MQTT_DEVICE sah das so aus:
define sonoffswitchS20 MQTT_DEVICE
attr sonoffswitchS20 IODev myBroker
attr sonoffswitchS20 alias [1] S20 - WZ Light (front)
attr sonoffswitchS20 devStateIcon 1:on:0 0:off:1
attr sonoffswitchS20 eventMap 1:on 0:off
attr sonoffswitchS20 publishSet ON OFF sonoffswitchS20/relay/0/set
[...]
attr sonoffswitchS20 subscribeReading_state sonoffswitchS20/relay/0


Per MQTT kommt wohl für relay "0" oder "1" zurück.
Damit sollte folgende readingList und setList funktionieren:
attr <DEVICE> readingList sonoffswitchS20/relay/0 { $EVENT ? {"state"=>"on"} : {"state"=>"off"} }
attr <DEVICE> setList on sonoffswitchS20/relay/0/set 1\
  off sonoffswitchS20/relay/0/set 0


Bitte mal prüfen, ob man (wie bei Tasmota) ändern kann, was die firmware für on/off senden kann, und ob ggf. auch on bzw. off als Befehl genutzt werden können (ist nicht so wichtig, da wir für setExtensions sowieso getrennte Befehle benötigen).

Ansonsten wäre mir sehr geholfen, wenn ich RAW-Definitionen erhalten könnte und eventuell Infos dazu, wie der MQTT-Verkehr aussieht (betrifft dann aber eher weitere Readings, Statusmeldungen usw.).
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: ZigBee2mqtt, MiLight@ESP-GW, BT@OpenMQTTGw | ZWave | SIGNALduino | MapleCUN | RHASSPY
svn: u.a Weekday-&RandomTimer, Twilight,  div. attrTemplate-files, MySensors

HM Krause

Wenn ich mit MQTTfx "off" oder "on" sende an sonoffswitchS20/relay/0/set geht es ebenso wie mit "0" oder "1" auch.
In der subscription sonoffswitchS20/relay/0 hingegen steht nur "0" oder "1" als result.

Beta-User

Also: Nach https://github.com/xoseperez/espurna/wiki/MQTT#relays kann man umstellen, was für on und off gesendet wird:
Zitat(1) Relay command payloads accept both numbers (0 for off, 1 for on and 2 for toggle) or words (on, off, toggle or query; case insensitive). Accepted and sent payload strings are configured by the relayPayloadOn, relayPayloadOff and relayPayloadToggle settings and
Bin nur nicht recht schlau draus geworden, wohin das genau zu senden sein soll...
Kannst du mal testen, ob ein publish auf "sonoffswitchS20/relay/0/set" mit der Payload "relayPayloadOn on" was sinnvolles bewirkt (und für off genauso)?

Ansonsten bitte mal RAW-Definitionen von dem MQTT2-Device, das du bis dahin hast bzw. die Info, ob das mit MQTT2_CLIENT laufen soll oder ob du den MQTT2_SERVER im Einsatz ist?
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: ZigBee2mqtt, MiLight@ESP-GW, BT@OpenMQTTGw | ZWave | SIGNALduino | MapleCUN | RHASSPY
svn: u.a Weekday-&RandomTimer, Twilight,  div. attrTemplate-files, MySensors

HM Krause

#3
Ein publish auf "sonoffswitchS20/relay/0/set" mit der Payload "relayPayloadOn on" oder allen möglichen anderen Versuchen bringt nichts, habe lange probiert. Es laufen nur 0 1 2 on off toggle.

Hier mal ein raw Code mit dem FHEM soweit läuft:
defmod SonoffswitchS20 MQTT2_DEVICE
attr SonoffswitchS20 IODev MQTT2_FHEM_Server
attr SonoffswitchS20 readingList sonoffswitchS203/relay/0 { $EVENT ? {"state"=>"on"} : {"state"=>"off"} }
attr SonoffswitchS20 room POWER
attr SonoffswitchS20 setList on sonoffswitchS203/relay/0/set 1\
  off sonoffswitchS203/relay/0/set 0

setstate SonoffswitchS20 on
setstate SonoffswitchS20 2020-02-03 15:30:51 state on


Und noch

defmod MQTT2_sonoffswitchS203 MQTT2_DEVICE sonoffswitchS203
attr MQTT2_sonoffswitchS203 IODev MQTT2_FHEM_Server
attr MQTT2_sonoffswitchS203 readingList sonoffswitchS203:sonoffswitchS203/relay/0:.* relay_0\
sonoffswitchS203:sonoffswitchS203/app:.* app\
sonoffswitchS203:sonoffswitchS203/version:.* version\
sonoffswitchS203:sonoffswitchS203/board:.* board\
sonoffswitchS203:sonoffswitchS203/host:.* host\
sonoffswitchS203:sonoffswitchS203/ssid:.* ssid\
sonoffswitchS203:sonoffswitchS203/ip:.* ip\
sonoffswitchS203:sonoffswitchS203/mac:.* mac\
sonoffswitchS203:sonoffswitchS203/rssi:.* rssi\
sonoffswitchS203:sonoffswitchS203/uptime:.* uptime\
sonoffswitchS203:sonoffswitchS203/datetime:.* datetime\
sonoffswitchS203:sonoffswitchS203/freeheap:.* freeheap\
sonoffswitchS203:sonoffswitchS203/vcc:.* vcc\
sonoffswitchS203:sonoffswitchS203/status:.* status\
sonoffswitchS203:sonoffswitchS203/loadavg:.* loadavg
attr MQTT2_sonoffswitchS203 room MQTT2_DEVICE

setstate MQTT2_sonoffswitchS203 2020-02-03 15:34:20 app ESPURNA
setstate MQTT2_sonoffswitchS203 2020-02-03 15:34:20 board ITEAD_S20
setstate MQTT2_sonoffswitchS203 2020-02-03 15:34:20 datetime 2020-02-03 15:34:19
setstate MQTT2_sonoffswitchS203 2020-02-03 15:34:20 freeheap 21568
setstate MQTT2_sonoffswitchS203 2020-02-03 15:34:20 host Sonoff-S20-3
setstate MQTT2_sonoffswitchS203 2020-02-03 15:34:20 ip 192.168.178.78
setstate MQTT2_sonoffswitchS203 2020-02-03 15:34:20 loadavg 1
setstate MQTT2_sonoffswitchS203 2020-02-03 15:34:20 mac 80:7D:3A:67:B3:E0
setstate MQTT2_sonoffswitchS203 2020-02-03 15:34:20 relay_0 1
setstate MQTT2_sonoffswitchS203 2020-02-03 15:34:20 rssi -55
setstate MQTT2_sonoffswitchS203 2020-02-03 15:34:20 ssid Skynet-basic
setstate MQTT2_sonoffswitchS203 2020-02-03 15:34:20 status 1
setstate MQTT2_sonoffswitchS203 2020-02-03 15:30:15 subscriptions sonoffswitchS203/action/set sonoffswitchS203/led/+/set sonoffswitchS203/pulse/+/set sonoffswitchS203/relay/+/set
setstate MQTT2_sonoffswitchS203 2020-02-03 15:34:20 uptime 4354
setstate MQTT2_sonoffswitchS203 2020-02-03 15:34:20 vcc 3230
setstate MQTT2_sonoffswitchS203 2020-02-03 15:34:20 version 1.13.5


wenn Du das meinst. Ansonsten ist hier testweise FHEM "mit ohne alles" auf Ubuntu und mit MQTT2_SERVER.

Links im FHEM sind jetzt Einträge MQTT2_DEVICE mit FileLog_MQTT2_sonoffswitchS203 und MQTT2_sonoffswitchS203 mit 3Fragezeichen
Müssen die da sein, die tragen sich ja da allein ein?

und ansonsten Eintrag für den Room POWER (mit dem SonoffS20 darin, ist ok)

Beta-User

Hmm, vielleicht hat sonst jemand eine Idee, wie man das umkonfiguriert, wie gesagt, ich werde aus der Doku auch nicht schlau, am ehesten könnte es noch sein, dass die Konfiguration über "sonoffswitchS203/action/set" beeinflußt werden kann..?

Ansonsten hilft mir die RAW-Definition ziemlich weiter. Dass autocreate erst mal alles im Raum MQTT2_DEVICE erstellt, ist normal. Die Devices kannst du beliebig verschieben.

Im Prinzip kannst du mit den kleinen Bausteinchen, die in dem ersten Device SonoffswitchS20 drin sind das andere Device erweitern/ändern. Wird etwas dauern, bis ich daraus ein erstes attrTemplate basteln kann, vorher bitte nochmal einen Versuch, das mit dem anderen Pfad umzukonfigurieren.
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: ZigBee2mqtt, MiLight@ESP-GW, BT@OpenMQTTGw | ZWave | SIGNALduino | MapleCUN | RHASSPY
svn: u.a Weekday-&RandomTimer, Twilight,  div. attrTemplate-files, MySensors

HM Krause

#5
Ich kann unter "sonoffswitchS203/action/set" mit MQTTfx senden was ich will, es kommt immer nur in der Konsole ohne Reaktion, alsoz.B.
089223] [MQTT] Received sonoffswitchS203/action/set => payload_on: "1"
[096731] [MQTT] Received sonoffswitchS203/action/set => 1
[103873] [MQTT] Received sonoffswitchS203/action/set => 0n
[109698] [MQTT] Received sonoffswitchS203/action/set => on


also das hier beschriebene
(1) Relay command payloads accept both numbers (0 for off, 1 for on and 2 for toggle) or words (on, off, toggle or query; case insensitive). Accepted and sent payload strings are configured by the relayPayloadOn, relayPayloadOff and relayPayloadToggle settings and RELAY_MQTT_ON, RELAY_MQTT_OFF, RELAY_MQTT_TOGGLE string definitions.

(2) The special query payload does not change the relay state but triggers a state topic message.


funktioniert nicht. Hat aber auch Zeit mit dem MQTT2, momentan laufen die Dinger ohnehin mit Mosquitto MQTT und da funktioniert alles.

Beta-User

Hm, wäre natürlich schöner, wir würden das irgendwie mit den on/off-rückmeldungen besser hingebogen bekommen, aber auch so wird das notfalls gehen.

Hier mal ein erster Wurf ohne große desc:, und mit der Doppelung von relay_0 und state, die man eigentlich nicht braucht:
###########################################
# ESPurna
#
# ESP8266 devices using ESPurna firmware.
# See project page for details: https://github.com/xoseperez/espurna/wiki
name:ESPurna_single_relay
filter:TYPE=MQTT2_DEVICE
par:DEVNAME;Device's name in the topic tree;{ AttrVal("DEVICE","readingList","") =~ m,([^:/]+)/([^/]+)/, ? $1 : undef }
order:A_30
attr DEVICE readingList DEVNAME/relay/0:.* relay_0\
  DEVNAME/relay/0:.* { $EVENT ? {"state"=>"on"} : {"state"=>"off"} }\
  DEVNAME/app:.* app\
  DEVNAME/version:.* version\
  DEVNAME/board:.* board\
  DEVNAME/host:.* host\
  DEVNAME/ssid:.* ssid\
  DEVNAME/ip:.* ip\
  DEVNAME/mac:.* mac\
  DEVNAME/rssi:.* rssi\
  DEVNAME/uptime:.* uptime\
  DEVNAME/datetime:.* datetime\
  DEVNAME/freeheap:.* freeheap\
  DEVNAME/vcc:.* vcc\
  DEVNAME/status:.* status\
  DEVNAME/loadavg:.* loadavg
attr DEVICE setList on DEVNAME/relay/0/set 1\
  off DEVNAME/relay/0/set 0\
  toggle DEVNAME/relay/0/set 2
attr DEVICE setStateList on off toggle
set DEVICE attrTemplate mqtt2_speech_recognition_type_switch
attr DEVICE model ESPurna_single_relay


Bitte vor dem Testen noch ein FHEM-update, sonst wirft das mit der Spracherkennung einen Fehler...

Rückmeldung wäre nett, ansonsten würde ich das mal auf Verdacht und mit einem Link hierher bei Gelegenheit mit Einchecken.
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: ZigBee2mqtt, MiLight@ESP-GW, BT@OpenMQTTGw | ZWave | SIGNALduino | MapleCUN | RHASSPY
svn: u.a Weekday-&RandomTimer, Twilight,  div. attrTemplate-files, MySensors

HM Krause

Sorry, da komm ich nicht ganz mit, soll das in die Befehlszeile?

Beta-User

Sorry, das ist Code, der als attrTemplate zu verwenden ist. Hinweise dazu sind hier zu finden: https://wiki.fhem.de/wiki/AttrTemplate#Eigene_Templates_entwickeln
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: ZigBee2mqtt, MiLight@ESP-GW, BT@OpenMQTTGw | ZWave | SIGNALduino | MapleCUN | RHASSPY
svn: u.a Weekday-&RandomTimer, Twilight,  div. attrTemplate-files, MySensors

HM Krause

#9
Kaum macht man es richtig schon geht's - ist immer wieder erstaunlich. chapeau. Alle Achtung.

defmod MQTT2_sonoffswitchS203 MQTT2_DEVICE sonoffswitchS203
attr MQTT2_sonoffswitchS203 IODev MQTT2_FHEM_Server
attr MQTT2_sonoffswitchS203 model ESPurna_single_relay
attr MQTT2_sonoffswitchS203 readingList sonoffswitchS203/relay/0:.* relay_0\
  sonoffswitchS203/relay/0:.* { $EVENT ? {"state"=>"on"} : {"state"=>"off"} }\
  sonoffswitchS203/app:.* app\
  sonoffswitchS203/version:.* version\
  sonoffswitchS203/board:.* board\
  sonoffswitchS203/host:.* host\
  sonoffswitchS203/ssid:.* ssid\
  sonoffswitchS203/ip:.* ip\
  sonoffswitchS203/mac:.* mac\
  sonoffswitchS203/rssi:.* rssi\
  sonoffswitchS203/uptime:.* uptime\
  sonoffswitchS203/datetime:.* datetime\
  sonoffswitchS203/freeheap:.* freeheap\
  sonoffswitchS203/vcc:.* vcc\
  sonoffswitchS203/status:.* status\
  sonoffswitchS203/loadavg:.* loadavg
attr MQTT2_sonoffswitchS203 room MQTT2_DEVICE
attr MQTT2_sonoffswitchS203 setList on sonoffswitchS203/relay/0/set 1\
  off sonoffswitchS203/relay/0/set 0\
  toggle sonoffswitchS203/relay/0/set 2
attr MQTT2_sonoffswitchS203 setStateList on off toggle

setstate MQTT2_sonoffswitchS203 on
setstate MQTT2_sonoffswitchS203 2020-02-06 12:01:46 app ESPURNA
setstate MQTT2_sonoffswitchS203 2020-02-06 12:01:47 board ITEAD_S20
setstate MQTT2_sonoffswitchS203 2020-02-06 12:01:47 datetime 2020-02-06 12:01:46
setstate MQTT2_sonoffswitchS203 2020-02-06 12:01:47 freeheap 16512
setstate MQTT2_sonoffswitchS203 2020-02-06 12:01:47 host Sonoff-S20-3
setstate MQTT2_sonoffswitchS203 2020-02-06 12:01:47 ip 192.168.178.78
setstate MQTT2_sonoffswitchS203 2020-02-06 12:01:47 loadavg 1
setstate MQTT2_sonoffswitchS203 2020-02-06 12:01:47 mac 80:7D:3A:67:B3:E0
setstate MQTT2_sonoffswitchS203 2020-02-06 12:04:10 relay_0 1
setstate MQTT2_sonoffswitchS203 2020-02-06 12:01:47 rssi -53
setstate MQTT2_sonoffswitchS203 2020-02-06 12:01:47 ssid Skynet-basic
setstate MQTT2_sonoffswitchS203 2020-02-06 12:04:10 state on
setstate MQTT2_sonoffswitchS203 2020-02-06 12:01:47 status 1
setstate MQTT2_sonoffswitchS203 2020-02-06 12:01:46 subscriptions sonoffswitchS203/action/set sonoffswitchS203/led/+/set sonoffswitchS203/pulse/+/set sonoffswitchS203/relay/+/set
setstate MQTT2_sonoffswitchS203 2020-02-06 12:01:47 uptime 19811
setstate MQTT2_sonoffswitchS203 2020-02-06 12:01:47 vcc 3233
setstate MQTT2_sonoffswitchS203 2020-02-06 12:01:47 version 1.13.5



Was ist denn mit dem neuen entstehenden log-File?
Das wird bei jedem Schalten immer länger.

2020-02-06_11:16:37 MQTT2_sonoffswitchS203 app: ESPURNA
2020-02-06_11:16:37 MQTT2_sonoffswitchS203 version: 1.13.5
2020-02-06_11:16:37 MQTT2_sonoffswitchS203 board: ITEAD_S20
2020-02-06_11:16:37 MQTT2_sonoffswitchS203 host: Sonoff-S20-3
2020-02-06_11:16:37 MQTT2_sonoffswitchS203 ssid: Skynet-basic
2020-02-06_11:16:37 MQTT2_sonoffswitchS203 ip: 192.168.178.78
2020-02-06_11:16:37 MQTT2_sonoffswitchS203 mac: 80:7D:3A:67:B3:E0
2020-02-06_11:16:37 MQTT2_sonoffswitchS203 rssi: -56
2020-02-06_11:16:37 MQTT2_sonoffswitchS203 uptime: 17101
2020-02-06_11:16:37 MQTT2_sonoffswitchS203 datetime: 2020-02-06 11:16:37
2020-02-06_11:16:37 MQTT2_sonoffswitchS203 freeheap: 16512
2020-02-06_11:16:37 MQTT2_sonoffswitchS203 relay_0: 0
2020-02-06_11:16:37 MQTT2_sonoffswitchS203 vcc: 3238
2020-02-06_11:16:37 MQTT2_sonoffswitchS203 status: 1
2020-02-06_11:16:37 MQTT2_sonoffswitchS203 loadavg: 2
2020-02-06_11:21:37 MQTT2_sonoffswitchS203 app: ESPURNA
2020-02-06_11:21:37 MQTT2_sonoffswitchS203 version: 1.13.5
2020-02-06_11:21:37 MQTT2_sonoffswitchS203 board: ITEAD_S20
2020-02-06_11:21:37 MQTT2_sonoffswitchS203 host: Sonoff-S20-3
2020-02-06_11:21:37 MQTT2_sonoffswitchS203 ssid: Skynet-basic
2020-02-06_11:21:37 MQTT2_sonoffswitchS203 ip: 192.168.178.78
2020-02-06_11:21:37 MQTT2_sonoffswitchS203 mac: 80:7D:3A:67:B3:E0
2020-02-06_11:21:37 MQTT2_sonoffswitchS203 rssi: -59
2020-02-06_11:21:37 MQTT2_sonoffswitchS203 uptime: 17401
2020-02-06_11:21:37 MQTT2_sonoffswitchS203 datetime: 2020-02-06 11:21:37
2020-02-06_11:21:37 MQTT2_sonoffswitchS203 freeheap: 21560
2020-02-06_11:21:37 MQTT2_sonoffswitchS203 relay_0: 0
2020-02-06_11:21:37 MQTT2_sonoffswitchS203 vcc: 3234
2020-02-06_11:21:37 MQTT2_sonoffswitchS203 status: 1
2020-02-06_11:21:37 MQTT2_sonoffswitchS203 loadavg: 1
2020-02-06_11:23:47 MQTT2_sonoffswitchS203 relay_0: 1
2020-02-06_11:23:48 MQTT2_sonoffswitchS203 relay_0: 0
2020-02-06_11:26:37 MQTT2_sonoffswitchS203 app: ESPURNA
2020-02-06_11:26:37 MQTT2_sonoffswitchS203 version: 1.13.5
2020-02-06_11:26:37 MQTT2_sonoffswitchS203 board: ITEAD_S20
2020-02-06_11:26:37 MQTT2_sonoffswitchS203 host: Sonoff-S20-3
2020-02-06_11:26:37 MQTT2_sonoffswitchS203 ssid: Skynet-basic
2020-02-06_11:26:37 MQTT2_sonoffswitchS203 ip: 192.168.178.78
2020-02-06_11:26:37 MQTT2_sonoffswitchS203 mac: 80:7D:3A:67:B3:E0
2020-02-06_11:26:37 MQTT2_sonoffswitchS203 rssi: -62
2020-02-06_11:26:37 MQTT2_sonoffswitchS203 uptime: 17701
2020-02-06_11:26:37 MQTT2_sonoffswitchS203 datetime: 2020-02-06 11:26:37
2020-02-06_11:26:37 MQTT2_sonoffswitchS203 freeheap: 21560
2020-02-06_11:26:37 MQTT2_sonoffswitchS203 relay_0: 0
2020-02-06_11:26:37 MQTT2_sonoffswitchS203 vcc: 3230
2020-02-06_11:26:37 MQTT2_sonoffswitchS203 status: 1
2020-02-06_11:26:37 MQTT2_sonoffswitchS203 loadavg: 1
2020-02-06_11:31:37 MQTT2_sonoffswitchS203 app: ESPURNA
2020-02-06_11:31:37 MQTT2_sonoffswitchS203 version: 1.13.5
2020-02-06_11:31:37 MQTT2_sonoffswitchS203 board: ITEAD_S20
2020-02-06_11:31:37 MQTT2_sonoffswitchS203 host: Sonoff-S20-3
2020-02-06_11:31:37 MQTT2_sonoffswitchS203 ssid: Skynet-basic
2020-02-06_11:31:37 MQTT2_sonoffswitchS203 ip: 192.168.178.78
2020-02-06_11:31:37 MQTT2_sonoffswitchS203 mac: 80:7D:3A:67:B3:E0
2020-02-06_11:31:37 MQTT2_sonoffswitchS203 rssi: -61
2020-02-06_11:31:37 MQTT2_sonoffswitchS203 uptime: 18001
2020-02-06_11:31:37 MQTT2_sonoffswitchS203 datetime: 2020-02-06 11:31:37
2020-02-06_11:31:37 MQTT2_sonoffswitchS203 freeheap: 21560
2020-02-06_11:31:37 MQTT2_sonoffswitchS203 relay_0: 0
2020-02-06_11:31:37 MQTT2_sonoffswitchS203 vcc: 3234
2020-02-06_11:31:37 MQTT2_sonoffswitchS203 status: 1
2020-02-06_11:31:37 MQTT2_sonoffswitchS203 loadavg: 1
2020-02-06_11:36:37 MQTT2_sonoffswitchS203 app: ESPURNA
2020-02-06_11:36:37 MQTT2_sonoffswitchS203 version: 1.13.5
2020-02-06_11:36:37 MQTT2_sonoffswitchS203 board: ITEAD_S20
2020-02-06_11:36:37 MQTT2_sonoffswitchS203 host: Sonoff-S20-3
2020-02-06_11:36:37 MQTT2_sonoffswitchS203 ssid: Skynet-basic
2020-02-06_11:36:37 MQTT2_sonoffswitchS203 ip: 192.168.178.78
2020-02-06_11:36:37 MQTT2_sonoffswitchS203 mac: 80:7D:3A:67:B3:E0
2020-02-06_11:36:37 MQTT2_sonoffswitchS203 rssi: -56
2020-02-06_11:36:37 MQTT2_sonoffswitchS203 uptime: 18301
2020-02-06_11:36:37 MQTT2_sonoffswitchS203 datetime: 2020-02-06 11:36:37
2020-02-06_11:36:37 MQTT2_sonoffswitchS203 freeheap: 21560
2020-02-06_11:36:37 MQTT2_sonoffswitchS203 relay_0: 0
2020-02-06_11:36:37 MQTT2_sonoffswitchS203 vcc: 3237
2020-02-06_11:36:37 MQTT2_sonoffswitchS203 status: 1
2020-02-06_11:36:37 MQTT2_sonoffswitchS203 loadavg: 1
2020-02-06_11:41:37 MQTT2_sonoffswitchS203 app: ESPURNA
2020-02-06_11:41:37 MQTT2_sonoffswitchS203 version: 1.13.5
2020-02-06_11:41:37 MQTT2_sonoffswitchS203 board: ITEAD_S20
2020-02-06_11:41:37 MQTT2_sonoffswitchS203 host: Sonoff-S20-3
2020-02-06_11:41:37 MQTT2_sonoffswitchS203 ssid: Skynet-basic
2020-02-06_11:41:37 MQTT2_sonoffswitchS203 ip: 192.168.178.78
2020-02-06_11:41:37 MQTT2_sonoffswitchS203 mac: 80:7D:3A:67:B3:E0
2020-02-06_11:41:37 MQTT2_sonoffswitchS203 rssi: -57
2020-02-06_11:41:37 MQTT2_sonoffswitchS203 uptime: 18601
2020-02-06_11:41:37 MQTT2_sonoffswitchS203 datetime: 2020-02-06 11:41:37
2020-02-06_11:41:37 MQTT2_sonoffswitchS203 freeheap: 21560
2020-02-06_11:41:37 MQTT2_sonoffswitchS203 relay_0: 0
2020-02-06_11:41:37 MQTT2_sonoffswitchS203 vcc: 3233
2020-02-06_11:41:37 MQTT2_sonoffswitchS203 status: 1
2020-02-06_11:41:37 MQTT2_sonoffswitchS203 loadavg: 1
2020-02-06_11:46:37 MQTT2_sonoffswitchS203 app: ESPURNA
2020-02-06_11:46:37 MQTT2_sonoffswitchS203 version: 1.13.5
2020-02-06_11:46:37 MQTT2_sonoffswitchS203 board: ITEAD_S20
2020-02-06_11:46:37 MQTT2_sonoffswitchS203 host: Sonoff-S20-3
2020-02-06_11:46:37 MQTT2_sonoffswitchS203 ssid: Skynet-basic
2020-02-06_11:46:37 MQTT2_sonoffswitchS203 ip: 192.168.178.78
2020-02-06_11:46:37 MQTT2_sonoffswitchS203 mac: 80:7D:3A:67:B3:E0
2020-02-06_11:46:37 MQTT2_sonoffswitchS203 rssi: -52
2020-02-06_11:46:37 MQTT2_sonoffswitchS203 uptime: 18901
2020-02-06_11:46:37 MQTT2_sonoffswitchS203 datetime: 2020-02-06 11:46:37
2020-02-06_11:46:37 MQTT2_sonoffswitchS203 freeheap: 21560
2020-02-06_11:46:37 MQTT2_sonoffswitchS203 relay_0: 0
2020-02-06_11:46:37 MQTT2_sonoffswitchS203 vcc: 3237
2020-02-06_11:46:37 MQTT2_sonoffswitchS203 status: 1
2020-02-06_11:46:37 MQTT2_sonoffswitchS203 loadavg: 1
2020-02-06_12:01:46 MQTT2_sonoffswitchS203 app: ESPURNA
2020-02-06_12:01:47 MQTT2_sonoffswitchS203 version: 1.13.5
2020-02-06_12:01:47 MQTT2_sonoffswitchS203 board: ITEAD_S20
2020-02-06_12:01:47 MQTT2_sonoffswitchS203 host: Sonoff-S20-3
2020-02-06_12:01:47 MQTT2_sonoffswitchS203 ssid: Skynet-basic
2020-02-06_12:01:47 MQTT2_sonoffswitchS203 ip: 192.168.178.78
2020-02-06_12:01:47 MQTT2_sonoffswitchS203 mac: 80:7D:3A:67:B3:E0
2020-02-06_12:01:47 MQTT2_sonoffswitchS203 rssi: -53
2020-02-06_12:01:47 MQTT2_sonoffswitchS203 uptime: 19811
2020-02-06_12:01:47 MQTT2_sonoffswitchS203 datetime: 2020-02-06 12:01:46
2020-02-06_12:01:47 MQTT2_sonoffswitchS203 freeheap: 16512
2020-02-06_12:01:47 MQTT2_sonoffswitchS203 relay_0: 0
2020-02-06_12:01:47 MQTT2_sonoffswitchS203 vcc: 3233
2020-02-06_12:01:47 MQTT2_sonoffswitchS203 status: 1
2020-02-06_12:01:47 MQTT2_sonoffswitchS203 loadavg: 1
2020-02-06_12:03:23 MQTT2_sonoffswitchS203 attrTemplate mqtt2_speech_recognition_type_switch
2020-02-06_12:03:40 MQTT2_sonoffswitchS203 set_on
2020-02-06_12:03:40 MQTT2_sonoffswitchS203 relay_0: 1
2020-02-06_12:03:40 MQTT2_sonoffswitchS203 on
2020-02-06_12:03:41 MQTT2_sonoffswitchS203 set_off
2020-02-06_12:03:41 MQTT2_sonoffswitchS203 relay_0: 0
2020-02-06_12:03:41 MQTT2_sonoffswitchS203 off
2020-02-06_12:03:42 MQTT2_sonoffswitchS203 set_on
2020-02-06_12:03:42 MQTT2_sonoffswitchS203 relay_0: 1
2020-02-06_12:03:42 MQTT2_sonoffswitchS203 on
2020-02-06_12:03:43 MQTT2_sonoffswitchS203 set_off
2020-02-06_12:03:43 MQTT2_sonoffswitchS203 relay_0: 0
2020-02-06_12:03:43 MQTT2_sonoffswitchS203 off
2020-02-06_12:03:45 MQTT2_sonoffswitchS203 set_on
2020-02-06_12:03:45 MQTT2_sonoffswitchS203 relay_0: 1
2020-02-06_12:03:45 MQTT2_sonoffswitchS203 on
2020-02-06_12:03:48 MQTT2_sonoffswitchS203 set_off
2020-02-06_12:03:48 MQTT2_sonoffswitchS203 relay_0: 0
2020-02-06_12:03:48 MQTT2_sonoffswitchS203 off
2020-02-06_12:03:49 MQTT2_sonoffswitchS203 set_on
2020-02-06_12:03:49 MQTT2_sonoffswitchS203 relay_0: 1
2020-02-06_12:03:49 MQTT2_sonoffswitchS203 on
2020-02-06_12:04:07 MQTT2_sonoffswitchS203 set_off
2020-02-06_12:04:07 MQTT2_sonoffswitchS203 relay_0: 0
2020-02-06_12:04:07 MQTT2_sonoffswitchS203 off
2020-02-06_12:04:08 MQTT2_sonoffswitchS203 set_on
2020-02-06_12:04:08 MQTT2_sonoffswitchS203 relay_0: 1
2020-02-06_12:04:08 MQTT2_sonoffswitchS203 on
2020-02-06_12:04:10 MQTT2_sonoffswitchS203 set_off
2020-02-06_12:04:10 MQTT2_sonoffswitchS203 relay_0: 0
2020-02-06_12:04:10 MQTT2_sonoffswitchS203 off
2020-02-06_12:04:10 MQTT2_sonoffswitchS203 set_on
2020-02-06_12:04:10 MQTT2_sonoffswitchS203 relay_0: 1
2020-02-06_12:04:10 MQTT2_sonoffswitchS203 on
2020-02-06_12:06:39 MQTT2_sonoffswitchS203 set_off
2020-02-06_12:06:39 MQTT2_sonoffswitchS203 relay_0: 0
2020-02-06_12:06:39 MQTT2_sonoffswitchS203 off
2020-02-06_12:06:40 MQTT2_sonoffswitchS203 set_on
2020-02-06_12:06:40 MQTT2_sonoffswitchS203 relay_0: 1
2020-02-06_12:06:40 MQTT2_sonoffswitchS203 on
2020-02-06_12:06:41 MQTT2_sonoffswitchS203 set_off
2020-02-06_12:06:41 MQTT2_sonoffswitchS203 relay_0: 0
2020-02-06_12:06:41 MQTT2_sonoffswitchS203 off
2020-02-06_12:06:42 MQTT2_sonoffswitchS203 set_on
2020-02-06_12:06:42 MQTT2_sonoffswitchS203 relay_0: 1
2020-02-06_12:06:42 MQTT2_sonoffswitchS203 on
2020-02-06_12:06:44 MQTT2_sonoffswitchS203 set_off
2020-02-06_12:06:44 MQTT2_sonoffswitchS203 relay_0: 0
2020-02-06_12:06:44 MQTT2_sonoffswitchS203 off
2020-02-06_12:06:45 MQTT2_sonoffswitchS203 set_on
2020-02-06_12:06:45 MQTT2_sonoffswitchS203 relay_0: 1
2020-02-06_12:06:45 MQTT2_sonoffswitchS203 on
2020-02-06_12:06:46 MQTT2_sonoffswitchS203 set_off
2020-02-06_12:06:46 MQTT2_sonoffswitchS203 relay_0: 0
2020-02-06_12:06:46 MQTT2_sonoffswitchS203 off
2020-02-06_12:06:46 MQTT2_sonoffswitchS203 app: ESPURNA
2020-02-06_12:06:46 MQTT2_sonoffswitchS203 version: 1.13.5
2020-02-06_12:06:46 MQTT2_sonoffswitchS203 board: ITEAD_S20
2020-02-06_12:06:46 MQTT2_sonoffswitchS203 host: Sonoff-S20-3
2020-02-06_12:06:46 MQTT2_sonoffswitchS203 ssid: Skynet-basic
2020-02-06_12:06:46 MQTT2_sonoffswitchS203 ip: 192.168.178.78
2020-02-06_12:06:46 MQTT2_sonoffswitchS203 mac: 80:7D:3A:67:B3:E0
2020-02-06_12:06:46 MQTT2_sonoffswitchS203 rssi: -52
2020-02-06_12:06:46 MQTT2_sonoffswitchS203 uptime: 20111
2020-02-06_12:06:46 MQTT2_sonoffswitchS203 datetime: 2020-02-06 12:06:46
2020-02-06_12:06:46 MQTT2_sonoffswitchS203 freeheap: 19264
2020-02-06_12:06:46 MQTT2_sonoffswitchS203 relay_0: 0
2020-02-06_12:06:46 MQTT2_sonoffswitchS203 off
2020-02-06_12:06:46 MQTT2_sonoffswitchS203 vcc: 3236
2020-02-06_12:06:46 MQTT2_sonoffswitchS203 status: 1
2020-02-06_12:06:46 MQTT2_sonoffswitchS203 loadavg: 1
2020-02-06_12:08:27 MQTT2_sonoffswitchS203 set_on
2020-02-06_12:08:27 MQTT2_sonoffswitchS203 relay_0: 1
2020-02-06_12:08:27 MQTT2_sonoffswitchS203 on
2020-02-06_12:08:28 MQTT2_sonoffswitchS203 set_off
2020-02-06_12:08:28 MQTT2_sonoffswitchS203 relay_0: 0
2020-02-06_12:08:28 MQTT2_sonoffswitchS203 off
2020-02-06_12:08:39 MQTT2_sonoffswitchS203 set_on
2020-02-06_12:08:39 MQTT2_sonoffswitchS203 relay_0: 1
2020-02-06_12:08:39 MQTT2_sonoffswitchS203 on
2020-02-06_12:08:41 MQTT2_sonoffswitchS203 set_off
2020-02-06_12:08:41 MQTT2_sonoffswitchS203 relay_0: 0
2020-02-06_12:08:41 MQTT2_sonoffswitchS203 off

Beta-User

Danke für die Rückmeldung, dann checke ich das mal ein*.

Was das LogFile angeht, ist das soweit klar: Jeder Event wird geloggt, das ist kein spezielles MQTT-Thema ;D .

(Mind. zwei) (kombinierbare) Ansätze:
2. https://fhem.de/commandref_modular.html#FileLog => "<regexp>" setzen...
1. event-on-change-reading (am MQTT2-Device) verwenden!
3. In diversen firmwares kann man die Wiederholungszeit einstellen, nach der bestimmte Statusmeldungen gesendet werden => ESPurna-Doku wälzen ;)

Ziff. 1 ist zu 2. vorzugswürdig bzw. in jedem Fall sinnvoll. *Werde das ins attrTemplate noch mit aufnehmen.
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: ZigBee2mqtt, MiLight@ESP-GW, BT@OpenMQTTGw | ZWave | SIGNALduino | MapleCUN | RHASSPY
svn: u.a Weekday-&RandomTimer, Twilight,  div. attrTemplate-files, MySensors

HM Krause

Mit den Statusmeldungen bei Espurna gibt es was, ich hab das schon mal gelesen.

Meine Sonoff-RF-Bridge ist übrigens auch Espurnaed, schon lange, sie läuft auch über Mosquitto. Hab sie mal dem MQTT2 eben vertickert..

defmod MQTT2_RFbridge MQTT2_DEVICE RFbridge
attr MQTT2_RFbridge IODev MQTT2_FHEM_Server
attr MQTT2_RFbridge readingList RFbridge:RFbridge/app:.* app\
RFbridge:RFbridge/version:.* version\
RFbridge:RFbridge/board:.* board\
RFbridge:RFbridge/host:.* host\
RFbridge:RFbridge/ssid:.* ssid\
RFbridge:RFbridge/ip:.* ip\
RFbridge:RFbridge/mac:.* mac\
RFbridge:RFbridge/rssi:.* rssi\
RFbridge:RFbridge/uptime:.* uptime\
RFbridge:RFbridge/datetime:.* datetime\
RFbridge:RFbridge/freeheap:.* freeheap\
RFbridge:RFbridge/relay/0:.* relay_0\
RFbridge:RFbridge/relay/1:.* relay_1\
RFbridge:RFbridge/relay/2:.* relay_2\
RFbridge:RFbridge/relay/3:.* relay_3\
RFbridge:RFbridge/relay/4:.* relay_4\
RFbridge:RFbridge/relay/5:.* relay_5\
RFbridge:RFbridge/relay/6:.* relay_6\
RFbridge:RFbridge/relay/7:.* relay_7\
RFbridge:RFbridge/vcc:.* vcc\
RFbridge:RFbridge/status:.* status\
RFbridge:RFbridge/loadavg:.* loadavg
attr MQTT2_RFbridge room MQTT2_DEVICE

setstate MQTT2_RFbridge 2020-02-06 13:33:47 app ESPURNA
setstate MQTT2_RFbridge 2020-02-06 13:33:47 board ITEAD_SONOFF_RFBRIDGE
setstate MQTT2_RFbridge 2020-02-06 13:33:47 datetime 2020-02-06 13:33:46
setstate MQTT2_RFbridge 2020-02-06 13:33:47 freeheap 13352
setstate MQTT2_RFbridge 2020-02-06 13:33:47 host RFbridge
setstate MQTT2_RFbridge 2020-02-06 13:33:47 ip 192.168.178.70
setstate MQTT2_RFbridge 2020-02-06 13:33:47 loadavg 2
setstate MQTT2_RFbridge 2020-02-06 13:33:47 mac 60:01:94:CC:2C:56
setstate MQTT2_RFbridge 2020-02-06 13:33:47 relay_0 0
setstate MQTT2_RFbridge 2020-02-06 13:33:47 relay_1 1
setstate MQTT2_RFbridge 2020-02-06 13:33:47 relay_2 0
setstate MQTT2_RFbridge 2020-02-06 13:33:47 relay_3 1
setstate MQTT2_RFbridge 2020-02-06 13:33:47 relay_4 0
setstate MQTT2_RFbridge 2020-02-06 13:33:47 relay_5 0
setstate MQTT2_RFbridge 2020-02-06 13:33:47 relay_6 0
setstate MQTT2_RFbridge 2020-02-06 13:33:47 relay_7 0
setstate MQTT2_RFbridge 2020-02-06 13:33:47 rssi -40
setstate MQTT2_RFbridge 2020-02-06 13:33:47 ssid Skynet-basic
setstate MQTT2_RFbridge 2020-02-06 13:33:47 status 1
setstate MQTT2_RFbridge 2020-02-06 13:33:47 subscriptions RFbridge/action/set RFbridge/led/+/set RFbridge/pulse/+/set RFbridge/relay/+/set RFbridge/rflearn/+/set RFbridge/rfout/set
setstate MQTT2_RFbridge 2020-02-06 13:33:47 uptime 2321950
setstate MQTT2_RFbridge 2020-02-06 13:33:47 vcc 3238
setstate MQTT2_RFbridge 2020-02-06 13:33:47 version 1.13.5


Beta-User

Hm, das RF-Zeug ist immer etwas speziell.

Hier sieht das so aus, als wäre jedem RF-Paar (für ein/aus) einer von 8 "relays" zugeordnet?

Dann würde ich ein "Hauptdevice" anlegen, das die ganzen Statusreadings bekommt und den ersten Kanal als "state", und dann für alle weiteren je manuell ein Sub-Device (eigenes MQTT2_DEVICE), das nur die setList- und readingList-Einträge für je einen Kanal enthält (und das dann nach "state" mappt).

Soweit klar?

Ansonsten, falls da auch erkannte RF-Codes weitergeben werden: Tasten drücken und den MQTT-Verkehr dazu mitschneiden und mal das tasmota-rf-Beispiel ansehen... (und/oder OpenMQTTBridge-rf).

Ist viel "Handarbeit"...
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: ZigBee2mqtt, MiLight@ESP-GW, BT@OpenMQTTGw | ZWave | SIGNALduino | MapleCUN | RHASSPY
svn: u.a Weekday-&RandomTimer, Twilight,  div. attrTemplate-files, MySensors

HM Krause

#13
Das läuft ja momentan auch schon alles länger mit Mosquitto. Im Gegensatz zur Tasmota FW kann die RF-Bridge mit Espurna hier auch autonom RF Codes lernen, also über das eigene Webinterface..Verwendung für die Bedienung der Sonoff-S20s mit einer Intertechno Fernbedienung. Also 8 Kanäle AN-AUS = 16 Befehle einlernbar. Andersrum WLAN zu RF habe ich es früher auch mal verwendet, aber da die Intertechnos keinen Status melden können, habe ich die nicht mehr. Im Moment verwende ich nur ein paar Readings der Bridge und setze damit notifys zum Schalten ab.

Beta-User

Na ja, wenn ich das richtig im Kopf habe, kann auch Tasmota (zwischenzeitlich?) RF-Codes paarweise für einige RF-Geräte speichern.

Wie dem auch sei, falls du ein template entwickeln wolltest, wäre das mMn. eine "Kreuzung" zwischen dem 1. ESPurna-template und dem shelly4pro_split, (getList-Einträge gäbe es nicht, die dortigen readingList und setList-Formate wären anzupassen, that's it more or less). (Aber grundsätzlich sind wir beieinander: Es macht nicht mehr den großen Sinn, Energie auf 433MHz-Zielgeräte zu verwenden; es sei denn, es ist was spezielles, das man nicht einfach so gegen bidirektionale Hardware ersetzen kann... Als Input-Device kann man das aber durchaus nutzen, mache ich bei MiLight ähnlich ;) ).
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: ZigBee2mqtt, MiLight@ESP-GW, BT@OpenMQTTGw | ZWave | SIGNALduino | MapleCUN | RHASSPY
svn: u.a Weekday-&RandomTimer, Twilight,  div. attrTemplate-files, MySensors