Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failure in MQTT import when Redis is not enabled #1774

Merged
merged 3 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion scripts/phpmqtt_input.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*

This script is deprecated. You should probably be using
scripts/services/emoncms_mqtt/emoncms_mqtt.php instead.

*/

// TBD: support user target in message schema
$mqttsettings = array(
'userid' => 1
Expand Down Expand Up @@ -164,7 +171,7 @@

// PUBLISH
// loop through all queued items in redis
if ($connected && $pub_count>10) {
if ($redis !== false && $connected && $pub_count>10) {
$pub_count = 0;
$publish_to_mqtt = $redis->hgetall("publish_to_mqtt");
foreach ($publish_to_mqtt as $topic=>$value) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/services/emoncms_mqtt/emoncms_mqtt.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@

// PUBLISH
// loop through all queued items in redis
if ($connected && $pub_count>10) {
if ($redis !== false && $connected && $pub_count>10) {
$pub_count = 0;
$publish_to_mqtt = $redis->hgetall("publish_to_mqtt");
foreach ($publish_to_mqtt as $topic=>$value) {
Expand Down