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

Correct MQTT Success Message from JSON Payload #4767

Closed
2 tasks done
IoT-CI-Ltd opened this issue May 17, 2024 · 1 comment
Closed
2 tasks done

Correct MQTT Success Message from JSON Payload #4767

IoT-CI-Ltd opened this issue May 17, 2024 · 1 comment
Labels
area:monitor Everything related to monitors help

Comments

@IoT-CI-Ltd
Copy link

IoT-CI-Ltd commented May 17, 2024

⚠️ Please verify that this question has NOT been raised before.

  • I checked and didn't find similar issue

🛡️ Security Policy

📝 Describe your problem

I am monitoring some hardware and would like to use the MQTT monitor type.

My connected (UP) message (in JSON) is:

{"gatewayID":"[REDACTED_ID]","state":"ONLINE"}

What do I place in the MQTT Success Message ?

📝 Error Message(s) or Log

No response

🐻 Uptime-Kuma Version

1.23.13

💻 Operating System and Arch

Ubunutu

🌐 Browser

Chrome

🖥️ Deployment Environment

  • Runtime: Docker
  • Database: sqlite
  • Filesystem used to store the database on: btrfs
  • number of monitors: 5
@CommanderStorm
Copy link
Collaborator

What part of the returned response is a monitor for you?

I would expect that you would want:

{"gatewayID":"[REDACTED_ID]","state":"ONLINE"}

Tip

We use mqttSuccessMessagereceivedMessage as the comparison. See

if (receivedMessage != null && receivedMessage.includes(monitor.mqttSuccessMessage)) {
heartbeat.msg = `Topic: ${monitor.mqttTopic}; Message: ${receivedMessage}`;
heartbeat.status = UP;
} else {
throw Error(`Message Mismatch - Topic: ${monitor.mqttTopic}; Message: ${receivedMessage}`);
}

@CommanderStorm CommanderStorm added the area:monitor Everything related to monitors label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:monitor Everything related to monitors help
Projects
None yet
Development

No branches or pull requests

2 participants