Open zehnm opened 6 years ago
MDNS analysis:
hap
(Apple Homekit afaik)Node.js test:
'use strict';
const bonjour = require('bonjour')();
function printObject(o) {
let out = '';
Object.getOwnPropertyNames(o).forEach( (name, index) => {
out += (index > 0 ? ',' : '') + name + '=' + o[name];
});
return out;
}
function serviceUpListener(service) {
if (!service || !service.txt || !service.host) {
return;
}
if (service.host.startsWith('myStrom-Switch')) {
console.log('MDNS discovered "%s": host=%s, MAC=%s, txt=[%s]', service.name, service.host, service.txt.id, printObject(service.txt));
}
}
const mdnsBrowser = bonjour.find({ type: 'hap' }, serviceUpListener);
mdnsBrowser.start();
Output (with masked mac addresses):
MDNS discovered "Switch-ef0011": host=myStrom-Switch-ef0011.local, MAC=de:ad:be:ef:00:11, txt=[c#=1,ff=0,id=de:ad:be:ef:00:11,md=Switch-ef0011,pv=1.0,s#=2,sf=1,ci=8]
MDNS discovered "Outlet ef0022": host=myStrom-Switch-ef0022.local, MAC=de:ad:be:ef:00:22, txt=[c#=1025720861,ff=0,id=de:ad:be:ef:00:22,md=Outlet ef0022,pv=1.0,s#=1,sf=1,ci=7]
The auto discovery of WiFi Switch v2 devices is already implemented and working fine. Version 2 is the currently available device with integrated temperature sensor. V1 devices have the same REST API but don't have a temperature sensor and don't announce themself by UDP broadcast on port 7979.
Enhancement: auto discovery for v1 switches.
Official information received from mystrom.ch support:
Unfortunately I've been unable to discover a v1 switch with UPNP. I've tried various tools, libraries and my own code under Linux and OSX. My analysis so far:
ssdp:discover
requests to standard multicast address and port239.255.255.250:1900
. Tried with search target (ST)ssdp:all
andupnp:rootdevice
:239.255.255.250:1900
) withssdp:alive
:I’m able to discover all other UPNP devices on my network (router, Logitech Harmony, TV, Radio, NEEO remote, Plex), with upnp tools, Wireshark and my own code. Therefore I assume something is wrong or ‘special’ with the myStrom WiFi Switch v1.
Does anyone have an idea or further information?