B4R Question [SOLVED] MQTT Strange Behaviour

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi All,

[SOLVED]Increased in PubSubClient.h the MQTT_MAX_PACKET_SIZE to 512. Been a good learning ;). But it also triggered to use, instead of MQTT, the B4RSerializer which receives data from Domoticz - need to explore how to build B4RSerializer data from non B4X applications - i.e. sending data like boolean,byte,int.

[sorry for long note] seeking some thoughts on the cause of following strange behaviour:
Home Automation Domoticz server, running on a Raspberry Pi, publishes MQTT messages via topic "domoticz/out" - using Mosquitto Broker default port 1883. Incoming messages from MQTT to Domoticz can be read from topic "domoticz/in". To receive both, subscribe to "domoticz/#" .

Test 1
  • B4J v5.50 Beta #2 MQTT Client (Windows PC, jMQTT v1.00) connects to the Mosquitto MQTT broker and receives messages from topic "domoticz/out" [OK].
  • B4R v1.80 MQTT Client (Arduino MEGA, Ethernet, rMQTT v1.30) connects to the Mosquitto MQTT broker, subscribes to "domoticz/out" but does not receive messages from topic "domoticz/out" [NOT OK].
  • Tested an Arduino Sketch using the pubsubclient library and same behaviour = no messages for topic "domoticz/out" received.
Test 2
  • B4J v5.50 Beta #2 MQTT Broker & Client (Windows PC, jMQTT v1.00, jMQTTBroker v1.04) sending messages from topic "domoticz/out" (simulating Domoticz).
  • B4R v1.80 MQTT Client (Arduino MEGA, Ethernet, rMQTT v1.30) connects to the B4J MQTT broker , subscribes to "domoticz/out" and receives messages from topic "domoticz/out" as published by the B4J MQTT Broker [OK].
Test 3
  • B4R v1.80 MQTT Client (Arduino MEGA, Ethernet, rMQTT v1.3) connects to the Mosquitto MQTT broker, , subscribes to "domoticz/#", receives messages from topic "domoticz in" [OK] but does not receive messages from topic "domoticz/out" [NOT OK].
Tested also via Node-RED running on a Raspberry Pi - simple flow with "MQTT In Node" listening to topic "domoticz/out" - messages are received [OK].

Increased in PubSubClient.h the MQTT_MAX_PACKET_SIZE to 256 - did not solve.

Why are no messages received for topic "domoticz/out" by the B4R MQTT client?
There are no error messages displayed.

Any hints appreciated
 
Last edited:

rwblinn

Well-Known Member
Licensed User
Longtime User
Domoticz supports Lua and Python. As Python is more common, want to start with that by trying
  • sending from Domoticz to an ESP8266 data like boolean, integer, float, string
  • ESP8266 to send to Domoticz data like boolean, integer, float, string
In the meantime, solved post #1 by parsing the required Domoticz sensordata and packed into MQTT topic (ie topic "esp/led/switch", payload "on" or "off" - to even simplify further could be 0 or 1) which is send by Domoticz using mosquitto (event driven). This is working fine on the ESP8266 with B4R MQTT client.
... but the ESP8266 will eventually get many more sensors connected to be controlled by Domoticz.
 
Upvote 0

rwblinn

Well-Known Member
Licensed User
Longtime User
Thanks for Guidance:
  • will build first a solution using MQTT (as have found a way in Domoticz to reduce the MQTT message size). Also want to use Node-RED which has great MQTT support.
  • if thats running fine, will explore the option Domoticz Lua Scripting by using C Functions to communicate with the B4R Serializer.
 
Upvote 0
Top