I would like to be able to filter out invalid messages at the broker level.
For example, my temperature sensors which involve 4 entities (temperature, humidity, RSSI, batter) often get invalid data which I can detect by humidity > 100.
I would like to filter these out wholesale at the broker level by doing something like:
function acl_check(clientid, username, topic, payload, qos, retain)
local json = require("cjson") -- Make sure Lua JSON library is available
local data = json.decode(payload)
-- Reject if "humidity" exists and is greater than 100
if data.humidity and tonumber(data.humidity) > 100 then
return mosq.AUTH_DENIED
end
return mosq.AUTH_GRANTED
end
And then modifying mosquitto.conf by adding:
plugin /usr/lib/mosquitto/auth_plugin.so
auth_plugin /etc/mosquitto/auth_filter.lua
My understanding is that this is not possible currently since you can’t add plugins to the add-on.
Is that correct?
If so, is there any way to add the plugin capability to the broker add-on?