NEWS
Shelly >= 6.6.0 mit BLU-Geräten (Bluetooth Low Energy)
-
@humidor sagte in Shelly >= 6.6.0 mit BLU-Geräten (Bluetooth Low Energy):
@joesch80 dann liegt es nicht an der mehrfach Verwendung, aber woran dann?
Siehst du denn eine Statusänderung bei Betätigung der ersten beiden Sensoren in der Shelly-App?
-
@humidor Batterien mal geprüft? Bei meinen Blu Buttons waren die nach kurzer Zeit leer. Ein Firmware Update soll das beheben.
Hab mir das changelog angesehen und die Firmware ist auch für die Motion und noch ein anderes Gerät.
Vielleicht hilft ja ein Firmware update bei deinem Problem. -
@jey-cee sind grad mal 2 Wochen im Einsatz, bei Montage habe ich die Batterien getestet und das FW-Update gemacht. In der Shelly-App sehe ich die Änderung. Nur im Objektbau wird nicht aktualisiert.
-
@humidor es gibt ja zwei Einträge im Adapter für BLE, einmal die Allgemeine Übersicht und dann nochmal unter dem jeweiligen shelly. Da tut sich in keinem davon etwas?
Sind noch weitere BLE Geräte über diesen Shelly eingebunden und kommen da Daten an?
Weiteres was mir einfällt:
Hast du vielleicht versehentlich das Skript auf dem Shelly deaktiviert?
Ist in den BLE Einstellungen auf dem Shelly das Bluetooth Gateway (die dritte Option bei Bluetooth) aktiviert? Die verhindert auch das Daten an den Adapter geschickt werden. -
@jey-cee das Script läuft auf einem 1 PM, der Übermittelt mir Daten, das Gateway ist deaktiviert.
allerdings sehe ich gerade, dass am 0-10V Dimmer das Gateway aktiviert ist, wo die 3 neuen BLE hängen und diese funktionieren.
Script läuft natürlich. -
@humidor die 2 ersten BL‘s kommen nicht mehr rein, die neuen 3 fkt einwandfrei?
-
Ich hab mal das Script angepasst.
MAC Adresse in Namen übersetzen und die Zeile ersetzt damit ein BLU H&T die Werte richtig überträgt. Vielleicht hilft es ja dem ein oder anderen.// v0.2 custom let SCRIPT_VERSION = '0.2'; let BTHOME_SVC_ID_STR = 'fcd2'; let uint8 = 0; let int8 = 1; let uint16 = 2; let int16 = 3; let uint24 = 4; let int24 = 5; let BTH = {}; let SHELLY_ID = undefined; const BTH = { 0x00: { n: 'pid', t: uint8 }, 0x01: { n: 'battery', t: uint8, u: '%' }, 0x02: { n: 'temperature', t: int16, f: 0.01, u: 'tC' }, 0x45: { n: 'temperature', t: int16, f: 0.1, u: 'tC' }, 0x03: { n: 'humidity', t: uint16, f: 0.01, u: '%' }, 0x2e: { n: 'humidity', t: uint8, u: '%' }, 0x05: { n: 'illuminance', t: uint24, f: 0.01 }, 0x1a: { n: 'door', t: uint8 }, 0x20: { n: 'moisture', t: uint8 }, 0x21: { n: 'motion', t: uint8 }, 0x2d: { n: 'window', t: uint8 }, 0x3a: { n: 'button', t: uint8 }, 0x3f: { n: 'rotation', t: int16, f: 0.1 } }; // Mapping of MAC addresses to individual names let macToName = { 'aa:bb:cc:dd:ee:ff': 'Device1', '11:22:33:44:55:66': 'Device2' }; function getByteSize(type) { if (type === uint8 || type === int8) return 1; if (type === uint16 || type === int16) return 2; if (type === uint24 || type === int24) return 3; // impossible as advertisements are much smaller return 255; } let BTHomeDecoder = { utoi: function (num, bitsz) { let mask = 1 << (bitsz - 1); return num & mask ? num - (1 << bitsz) : num; }, getUInt8: function (buffer) { return buffer.at(0); }, getInt8: function (buffer) { return this.utoi(this.getUInt8(buffer), 8); }, getUInt16LE: function (buffer) { return 0xffff & ((buffer.at(1) << 8) | buffer.at(0)); }, getInt16LE: function (buffer) { return this.utoi(this.getUInt16LE(buffer), 16); }, getUInt24LE: function (buffer) { return ( 0x00ffffff & ((buffer.at(2) << 16) | (buffer.at(1) << 8) | buffer.at(0)) ); }, getInt24LE: function (buffer) { return this.utoi(this.getUInt24LE(buffer), 24); }, getBufValue: function (type, buffer) { if (buffer.length < getByteSize(type)) return null; let res = null; if (type === uint8) res = this.getUInt8(buffer); if (type === int8) res = this.getInt8(buffer); if (type === uint16) res = this.getUInt16LE(buffer); if (type === int16) res = this.getInt16LE(buffer); if (type === uint24) res = this.getUInt24LE(buffer); if (type === int24) res = this.getInt24LE(buffer); return res; }, unpack: function (buffer) { // beacons might not provide BTH service data if (typeof buffer !== 'string' || buffer.length === 0) return null; let result = {}; let _dib = buffer.at(0); result['encryption'] = _dib & 0x1 ? true : false; result['BTHome_version'] = _dib >> 5; if (result['BTHome_version'] !== 2) return null; // can not handle encrypted data if (result['encryption']) return result; buffer = buffer.slice(1); let _bth; let _value; while (buffer.length > 0) { _bth = BTH[buffer.at(0)]; if (typeof _bth === 'undefined') { console.log('Error: unknown type ' + buffer.at(0)); break; } buffer = buffer.slice(1); _value = this.getBufValue(_bth.t, buffer); if (_value === null) break; if (typeof _bth.f !== 'undefined') _value = _value * _bth.f; result[_bth.n] = _value; buffer = buffer.slice(getByteSize(_bth.t)); } return result; } }; let lastPacketId = 0x100; // Callback for the BLE scanner object function bleScanCallback(event, result) { // exit if not a result of a scan if (event !== BLE.Scanner.SCAN_RESULT) { return; } // exit if service_data member is missing if ( typeof result.service_data === 'undefined' || typeof result.service_data[BTHOME_SVC_ID_STR] === 'undefined' ) { // console.log('Error: Missing service_data member'); return; } let unpackedData = BTHomeDecoder.unpack( result.service_data[BTHOME_SVC_ID_STR] ); // exit if unpacked data is null or the device is encrypted if ( unpackedData === null || typeof unpackedData === "undefined" || unpackedData["encryption"] ) { console.log('Error: Encrypted devices are not supported'); return; } // exit if the event is duplicated if (lastPacketId === unpackedData.pid) { return; } lastPacketId = unpackedData.pid; unpackedData.rssi = result.rssi; unpackedData.address = result.addr; // Convert MAC address to lowercase for case insensitive matching let macLower = result.addr.toLowerCase(); let deviceName = macToName[macLower] || result.addr; // create MQTT-Payload let message = { scriptVersion: SCRIPT_VERSION, src: SHELLY_ID, srcBle: { type: result.local_name, mac: deviceName }, payload: unpackedData }; console.log('Received ' + JSON.stringify(unpackedData)); if (MQTT.isConnected()) { MQTT.publish(SHELLY_ID + '/events/ble', JSON.stringify(message)); } } // Initializes the script and performs the necessary checks and configurations function init() { // get the config of ble component let bleConfig = Shelly.getComponentConfig('ble'); // exit if the BLE isn't enabled if (!bleConfig.enable) { console.log('Error: The Bluetooth is not enabled, please enable it in the settings'); return; } // check if the scanner is already running if (BLE.Scanner.isRunning()) { console.log('Info: The BLE gateway is running, the BLE scan configuration is managed by the device'); } else { // start the scanner let bleScanner = BLE.Scanner.Start({ duration_ms: BLE.Scanner.INFINITE_SCAN, active: true }); if (!bleScanner) { console.log('Error: Can not start new scanner'); } } BLE.Scanner.Subscribe(bleScanCallback); } Shelly.call('Mqtt.GetConfig', '', function (res, err_code, err_msg, ud) { SHELLY_ID = res['topic_prefix']; init(); });
-
Hallo, ich habe aktuell ein Problem.
Ich habe den Shelly blu Motion soweit ins Syytem bekommen.
Wenn ich den Raum betrete schalten die Lichter auch an und im Iobroker steht detection (1).
Nach einiger Zeit steht Clear(0) und er springt nach der Blindzeit wieder auf Detection(1).
Das macht er 5-6 mal und immer geht das Licht an und aus. Nach einiger Zeit. hört es auf und er bleibt auf clear(0).Woran liegt das???
Was mache ich falsch???
Hier das script dazu
on({ id: [].concat(['shelly.1.ble.e8:e0:7e:bf:46:63.motion']), change: 'ne' }, async (obj) => { let value = obj.state.val; let oldValue = obj.oldState.val; if (getState('shelly.1.ble.e8:e0:7e:bf:46:63.motion').val == true && getState('shelly.1.ble.e8:e0:7e:bf:46:63.illuminance').val < 10) { // Licht Vorraum setState('shelly.1.shelly1minig3#84fce63a1670#1.Relay0.Switch' /* Schalter */, true); // Licht Stufe setState('shelly.0.SHDM-2#C8C9A33BF8AF#1.lights.Switch' /* Schalter */, true); } else if (getState('shelly.1.ble.e8:e0:7e:bf:46:63.motion').val == false) { // Licht Vorraum setStateDelayed('shelly.1.shelly1minig3#84fce63a1670#1.Relay0.Switch' /* Schalter */, false, 1800000, false); // Licht Tablet setStateDelayed('shelly.1.shelly1minig3#84fce638dec0#1.Relay0.Switch' /* Schalter */, false, 1800000, false); // Stufe setStateDelayed('shelly.0.SHDM-2#C8C9A33BF8AF#1.lights.Switch' /* Schalter */, false, 1800000, false); } }); on({ id: [].concat(['shelly.1.ble.e8:e0:7e:bf:46:63.motion']), change: 'ne' }, async (obj) => { let value = obj.state.val; let oldValue = obj.oldState.val; if (getState('shelly.1.ble.e8:e0:7e:bf:46:63.motion').val == true) { // Licht Tablet setState('shelly.1.shelly1minig3#84fce638dec0#1.Relay0.Switch' /* Schalter */, true); } }); //JTNDeG1sJTIweG1sbnMlM0QlMjJodHRwcyUzQSUyRiUyRmRldmVsb3BlcnMuZ29vZ2xlLmNvbSUyRmJsb2NrbHklMkZ4bWwlMjIlM0UlM0NibG9jayUyMHR5cGUlM0QlMjJvbl9leHQlMjIlMjBpZCUzRCUyMkR4dVZmJTNCZkVqJTI0ZGdXTiU3Q21PMnhRJTIyJTIweCUzRCUyMjExMyUyMiUyMHklM0QlMjItODclMjIlM0UlM0NtdXRhdGlvbiUyMHhtbG5zJTNEJTIyaHR0cCUzQSUyRiUyRnd3dy53My5vcmclMkYxOTk5JTJGeGh0bWwlMjIlMjBpdGVtcyUzRCUyMjElMjIlM0UlM0MlMkZtdXRhdGlvbiUzRSUzQ2ZpZWxkJTIwbmFtZSUzRCUyMkNPTkRJVElPTiUyMiUzRW5lJTNDJTJGZmllbGQlM0UlM0NmaWVsZCUyMG5hbWUlM0QlMjJBQ0tfQ09ORElUSU9OJTIyJTNFJTNDJTJGZmllbGQlM0UlM0N2YWx1ZSUyMG5hbWUlM0QlMjJPSUQwJTIyJTNFJTNDc2hhZG93JTIwdHlwZSUzRCUyMmZpZWxkX29pZCUyMiUyMGlkJTNEJTIycGx5bDdBTi4lM0QlNDAlN0NTJTI0JTNGVmZrUGk4JTIyJTNFJTNDZmllbGQlMjBuYW1lJTNEJTIyb2lkJTIyJTNFc2hlbGx5LjEuYmxlLmU4JTNBZTAlM0E3ZSUzQWJmJTNBNDYlM0E2My5tb3Rpb24lM0MlMkZmaWVsZCUzRSUzQyUyRnNoYWRvdyUzRSUzQyUyRnZhbHVlJTNFJTNDc3RhdGVtZW50JTIwbmFtZSUzRCUyMlNUQVRFTUVOVCUyMiUzRSUzQ2Jsb2NrJ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M0UlM0MlMkZibG9jayUzRSUzQyUyRm5leHQlM0UlM0MlMkZibG9jayUzRSUzQyUyRnN0YXRlbWVudCUzRSUzQyUyRmJsb2NrJTNFJTNDJTJGc3RhdGVtZW50JTNFJTNDJTJGYmxvY2slM0UlM0MlMkZuZXh0JTNFJTNDJTJGYmxvY2slM0UlM0MlMkZ4bWwlM0U=
-
Hier noch ein Bild vom Blockly:
-
Wenn ich es richtig verstehe willst du wenn Bewegung erkannt das Licht für Zeit x an ist.
Dann müsst ja noch einen Timer einbauen der immer von vorne beginnt wenn eine neue Bewegung erkannt wird.
Aber so macht er es ja richtig Bewegung an keine Bewegung aus dann wieder Bewegung an.
-
@apfelwurm leider, auch dieses Script bringt mir kein Event in den ioBroker
-
Hallo,
danke für die Antworten. Funktioniert jetzt.
-
Hi zusammen
ich hätte mal eine Frage zu diesem Thema.
Ich habe jetzt ein neues Shelly Gateway und darauf ein das neue Shelly BLU TRV verbunden.Ich schaffe es leider nicht per MQTT die Daten in den iobroker zu bringen. Hab schon mehrere Anpassungen am Script versucht.
Das ist der Script den ich drin hab im BLU Gateway Gen.3Ich habe alles nach der Anleitung hier gemacht:
https://github.com/iobroker-community-adapters/ioBroker.shelly/blob/master/docs/en/ble-devices.mdDas neueste Script ist drin.
// v0.4 const SCRIPT_VERSION = '0.4'; const BTHOME_SVC_ID_STR = 'fcd2'; const uint8 = 0; const int8 = 1; const uint16 = 2; const int16 = 3; const uint24 = 4; const int24 = 5; const uint32 = 6; const int32 = 7; let SHELLY_ID = undefined; const BTH = { // Misc 0x00: { n: 'pid', t: uint8 }, 0xf0: { n: 'device_type', t: uint16 }, 0xf1: { n: 'firmware_version', t: uint32 }, 0xf2: { n: 'firmware_version', t: uint24 }, // Sensor data 0x51: { n: 'acceleration', t: uint16, f: 0.001, u: 'm/s²' }, 0x01: { n: 'battery', t: uint8, u: '%' }, 0x12: { n: 'co2', t: uint16, u: 'ppm' }, 0x09: { n: 'count', t: uint8 }, 0x3d: { n: 'count', t: uint8 }, 0x3e: { n: 'count', t: uint8 }, 0x43: { n: 'current', t: uint16, f: 0.001, u: 'A' }, 0x08: { n: 'dewpoint', t: int16, f: 0.01, u: '°C' }, 0x40: { n: 'distance_mm', t: uint16, u: 'mm' }, 0x41: { n: 'distance_m', t: uint16, f: 0.1, u: 'm' }, 0x42: { n: 'duration', t: uint24, f: 0.001, u: 's' }, 0x4d: { n: 'energy', t: uint32, f: 0.001, u: 'kWh' }, 0x0a: { n: 'energy', t: uint24, f: 0.001, u: 'kWh' }, 0x4b: { n: 'gas', t: uint24, f: 0.001, u: 'm3' }, 0x4c: { n: 'gas', t: uint32, f: 0.001, u: 'm3' }, 0x52: { n: 'gyroscope', t: uint16, f: 0.001, u: '°/s' }, 0x03: { n: 'humidity', t: uint16, f: 0.01, u: '%' }, 0x2e: { n: 'humidity', t: uint8, u: '%' }, 0x05: { n: 'illuminance', t: uint24, f: 0.01, u: 'lux' }, 0x06: { n: 'mass_kg', t: uint16, f: 0.01, u: 'kg' }, 0x07: { n: 'mass_lb', t: uint16, f: 0.01, u: 'lb' }, 0x14: { n: 'moisture', t: uint16, f: 0.01, u: '%' }, 0x2f: { n: 'moisture', t: uint8, u: '%' }, 0x0d: { n: 'pm2_5', t: uint16, u: 'ug/m3' }, 0x0e: { n: 'pm10', t: uint16, u: 'ug/m3' }, 0x0b: { n: 'power', t: uint24, f: 0.01, u: 'W' }, 0x04: { n: 'pressure', t: uint24, f: 0.01, u: 'hPa' }, 0x3f: { n: 'rotation', t: int16, f: 0.1, u: '°' }, 0x44: { n: 'speed', t: uint16, f: 0.01, u: 'm/s' }, 0x45: { n: 'temperature', t: int16, f: 0.1, u: '°C' }, 0x02: { n: 'temperature', t: int16, f: 0.01, u: '°C' }, 0x13: { n: 'tvoc', t: uint16, u: 'ug/m3' }, 0x0c: { n: 'voltage', t: uint16, f: 0.001, u: 'V' }, 0x4a: { n: 'voltage', t: uint16, f: 0.1, u: 'V' }, 0x4e: { n: 'volume', t: uint32, f: 0.001, u: 'l' }, 0x47: { n: 'volume', t: uint16, f: 0.1, u: 'l' }, 0x48: { n: 'volume', t: uint16, u: 'ml' }, 0x55: { n: 'volume', t: uint32, f: 0.001, u: 'l' }, 0x49: { n: 'volume', t: uint16, f: 0.001, u: 'm3/h' }, 0x46: { n: 'uv_index', t: uint8, f: 0.1 }, 0x4f: { n: 'water', t: uint32, f: 0.001, u: 'l' }, // Binary Sensor data 0x15: { n: 'battery', t: uint8 }, 0x16: { n: 'battery_charging', t: uint8 }, 0x17: { n: 'carbon_monoxide', t: uint8 }, 0x18: { n: 'cold', t: uint8 }, 0x19: { n: 'connectivity', t: uint8 }, 0x1a: { n: 'door', t: uint8 }, 0x1b: { n: 'garage_door', t: uint8 }, 0x1c: { n: 'gas', t: uint8 }, 0x0f: { n: 'generic_boolean', t: uint8 }, 0x1d: { n: 'heat', t: uint8 }, 0x1e: { n: 'light', t: uint8 }, 0x1f: { n: 'lock', t: uint8 }, 0x20: { n: 'moisture', t: uint8 }, 0x21: { n: 'motion', t: uint8 }, 0x22: { n: 'moving', t: uint8 }, 0x23: { n: 'occupancy', t: uint8 }, 0x11: { n: 'opening', t: uint8 }, 0x24: { n: 'plug', t: uint8 }, 0x10: { n: 'power', t: uint8 }, 0x25: { n: 'presence', t: uint8 }, 0x26: { n: 'problem', t: uint8 }, 0x27: { n: 'running', t: uint8 }, 0x28: { n: 'safety', t: uint8 }, 0x29: { n: 'smoke', t: uint8 }, 0x2a: { n: 'sound', t: uint8 }, 0x2b: { n: 'tamper', t: uint8 }, 0x2c: { n: 'vibration', t: uint8 }, 0x2d: { n: 'window', t: uint8 }, // Events 0x3a: { n: 'button', t: uint8, b: 1 }, 0x3c: { n: 'dimmer', t: uint8 } }; function getByteSize(type) { if (type === uint8 || type === int8) return 1; if (type === uint16 || type === int16) return 2; if (type === uint24 || type === int24) return 3; // impossible as advertisements are much smaller return 255; } let BTHomeDecoder = { utoi: function (num, bitsz) { let mask = 1 << (bitsz - 1); return num & mask ? num - (1 << bitsz) : num; }, getUInt8: function (buffer) { return buffer.at(0); }, getInt8: function (buffer) { return this.utoi(this.getUInt8(buffer), 8); }, getUInt16LE: function (buffer) { return 0xffff & ((buffer.at(1) << 8) | buffer.at(0)); }, getInt16LE: function (buffer) { return this.utoi(this.getUInt16LE(buffer), 16); }, getUInt24LE: function (buffer) { return ( 0x00ffffff & ((buffer.at(2) << 16) | (buffer.at(1) << 8) | buffer.at(0)) ); }, getInt24LE: function (buffer) { return this.utoi(this.getUInt24LE(buffer), 24); }, getUInt32LE: function (buffer) { return ( 0x00ffffffff & ((buffer.at(3) << 24) | (buffer.at(2) << 16) | (buffer.at(1) << 8) | buffer.at(0)) ); }, getInt32LE: function (buffer) { return this.utoi(this.getUInt32LE(buffer), 32); }, getBufValue: function (type, buffer) { if (buffer.length < getByteSize(type)) return null; let res = null; if (type === uint8) res = this.getUInt8(buffer); if (type === int8) res = this.getInt8(buffer); if (type === uint16) res = this.getUInt16LE(buffer); if (type === int16) res = this.getInt16LE(buffer); if (type === uint24) res = this.getUInt24LE(buffer); if (type === int24) res = this.getInt24LE(buffer); if (type === uint32) res = this.getUInt32LE(buffer); if (type === int32) res = this.getInt32LE(buffer); return res; }, unpack: function (buffer) { // beacons might not provide BTH service data if (typeof buffer !== 'string' || buffer.length === 0) return null; let result = {}; let _dib = buffer.at(0); result['encryption'] = _dib & 0x1 ? true : false; result['BTHome_version'] = _dib >> 5; if (result['BTHome_version'] !== 2) return null; // can not handle encrypted data if (result['encryption']) return result; buffer = buffer.slice(1); let _bth; let _value; let _name; let _btnNum = 1; while (buffer.length > 0) { _bth = BTH[buffer.at(0)]; if (typeof _bth === 'undefined') { console.log('Error: unknown type ' + buffer.at(0)); break; } buffer = buffer.slice(1); _value = this.getBufValue(_bth.t, buffer); if (_value === null) break; if (typeof _bth.f !== 'undefined') _value = _value * _bth.f; _name = _bth.n; if (typeof _bth.b !== "undefined") { _name = _name + '_' + _btnNum.toString(); _btnNum++; } result[_name] = _value; buffer = buffer.slice(getByteSize(_bth.t)); } return result; } }; let lastPacketId = 0x100; // Callback for the BLE scanner object function bleScanCallback(event, result) { // exit if not a result of a scan if (event !== BLE.Scanner.SCAN_RESULT) { return; } // exit if service_data member is missing if ( typeof result.service_data === 'undefined' || typeof result.service_data[BTHOME_SVC_ID_STR] === 'undefined' ) { // console.log('Error: Missing service_data member'); return; } let unpackedData = BTHomeDecoder.unpack( result.service_data[BTHOME_SVC_ID_STR] ); // exit if unpacked data is null or the device is encrypted if ( unpackedData === null || typeof unpackedData === 'undefined' || unpackedData['encryption'] ) { console.log('Error: Encrypted devices are not supported'); return; } // exit if the event is duplicated if (lastPacketId === unpackedData.pid) { return; } lastPacketId = unpackedData.pid; unpackedData.rssi = result.rssi; unpackedData.address = result.addr; // create MQTT-Payload let message = { scriptVersion: SCRIPT_VERSION, src: SHELLY_ID, srcBle: { type: result.local_name, mac: result.addr }, payload: unpackedData }; console.log('Received ' + JSON.stringify(unpackedData)); if (MQTT.isConnected()) { MQTT.publish(SHELLY_ID + '/events/ble', JSON.stringify(message)); } } // Initializes the script and performs the necessary checks and configurations function init() { // get the config of ble component let bleConfig = Shelly.getComponentConfig('ble'); // exit if the BLE isn't enabled if (!bleConfig.enable) { console.log('Error: The Bluetooth is not enabled, please enable it in the settings'); return; } // check if the scanner is already running if (BLE.Scanner.isRunning()) { console.log('Info: The BLE gateway is running, the BLE scan configuration is managed by the device'); } else { // start the scanner let bleScanner = BLE.Scanner.Start({ duration_ms: BLE.Scanner.INFINITE_SCAN, active: true }); if (!bleScanner) { console.log('Error: Can not start new scanner'); } } BLE.Scanner.Subscribe(bleScanCallback); } Shelly.call('Mqtt.GetConfig', '', function (res, err_code, err_msg, ud) { SHELLY_ID = res['topic_prefix']; init(); });
alle Adapter sind aktualisiert
Shelly Geräte auch alle,
JS Controller upgedatet.
Shelly Adapter ist auf : V8.2.1Ich bekomme vom Script immer die Meldung 84 zurück, weiß vielleicht jemand von euch woran das liegen könnte?
Dadurch hab ich auch bei den Objekten unter BLE nichts drin
Für einen Tipp wäre ich sehr dankbar.
Vielen Dank
LG Mathias -
-
@haus-automatisierung
oh, vielen Dank!
LG -
Hi,
hat sich schon jemand mit dem shelly blu wall switch 4 bzw. dem shelly blu rc button 4
beschäftigt. Habe das v0.3-Script im Einsatz und empfange darüber auch payloads von den o.g. Devices, aber so wie es aussieht muss wohl das Script für die o.g. Devices angepasst werden.
Hat sich schon jemand damit beschäftigt und kann mir ggf. einen Tip geben - danke vorab ! -
@rolfs Ist längst erledigt. Funktioniert mit der aktuellen Beta und dem neuesten Script