Installing Mosquitto for emoncms

I’m trying to get this to run on my Ubuntu installed emoncms (/var/www/html/emoncms). Have edited the locations to suit, but can’t get mqtt_input to run.

Jan 15 14:47:46 ip-172-31-45-141 systemd[1]: Stopped LSB: Starts phpmqtt_input agent daemon at boot time.
Jan 15 14:47:46 ip-172-31-45-141 systemd[1]: mqtt_input.service: Unit entered failed state.
Jan 15 14:47:46 ip-172-31-45-141 systemd[1]: mqtt_input.service: Failed with result ‘exit-code’.

I have tried running the underlying php file directly …

[email protected]:/var/www/html/emoncms/scripts$ sudo php phpmqtt_input.php
PHP Fatal error: Uncaught Error: Class ‘Mosquitto\Client’ not found in /var/www/html/emoncms/scripts/phpmqtt_input.php:101
Stack trace:
#0 {main}
thrown in /var/www/html/emoncms/scripts/phpmqtt_input.php on line 101

Any ideas?

Thanks

Here’s my incoming MQTT messages …

emon/44/1 4960
emon/44/2 3352
emon/44/3 2170
emon/52/1 9
emon/52/2 3003
emon/46/1 6270
emon/46/2 2940
emon/46/3 2250
emon/43/1 9990
emon/43/2 3362
emon/43/3 710
emon/52/1 9
emon/52/2 3003
emon/46/1 6270

And here’s my settings …

$mqtt_enabled = true;          // Activate MQTT by changing to true
$mqtt_server = array( 'host'     => 'localhost',
                      'port'     => 1883,
                      'user'     => 'xxxxx',
                      'password' => 'xxxxx',
                      'basetopic'=> 'emon'
                      );

Obvious questions

  • Have you followed these instructions?
  • You can subscribe to the MQTT feed from the command line using the same details as in the settings?

Aha, thanks. Had just got to installing sudo pecl install Mosquitto-alpha

That seems to have fixed my issue. And now am running just on mqtt.

Thanks for pointing me there …

Nick

A post was merged into an existing topic: Raspbian Stretch

I wonder why we are still using mosquitto-alpha? Anyone know?

A post was split to a new topic: Upgrading emonSD Mosquito version?