MQTT publishing error


#1

My device is connecting via MQTT, but I get the warning “Publish Error - Retain not allowed”


#2

Yes, we do not support retained messages when connecting to our broker. You can read more about this and other limitations in our documentation.


#3

Ah, OK. Unfortunately I have no way of turning that off on my side.
How can I post sensor data via API?


#4

You can use the Device: Send State endpoint. You’ll want to authenticate the request using an application token.

Note, we do have API clients in a few languages that might make this easier for you


#5

ok, I’m doing a POST http request from Node Red with like this:

https://api.losant.com/applications/APPLICATION_ID/devices/DEVICE_ID/state

but I get the response :

{"type":"Validation","message":"deviceState is required"}

#6

What does the body of your request look like? Sounds like it’s either malformed or not included at all.

Here’s an example request body you can check against.