Hallo,
ich beschäftige mich seit ca 1 Woche mit MQTT und hab mit Sonoff (Tasmota) und Mosquitto meine ersten Schritte gemacht.
Nun habe ich auch in FHEM entdeckt, dass man Geräte publishen kann und hab mein Homematic Temperatursensor entsprechend der Anleitung
eingerichtet.
Internals:
DEF 35
IODev myJeelink
LASTInputDev myJeelink
LaCrosse_lastRcv 2018-12-26 12:34:16
MSGCNT 58633
NAME Gartenhaustemperatur
NR 572
STATE Innen: 4.9 Außen: -0.4
TYPE LaCrosse
addr 35
battery_new 1
corr1 0
corr2 0
myJeelink_MSGCNT 58640
myJeelink_RAWMSG OK 9 53 130 3 228 125
myJeelink_TIME 2018-12-26 12:34:16
previousH 106
previousH2 125
previousT 4.9
previousT2 -0.3
sensorType 0=T(H)
READINGS:
2018-12-26 12:34:16 battery ok
2018-08-22 16:45:00 humidity 98
2017-01-06 01:22:58 rain 0
2018-12-26 12:33:19 state T: 4.9
2018-12-26 12:33:19 temperature 4.9
2018-12-26 12:34:16 temperature2 -0.4
2017-01-06 01:22:58 windDirectionDegree 292.5
2017-01-06 01:22:58 windDirectionText WNW
2017-01-06 01:22:58 windGust 57.8
2017-01-06 01:22:58 windSpeed 57.8
Attributes:
IODev myJeelink
alexaName Temperatur
alexaRoom Garten
alias Gartenhaus
event-min-interval 180
genericDeviceType thermometer
group Gartenhaus,Temperaturen
icon temp_temperature
mqttDefaults base={"/$device/$reading"} pub:qos=0 retain=0
mqttPublish *:topic={$base}
room Garten,Temperaturen,alexa
stateFormat {sprintf("Innen: %.1f Außen: %.1f ", ReadingsVal("Gartenhaustemperatur","temperature",0), ReadingsVal("Gartenhaustemperatur","temperature2",0))}
mqtt:
Internals:
CFGFN
DEF 192.168.2.92:1883
DeviceName 192.168.2.92:1883
FD 118
NAME mqtt
NOTIFYDEV global
NR 12143
NTFY_ORDER 50-mqtt
PARTIAL
STATE opened
TYPE MQTT
buf
msgid 11
ping_received 1
timeout 60
READINGS:
2018-12-26 12:38:16 connection active
2018-12-21 21:55:43 state opened
messages:
Attributes:
room Technik
mqttGeneric:
Internals:
CFGFN
DEF
IODev mqtt
NAME mqttGeneric
NR 54048
NTFY_ORDER 50-mqttGeneric
STATE ???
TYPE MQTT_GENERIC_BRIDGE
devspec .*
prefix mqtt
READINGS:
2018-12-26 12:01:23 device-count 1
2018-12-26 11:22:47 incoming-count 0
2018-12-26 11:22:47 outgoing-count 0
2018-12-26 11:27:09 transmission-state IO device initialized
2018-12-26 11:22:47 updated-reading-count 0
2018-12-26 11:22:47 updated-set-count 0
devices:
Gartenhaustemperatur:
:defaults:
pub:base {"/$device/$reading"}
pub:pub:qos 0
pub:retain 0
sub:base {"/$device/$reading"}
sub:pub:qos 0
sub:retain 0
:publish:
*:
mode R
topic {$base}
:subscribe:
globalDeviceExcludes:
globalReadingExcludes:
globalTypeExcludes:
pub:
FHEMWEB *
Global *
MQTT transmission-state
MQTT_BRIDGE transmission-state
MQTT_DEVICE transmission-state
MQTT_GENERIC_BRIDGE *
telnet *
sub:
FHEMWEB *
Global *
MQTT transmission-state
MQTT_BRIDGE transmission-state
MQTT_DEVICE transmission-state
MQTT_GENERIC_BRIDGE *
telnet *
subscribe:
subscribeExpr:
subscribeQos:
Attributes:
IODev mqtt
room Technik
Leide bekomme ich im log folgende Fehler ausgeworfen:
2018.12.26 12:33:19 2: MQTT_GENERIC_BRIDGE: evalValue: user value ('{$base}'') eval error: Unknown regexp modifier "/b" at (eval 428157) line 1, at end of line
Unknown regexp modifier "/t" at (eval 428157) line 1, at end of line
Unknown regexp modifier "/t" at (eval 428157) line 1, at end of line
Unknown regexp modifier "/e" at (eval 428157) line 1, at end of line
Unknown regexp modifier "/r" at (eval 428157) line 1, at end of line
Unknown regexp modifier "/y" at (eval 428157) line 1, at end of line
2018.12.26 12:33:19 2: MQTT_GENERIC_BRIDGE: evalValue: user value ('{$base}'') eval error: Unknown regexp modifier "/t" at (eval 428159) line 1, at end of line
Unknown regexp modifier "/e" at (eval 428159) line 1, at end of line
Unknown regexp modifier "/e" at (eval 428159) line 1, at end of line
Unknown regexp modifier "/r" at (eval 428159) line 1, at end of line
Unknown regexp modifier "/t" at (eval 428159) line 1, at end of line
Regexp modifiers "/a" and "/u" are mutually exclusive at (eval 428159) line 1, at end of line
Unknown regexp modifier "/r" at (eval 428159) line 1, at end of line
Unknown regexp modifier "/e" at (eval 428159) line 1, at end of line
2018.12.26 12:33:19 2: MQTT_GENERIC_BRIDGE: evalValue: user value ('{$base}'') eval error: Unknown regexp modifier "/t" at (eval 428161) line 1, at end of line
Unknown regexp modifier "/t" at (eval 428161) line 1, at end of line
Unknown regexp modifier "/e" at (eval 428161) line 1, at end of line
2018.12.26 12:34:16 2: MQTT_GENERIC_BRIDGE: evalValue: user value ('{$base}'') eval error: Unknown regexp modifier "/b" at (eval 428175) line 1, at end of line
Unknown regexp modifier "/t" at (eval 428175) line 1, at end of line
Unknown regexp modifier "/t" at (eval 428175) line 1, at end of line
Unknown regexp modifier "/e" at (eval 428175) line 1, at end of line
Unknown regexp modifier "/r" at (eval 428175) line 1, at end of line
Unknown regexp modifier "/y" at (eval 428175) line 1, at end of line
2018.12.26 12:34:16 2: MQTT_GENERIC_BRIDGE: evalValue: user value ('{$base}'') eval error: Unknown regexp modifier "/t" at (eval 428177) line 1, at end of line
Unknown regexp modifier "/e" at (eval 428177) line 1, at end of line
Unknown regexp modifier "/e" at (eval 428177) line 1, at end of line
Unknown regexp modifier "/r" at (eval 428177) line 1, at end of line
Unknown regexp modifier "/t" at (eval 428177) line 1, at end of line
Regexp modifiers "/a" and "/u" are mutually exclusive at (eval 428177) line 1, at end of line
Unknown regexp modifier "/r" at (eval 428177) line 1, at end of line
Unknown regexp modifier "/e" at (eval 428177) line 1, at end of line
Unknown regexp modifier "/2" at (eval 428177) line 1, at end of line
2018.12.26 12:38:14 2: MQTT_GENERIC_BRIDGE: evalValue: user value ('{$base}'') eval error: Unknown regexp modifier "/b" at (eval 428216) line 1, at end of line
Unknown regexp modifier "/t" at (eval 428216) line 1, at end of line
Unknown regexp modifier "/t" at (eval 428216) line 1, at end of line
Unknown regexp modifier "/e" at (eval 428216) line 1, at end of line
Unknown regexp modifier "/r" at (eval 428216) line 1, at end of line
Unknown regexp modifier "/y" at (eval 428216) line 1, at end of line
2018.12.26 12:38:14 2: MQTT_GENERIC_BRIDGE: evalValue: user value ('{$base}'') eval error: Unknown regexp modifier "/t" at (eval 428218) line 1, at end of line
Unknown regexp modifier "/e" at (eval 428218) line 1, at end of line
Unknown regexp modifier "/e" at (eval 428218) line 1, at end of line
Unknown regexp modifier "/r" at (eval 428218) line 1, at end of line
Unknown regexp modifier "/t" at (eval 428218) line 1, at end of line
Regexp modifiers "/a" and "/u" are mutually exclusive at (eval 428218) line 1, at end of line
Unknown regexp modifier "/r" at (eval 428218) line 1, at end of line
Unknown regexp modifier "/e" at (eval 428218) line 1, at end of line
Unknown regexp modifier "/2" at (eval 428218) line 1, at end of line
Was habe ich falsch gemacht und muss ich ändern, damit die Werte veröffentlicht werden und die Fehler verschwinden?
Danke.
Du verwendest base={"/$device/$reading"} um ein String mit Namen von Device und Reading zu erhalten. Daher die Anführungszeichen. Absolut richtig.
Aber du nimmst dann {$base} (ohne Anführungszeichen). Damit wird versucht, den Inhalt der Variable zu interpretieren, was jedoch kein gültiges Perl-Befehl darstellt. Daher die Fehlermeldungen.
Ich weiß, nicht sehr intuitiv oder Perl-konform, ist aber so implmentiert (war flexiebler und einfacher).
Nimm einfach {"$base"}.
Ich versuche diesen Umstand verständlich im Commandref zu beschreiben.
Habe jetzt für $base eine 'Sonderlocken' eingebaut, damit das auch so verwendet werden kann.
dann werde ich das gleich mal testen. Besten Dank!
Du musst ggf. morgen update machen oder heute das Modul direkt aus SVN nehmen.