@liv-in-sky
let wlan = '1'; // 1 -> 2.4GHz ( für diesen Fall missverständlich )
let fritzCommandDP = 'tr-064.0.states.command';
let fritzResultDP = 'tr-064.0.states.commandResult';
let cmdHostListPath = {'service': 'urn:dslforum-org:service:Hosts:'+wlan,'action': 'X_AVM-DE_GetHostListPath','params': {}};
sendCMD(JSON.stringify(cmdHostListPath));
async function sendCMD(cmd) {
setState(fritzCommandDP, cmd);
const obj = await once({ id: fritzResultDP });
// log("Erg: " + obj.state.val);
let erg = JSON.parse(obj.state.val);
// log(erg["NewX_AVM-DE_HostListPath"]);
const request = require('request');
request('http://192.168.178.1:49000'+erg["NewX_AVM-DE_HostListPath"], { json: true }, (err, res, body) => {
if (err) { return console.log(err); }
//console.log(body.url);
//console.log(body.explanation);
//console.log(res);
console.log(body);
});
}
Machst du ein JSON daraus?