Anwendungsfälle und Beispiele für MQTT_GENERIC_BRIDGE

Begonnen von hexenmeister, 01 Oktober 2018, 10:57:38

Vorheriges Thema - Nächstes Thema

hexenmeister

Einfach ja, gut - meistens nicht. Damit pustet man ohne Kontrolle Daten raus. Kommt später ein neues Gerät hinzu - werden möglicherweise Daten gesendet, die man nicht senden wollte. Beim subscribe hätte man u. U. damit gleich ein Sicherheitsproblem.
globalPublish ist schon drin und wird auch jetzt bleiben, man sollte jedoch die Risiken im Auge behalten. globalSubscribe wird es aber nicht geben.

tomaszG

Hello,

I have already opened a topic for this problem https://forum.fhem.de/index.php/topic,99223.0.html

I have a fhem with a number of EnoCean devices paired. I am successfully using MQTT2_CLIENT and MQTT_GENERIC BRIDGE to forward measurmenet to an MQTT broker. Here is an extract of my config:


define locmqtt MQTT2_CLIENT xxxxx.xxxxx.xx:9883
setuuid locmqtt 5c7fba12-f33f-31d1-0d46-2eb4a2db7bd3bfb3
attr locmqtt SSL 1
attr locmqtt clientId rpn001
attr locmqtt subscriptions 1

define mqttGeneric MQTT_GENERIC_BRIDGE mqtt subType=hvac.04
setuuid mqttGeneric 5c54553c-f33f-d38f-19c2-06b4ddb36f166b9c
attr mqttGeneric IODev locmqtt
attr mqttGeneric globalDefaults base={"enocean/$device"}
attr mqttGeneric globalPublish *:topic={"$base/$reading"}


The attr locmqtt subscriptions 1 was just designed to avoid unnecessary subscriptions, but it may need to change ?
Now my goal is to send new setpointTemp values through MQTT to the valves, but I cant figure it out.
I realized that the EnOcean devices have a userattr that contains mqttSubscribe, eg:


define EnO_019AC3A8 EnOcean 019AC3A8
setuuid EnO_019AC3A8 5ca31d29-f33f-3d86-9e7a-021df6cc029d9742
attr EnO_019AC3A8 userattr mqttAlias:textField-long mqttDefaults:textField-long mqttDisable:both,incoming,outgoing mqttForward:all,none mqttPublish:textField-long mqttSubscribe:textField-long
attr EnO_019AC3A8 IODev TCM_ESP3_0
attr EnO_019AC3A8 comMode biDir
attr EnO_019AC3A8 destinationID unicast
attr EnO_019AC3A8 eep A5-20-04
attr EnO_019AC3A8 manufID 045
attr EnO_019AC3A8 room EnOcean
attr EnO_019AC3A8 subDef FF902D0C
attr EnO_019AC3A8 subType hvac.04
attr EnO_019AC3A8 teachMethod 4BS
attr EnO_019AC3A8 webCmd setpointTemp


If i understand correctly, I have to use this attribute somehow, but as it is in userattr, I don't quite understand how to make use of the snippets examples that hexenmeister has shared. Can you please help me out ?

elo

#32
Kann ich außer dem Topicnamen oder * auch ein Regex angeben?
* Sendet zu viele Werte
attr PVSMAEM mqttPublish *:topic={"fhem/pv/$device"} *:qos=1 *:retain=0 *:expression={"{\"$name\":".$value."}"}

und sie in oder | Abschnitte zu formatieren, macht auch keinen Sinn, da es über 30 Werte sind. (Das sprengt die fhem webAnzeige)

Alles was ich bisher versuchte, klappte leider nicht.

SMAEM12345678.*
SMAEM12345678*
SMAEM12345678.*$
SMAEM12345678/w
--
Raspi + FHEM 5.8 + HM-MOD-PCB + HM-LAN + HM-LC_Bl1PBU-FM + HM-LC-BL1-FM + HM-PB-2-WM + HM-LC-SW1-FM + HM-TC-IT-WM-W-EU + HM-CC-RT-DN

hexenmeister

Sorry für späte Antwort.  :(
Das wird so nicht unterstützt.
Du kannst aber mit * alle Readings greifen und dann mit Perlmitteln in der expression filtern.

irgendwie so (ungetestet):
desired-temp!info:expression={if($reading=~/SMAEM12345678.*/){$value}else{undef})}

PatrickR

Mahlzeit!

An dieser Stelle einen großen Dank an hexenmeister. Ich setze neben der Hauptinstanz zwei weitere FHEM-Instanzen ein, um Module auszulagern, die den ganzen Betrieb aufhalten. Das habe ich vorher mit einem Wust aus FHEM2FHEM, Notifies, Dummys etc. gelöst. Jetzt geht es elegant per MQTT_GENERIC_BRIDGE und die geklonten Geräte verhalten sich in der Hauptinstanz fast wie die echten. Es ist erfrischend, was mir so an Freezes entgeht, fast ohne Komfortverlust.

Patrick
lepresenced - Tracking von Bluetooth-LE-Tags (Gigaset G-Tag) mittels PRESENCE

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning." - Rich Cook