Community
OpenEnergyMonitor

OpenEnergyMonitor Community

DIYBMS publishing MQTT to EMONCMS

Tags: #<Tag:0x00007f88cc23a5f8> #<Tag:0x00007f88cc23a530>

Hi
Enabled In the settings, send information to the emoncms system. But on my system 20s (0 bank 0-15 + 1 bank 0-3) got values ​​only 0-13. Where are the others? :slight_smile:

What version of DIYBMS controller code are you running ?

version 4.20

I mean the controller code from github - is it the dark themed one?

Where can I see it?

Platform

ESP8266

[env:esp8266_d1minipro]

Yes. dark themed.

Ok, looking at the DIYBMS code it should be working!

I’m not completely sure on how the MQTT stuff works inside emoncms - can somebody suggest ways to trace MQTT traffic into emoncms ?

Perhaps this is done like this:

$ mosquitto_sub -v -u ‘emonpi’ -P ‘emonpimqtt2016’ -t ‘emon/#’

I’ll try to see

I don’t have mosquitto_sub on my emonpi install

I assume the web page shows all 20 modules without a problem?

We’ve had some issues with this in the past, often where people have lots of modules running and the ESP controller doesn’t seem to be able to keep up with the amount of data I’m trying to send over the network.

Yes, there are no problems with the web page.

I saw a miracle. It looks like one data packet managed to get through to the server once.

Perhaps it is worth sending data in parts so as not to load the processor?

p.s. I write from different computers, so different accounts

Yes, quite probably. What time frequency have you set up on the feeds/inputs on emoncms?

Standard, 60s

I’ve captured this issue on GITHUB, [https://github.com/stuartpittaway/diyBMSv4Code/issues/37]

I’ve also just made the code changes in the branch [https://github.com/stuartpittaway/diyBMSv4Code/tree/HysteresisRules]

If you can try compiling that and putting it on the controller and see how you get on. This release also includes all the new relay rule changes.

Thanks in the coming days I will try and write the result

1 Like

You can also change the default values of the topic in the code to emon/diybms. Without the obligatory “emon/” key, the values will not get into the input.

Link to documentation https://guide.openenergymonitor.org/technical/mqtt/

sudo apt install mosquito-clients

I’d suggest it might be the time taken to process the MQTT publish commands. What QOS do you use?

I cannot remember when I did the JSON decoding for emoncms, if I included the means of using multiple depths of JSON.

You could do it as a single publish. Note the Inputs are topic_subtopic_sensor. If you built that as a single JSON payload, it would speed things up.

[edit]

{"0_0_voltage":4.5}

etc

[edit]
Just watch for the payload character limit!!!

This reduces the load on emoncms and the MQTT Broker as well.

[edit]
You could just reduce the name to V, Ti, Te, B to save characters.

I confirm, everything worked as it should. All 20 values now come in chunks and it works. The cut-off and turn-on voltage of the relay was also set to 82000. Thank you!

Is it possible to add a setting to the MQTT choice of what to send (voltage, inttemp, exttemp,bypass)

I’m sure I can get that working, would you mind raising an issue on GitHub requesting it?