Tasmota_Serial-MQTT-Bridge_for_MQTT-CUL.md 2.4 KB

Tasmota Serial (MQTT) Bridge for MQTT-CUL

Hardware

  • Wemos D1 mini or equivalent ESP8266 board running Tasmota (tested with v9.3.1)
  • DIY-CUL device (Arduino Pro Mini with aCULfw + C1101 Transceiver)
    • RX/TX connected to Wemos D1 mini hardware UART (TX->RX and vice versa) using level shifters

Tasmota-Configuration

Set baudrate for Hardware-UART

CUL-Device uses 38400 bps

baudrate 38400
Set serial delimiter
serialdelimiter 128
  • CUL finishes every message with CR+LF (\r\n)
  • serialdelimiter 128 filters all unprintable chars and seems to take both CR and LF as a delimiter - at least both are filtered out and consequent messages are not concatenated, which happens if using NO serialdelimiter (value set to >128)
Set serial config
SerialConfig 8N1
Initialize CUL on Tasmota startup

Additionally, Tasmota´s Serial bridge is only active after the SerialSend function was used once after startup.

In my setup I need to get also "RAW" data from CUL, as I am using remote controls not directly supported by the aCULfw firmware, so I use the X05 command. If this is not needed, the right command is likely to be X21. For details see: http://culfw.de/commandref.html

rule1 on system#boot do serialsend X05\r\n endon

activate the rule:

rule1 1
Additional rule for publishing SerialReceived output on another topic
rule2 on SerialReceived#Data do publish MQTTCUL/received %value% endon
  • Unfortunately this rule will only work if ther is NO control char in the received string, so it is mandatory to use a SerialDelimiter setting that filters out all of them (i.E. SerialDelimiter 128 does the job).
  • The output of this rule is ALWAYS UPPERCASE. Don´t know why, but that´s how Tasmota handles it. Regarding CUL output this could be a problem, as it outputs lowercase chars in most messages.
    • CUL2MQTT.py handles this by putting all data received from MQTT-CUL topic to lowercase (as all of the logic has already been completed and was written based on the normal lowercase output seen on any CUL device).
    • CUL2MQTT.py now also supports the Tasmota tele/TOPIC/RESULT output in JSON format directly. It is preferred to use it this way, without the additional rule.