Community
OpenEnergyMonitor

OpenEnergyMonitor Community

What does emoncms do with unrecognised topic data from MQTT?

I have power consumption data published to an MQTT topic and that all looks to be working fine.

I now want to start publishing data from my weather station. Some of that might be useful in the context of power monitoring (solar intensity compared with the solar PV output, for instance) so I’ll publish it to the same topic, but other data is unlikely to be relevant (relative humidity, say, or wind direction).

What does emoncms do with data that is published to the topic it subscribes to, but isn’t configured to handle? For example if it sees some data for “emon/wind/speed”? Is it likely to cause errors anywhere?

James

Hello @JasF the emoncms_mqtt service is designed to be quite forgiving in the way it handles topic names. So emon/wind/speed should just pop up as an input in emoncms, that topic actually adheers to the standard emon/NODENAME/INPUTNAME structure.

You can also have topics that nest further e.g emon/weatherstation/wind/speed and I think that should result in a node called weatherstation and input called wind_speed

You will be best to publish it as a single message in JSON format rather than multiple single value topics.

It will appear on the inputs page, but if you don’t create a Feed. nothing happens.

If the data is non numerical, it will simply get ignored and the input will be NA (or null IIRC).

Thanks.

Publishing as single messages may not work as I also want other applications to be able use the data. It’s not going to be enormous amounts of information anyhow – at the moment I only process data from most of the weather station sensors every minute, the exception being the anemometer which is read repeatedly to allow a gust speed and average wind direction to be calculated, but I only report those once a minute too. Quite possibly an interval of a minute is far more often than really required for data such as air pressure.

If it does become a pain what I’ll probably do is add some code to allow the MQTT subscription-handling side to subscribe to multiple topics (whilst maintaining the current default behaviour).

James

For what it’s worth: ATIS (Automatic Terminal Information Service) for aircraft, which gives air pressure in whole millibars (equivalent to 30 ft in height/altitude - very important for setting altimeters) is updated every 30 minutes.

I’d take that to mean that air pressure will either change sufficiently slowly that half-hourly is an adequate interval, or so fast that you’ll have bigger problems to worry about :slight_smile:

James

If you’ve already recorded pressure (and other parameters), all you need to do is examine the records and determine the number of times the rate of change has exceeded some chosen value. And when that is sufficiently rare for your needs, the update rate is fast enough.

Good plan :slight_smile:

James