emoncms-docker icon indicating copy to clipboard operation
emoncms-docker copied to clipboard

MQTT integration

Open devdems opened this issue 5 years ago • 2 comments

Hi,

i have mqtt server and set the mqtt in emocms properties to point to it.

When i publish a message with mqttlense app to the topic i.e. "emon/2/test" value "100" i would expect that this creates an input in emoncms but nothing happens.

If i subscribe to this topic i can see that the message is published correctly.

Props in emoncsm docker:

MQTT_ENABLED | true MQTT_HOST | xx.xx.xx.xx MQTT_USER | mqtt MQTT_PASSWORD | xxxx MQTT_BASETOPIC | emon

devdems avatar Mar 24 '20 10:03 devdems

Way late to the party on this one, but as I've just been dealing with the same problem I can at least explain why I think it's happening so others might find it more quickly.

The current Docker image for emoncms (as of 22/12/2021) just runs Apache. It doesn't handle the additional processes required to read data from MQTT and push it into emoncms.

It's unclear to me whether scripts/phpmqtt_input.php should be used to do this job, or if scripts/services/emoncms_mqtt/emoncms_mqtt.php is more correct (they're almost, but not quite, identical). I assumed the first and added supervisord to the emoncms Docker image to start both that and Apache.

Unfortunately that's not quite sufficient as the script currently fails unless Redis is available. If you're already using it then you might be all good anyhow, but I'd suggest that Redis shouldn't really be a requirement unless you need emoncms to publish data back to MQTT (which is not something I need it to do).

jamesfidell avatar Dec 22 '21 18:12 jamesfidell

MQTT broker has to be run separately, enabling MQTT in this image means enabling mQTT protocol support and indicating where to find the broker instance with MQTT_HOST

nodje avatar Apr 29 '22 13:04 nodje