Skip to content

Commit

Permalink
update admin and docs to refer to emoncms_mqtt service
Browse files Browse the repository at this point in the history
  • Loading branch information
glynhudson committed Feb 6, 2019
1 parent 897c67b commit 6f28951
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
3 changes: 2 additions & 1 deletion Modules/admin/admin_main_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ function system_information() {

$services = array();
$services['emonhub'] = getServiceStatus('emonhub.service');
$services['mqtt_input'] = getServiceStatus('mqtt_input.service');
$services['mqtt_input'] = getServiceStatus('mqtt_input.service'); // depreciated, replaced with emoncms_mqtt
$services['emoncms_mqtt'] = getServiceStatus('emoncms_mqtt.service');
$services['feedwriter'] = getServiceStatus('feedwriter.service');
$services['service-runner'] = getServiceStatus('service-runner.service');
$services['emonPiLCD'] = getServiceStatus('emonPiLCD.service');
Expand Down
26 changes: 13 additions & 13 deletions docs/RaspberryPi/MQTT.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,45 +53,45 @@ In the settings file in the **MQTT** section change `$mqtt_enabled` from `false`

The `basetopic` option sets the base MQTT topic to which Emoncms subscribes. The default base topic is `emon` which means Enmoncms will subcribe to `emon/#`. In emonpi, this base topic needs to match the MQTT basetopic published from emonHub.

### Run Emoncms phpmqtt_input script
### Run Emoncms emoncms_mqtt script

Install `phpmqtt_input` systemd unit script and make it start on boot:
Install `emoncms_mqtt` systemd unit script and make it start on boot:

```
sudo cp /var/www/emoncms/scripts/mqtt_input.service /etc/systemd/system/mqtt_input.service
sudo systemctl daemon-reload
sudo systemctl enable mqtt_input.service
sudo ln -s /var/www/emoncms/scripts/services/emoncms_mqtt/emoncms_mqtt.service /etc/systemd/system
sudo systemctl enable emoncms_mqtt.service
```

Start / stop / restart with:

```
sudo systemctl start mqtt_input
sudo systemctl stop mqtt_input
sudo systemctl restart mqtt_input
sudo systemctl start emoncms_mqtt
sudo systemctl stop emoncms_mqtt
sudo systemctl restart emoncms_mqtt
```

View status / log snippet with:

`sudo systemctl status mqtt_input -n50`
`sudo systemctl status emoncms_mqtt -n50`

*Where -nX is the number of log lines to view*

Log can be viewed as text and standard text manipulation tools can be applied:

`sudo journalctl -f -u mqtt_input -o cat | grep emonpi`
`sudo journalctl -f -u emoncms_mqtt -o cat | grep emonpi`

Or with a datestamp:

`sudo journalctl -f -u mqtt_input -o short`
`sudo journalctl -f -u emoncms_mqtt -o short`

There are lots of journalctrl output options: `short, short-iso, short-precise, short-monotonic, verbose,export, json, json-pretty, json-sse, cat`

To view `mqtt_info` in the emoncms log, change emoncms loglevel to `1` (info) in `settings.php` then restart `mqtt_input`.
To view `mqtt_info` in the emoncms log, change emoncms loglevel to `1` (info) in `settings.php` then restart `emoncms_mqtt`.

#### An alternative for systems not running systemd

On older operating systems, or those not running systemd, the mqtt_input script can be run as a init.d daemon instead of the above which uses a systemd unit script instead. Install either this or the above, **Not both!**
On older operating systems, or those not running systemd, the emoncms mqtt service can be run as a init.d daemon instead of the above which uses a systemd unit script instead.
Install either this or the above, **Not both!**

Create a symlink to run the MQTT Input script as a daemon and set permissions
```
Expand Down

0 comments on commit 6f28951

Please sign in to comment.