Hi. I’m a complete newbie to all of this BigClown world, MQTT and so on. So maybe the question is gonna be ill-posed, but… I expected this to be pretty easy and well documented, however, I wasn’t able to finish the task using the available documentation.
Prerequisite: Connecting the radio dongle to my Windows computer worked, (the new, beta) playground behaved well, displayed temperatures and so on. I also installed the dongle to my router and that also works fine.
Target: Connect the radio dongle to my Turris Omnia (OpenWRT-based router) and have the same view on the data from playground on my notebook as when the dongle was locally connected.
Problem 1: The only way to set up a remote connection I found is in Functions->mqtt->Edit node->Server. I changed localhost to the router’s IP, but no data are passing through.
mosquitto_sub executed on the router normally returns messages from the climate module. So the data are there, they’re just not getting to my playground.
Problem 2: I assume that bcg is just some kind of relay without memory, so how do I make the playground display also historical data (e.g. in the chart component)? Do I need to install something more to the router?
Thank you for guiding me
1) MQTT over network
If you have running
mosquitto MQTT broker with working temperature messages on your router, then there should not be problem to connect to that broker from any other computer on your network. I set to the Playground Node-RED hostname of my Raspberry Pi and I can get the all MQTT messages.
Is the port 1883 opened in your Turris firewall? Can you connect to the MQTT broker on your Turris from other computer with MQTT client? Try
mosquitto_sub or GUI application like https://www.eclipse.org/paho/components/mqtt-spy/ from other computer on your network.
It is also possible to run node-red directly on the Turris Turris omnia and node-red on LXC
This would be the preffered way and all the logic and services will run on Turris. We use it the same in our bc-raspbian image for Raspberry Pi. The Playground is really just for the computer now, but we have plans that you will be able to discover Raspberries or other MQTT brokers in you network and switch to them. In playground there’s also Settings tab which is not visible in current beta, but there will be also option to set IP address of other MQTT broker on your network.
We are also working on BigClown hub which will look and work exactly like Playground application but will run on embedded devices in your browser. It will need only enabling MQTT over websockets in your mosquitto and some static web page server running. It will be out in a few weeks.
2) MQTT Data History
bcg is just the data bridge withou any history. You can use Chart node in the Dashboard of Node-RED however it can hold only few thousands points in memory and by pressing the
Deploy button all the data is lost. It is great to see some trends few days back.
The best long-term-solution logging is to use Grafana https://www.bigclown.com/doc/integrations/grafana-for-visualization/ and InfluxDB. We suggest that the data should be saved on USB flash drive or some SATA SSD. Do not use the internal e.MMC storage for writing a lot of data, it can damage the FLASH if you write too often too much of data.
Thank you very much, Martin. I followed your advices and so far I have node-red running in an LXC container on the Omnia. What was a bit surprising for me (as I’m new to MQTT/IoT) was that no data arrive until something actually changes, so I had to cover the light sensor with my hand to see some updates. With this knowledge, even connecting the Playground from my PC works.
What about the hub, is it somewhere near finished?
repo is here https://github.com/bigclownlabs/bch-hub-web
in the near future, I plan to release releases including a build.
You must add to mosquitto config these lines: