ngx-mqtt
ngx-mqtt copied to clipboard
Issue while getting Value not ack'd
Hi, I have a short Async procedure to get a value from ioBroker:
public async GetVal(topicname: string): Promise<string> {
const source$: Observable<string> = this._mqttClt.observe(topicname, {qos: 1}).pipe(
map((msg) => msg.payload.toString()),
take(1)
);
let val = await lastValueFrom(source$);
this.logMsg('GetVal >' + topicname + '< Value: >' + val + '<');
return val;
}
Unfortunately this only works if the Values has been set with Acknowledge. Otherwise this procedure will return noting.
Is there a way to get this also working for values that has been set without ACK? Or am I totally wrong and this not the right way?
Best regards Thomas