Hauptmenü

Notify by subscribe mqtt

Begonnen von lewej, 14 November 2017, 20:46:56

Vorheriges Thema - Nächstes Thema

lewej

Hallo Zusammen,

ich habe folgendes device:


define SonoffBasic1 MQTT_DEVICE
attr SonoffBasic1 IODev myBroker
attr SonoffBasic1 devStateIcon ON:rc_GREEN:OFF OFF:rc_RED:ON
attr SonoffBasic1 group Sonoff
attr SonoffBasic1 publishSet ON OFF cmnd/SonoffBasic1/POWER
attr SonoffBasic1 room Steckdosen,System
attr SonoffBasic1 stateFormat POWER
attr SonoffBasic1 subscribeReading_RESULT stat/SonoffBasic1/RESULT
attr SonoffBasic1 subscribeReading_SENSOR tele/SonoffBasic1/SENSOR
attr SonoffBasic1 subscribeReading_STATE tele/SonoffBasic1/STATE
attr SonoffBasic1 subscribeReading_UPTIME tele/SonoffBasic1/UPTIME
attr SonoffBasic1 subscribeReading_state stat/SonoffBasic1/POWER


Wenn ich jetzt ein notify auf POWER mache, funktioniert es nicht, ich denke das liegt daran, das es nur ein Reading was als subscribeReading definiert worden ist.

define SonoffToLoxone notify Sonoff.*:(POWER.*|power.*) {LOXONE_Sonoff_OnOff("loxone","$NAME","$EVTPART0")}

Wie kann man sonst eine Änderung am Device mit dem notify triggern?

Gruß
lewej

eisman

#1
Hi,

ich habe das mit einer DOIF gelöst

([Kueche:rolloset] eq "off") (set Pin35 off-for-timer 0.5)
DOELSEIF ([Kueche:rolloset] eq "on") (set Pin33 off-for-timer 0.5)

Kueche ist das MQTT Device

und bisher geht es

gruss
1x FHEM Debian, Homematic,ZigBee,FS20 / 1X Raspberry, ConBee / 7x ESP
1x FHEM Debian, Homematic,Z2M             / 1X Raspberry, ConBee / 6x ESP
1x FHEM Debian,MQTT2                             / 1X Raspberry, i2c,onewire,gpio
1x auf Windows 2012 Hyper-V-S

Amenophis86

Wiki (https://wiki.fhem.de/wiki/Sonoff#FHEM_Anbindung):
ZitatEbenso notwendig ist das setzen der Regexp für den JSON Konverter.
define ej3 expandJSON Sonoff.*:.*:.{.*}
...
Aktuell dabei unser neues Haus mit KNX am einrichten. Im nächsten Schritt dann KNX mit FHEM verbinden. Allein zwei Dinge sind dabei selten: Zeit und Geld...