Not that this is useful, but the exact error presented in “openhab.log” is
2019-07-24 19:43:32.726 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'MQTT_LISTENER - telemetry_listeners#health_topic': 'channel' is not a member of 'org.eclipse.smarthome.core.thing.events.ChannelTriggeredEvent'; line 576, column 29, length 21
This repeats for each failed trigger.
My mqtt (v2) is configured as:
Thing topic telemetry_listeners "telemetry_listeners"{
Channels:
//health
Type string : heating#health_topic "heating#health_topic" [stateTopic="heating/health",trigger=true]
//... each device has its own like this
}
And the rule is in this format:
rule "MQTT_LISTENER - telemetry_listeners#health_topic"
when
Channel "mqtt:topic:mosquitto:telemetry_listeners:heating#health_topic" triggered or
Channel "mqtt:topic:mosquitto:telemetry_listeners:bedroom#health_topic" triggered or
// other triggers of the same format
then
var String logrulename= receivedEvent.channel.id.split("#").get(0)+"health_topic"
var String debugdata = "Success"
try{
//logInfo(logrulename, "Topic and Payload")
//logInfo(logrulename, "starting")
//var thingUID = receivedEvent.channel.thingUID.toString; // ID portion of channel (everything after the last ':')
//logInfo(logrulename, "thingUID="+ thingUID)
var id = receivedEvent.channel.id.toString; // Thing ID portion of channel (everything before the last ':')
//logInfo(logrulename, "id="+ id)
var deviceid = id.split("#").get(0)
//logInfo(logrulename, "deviceid="+ deviceid)
var payload = receivedEvent.getEvent()
logInfo(logrulename, "payload="+ payload)
// left rest of rule out for brevity
Essentially I have my devices broadcasting telemetry data in a set format, and the items in OH with a naming convention allowing me to use one rule for all devices to findfirst the item based on the topic.
Since I sometimes send all, or partial data in a payload in json format, the normal channel binding way is not a viable option, since it fails/complains if the payload doesn’t contain a key which is sometimes absent.
Of course, the fact one rule can handle any topics/triggers I assign to it without creating more channals and editing the items is ideal, saves lots of code changing… if this worked all the time anyway haha