AwoX / Eglo BLE Lights

Hi,

i have one AwoX/Eglo Light (BLE) at home and i think there is no BLE App for that brand. Are someone here who wants to help develop a Homey Pro app for that?

https://github.com/redi78/homey_eglo_awox_ble/tree/main

What device did you write the code for? Do you have a link to the BLE Light?

Hi,

it is this Lamp: EGLO ROMAO-C LED

When i actually run the app Code i get follow error:
BlePeripherlal not defined.

Could you pair it in the AwoX App?

Is this also a Zigbee device?

How did you develop this code?

Hi Dijker,

no - because Homey AwoX App only supports Zigbee, as far i know.
And this Light is BLE only.

I found that old code and thought we could update it:

Hi,

mhh is there something wrong, because i get the error “BlePeripheral undefinded”:

class Eglo_Awox_SmartlightDriver extends Homey.Driver {

    onInit() {
        this.log('Eglo_Awox_SmartlightDriver has been inited');
    }

    async onPairListDevices(data) {
        try {
            this.log('Pair listing of devices started');
            const deviceList = await this.discoverLights();
            this.log('Pair listing of devices completed');
            return deviceList;
        } catch (error) {
            this.log('Error during pair listing of devices:', error);
            throw error;
        }
    }

    async discoverLights() {
        try {
            this.log('Device discovery started');
            // discover all peripherals that have AwoX Company Identifier (0x0160)
            const bleAdvertisements = await Homey.ManagerBLE.discover();

            const eglo_awox_Lights = [];

            for (let i = 0; i < bleAdvertisements.length; i++) {
                const manufacturerID = bleAdvertisements[i].manufacturerData.readInt16LE();
                this.log("Found a device with manufacturer ID:", manufacturerID);

                if (manufacturerID == 0x0160) {
                    this.log("Connecting to an Eglo_AwoX device...");
                    // Connect to the BLE device
                    const blePeripheral = await bleAdvertisements[i].connect();
                    this.log("Connected to an Eglo_AwoX device...");

                    await sleep(100);

                    // Discover everything after connecting to the BLE device
                    await blePeripheral.discoverAllServicesAndCharacteristics();
                    this.log("Discovered an Eglo_AwoX device...");

                    // Get device info
                    const device_name = await blePeripheral.read(BLE_SERVICES_GENERIC_ACCESS, BLE_CHARACTERISTICS_DEVICE_NAME);
                    const appearance = await blePeripheral.read(BLE_SERVICES_GENERIC_ACCESS, BLE_CHARACTERISTICS_APPEARANCE);
                    const model_number = await blePeripheral.read(BLE_SERVICES_DEVICE_INFORMATION, BLE_CHARACTERISTICS_MODEL_NUMBER_STRING);
                    const firmware_version = await blePeripheral.read(BLE_SERVICES_DEVICE_INFORMATION, BLE_CHARACTERISTICS_FIRMWARE_REVISION_STRING);
                    const hardware_revision = await blePeripheral.read(BLE_SERVICES_DEVICE_INFORMATION, BLE_CHARACTERISTICS_HARDWARE_REVISION_STRING);
                    const manufacturer_name = await blePeripheral.read(BLE_SERVICES_DEVICE_INFORMATION, BLE_CHARACTERISTICS_MANUFACTURER_Name_STRING);

                    // Convert Buffer to human-readable string
                    const deviceNameStr = device_name.toString('utf-8').replace(/\0/g, '');
                    const appearanceStr = appearance.toString('utf-8').replace(/\0/g, '');
                    const firmwareVersionStr = firmware_version.toString('utf-8').replace(/\0/g, '');
                    const manufacturerNameStr = manufacturer_name.toString('utf-8').replace(/\0/g, '');
                    const modelNumberStr = model_number.toString('utf-8').replace(/\0/g, '');
                    const hardwareRevisionStr = hardware_revision.toString('utf-8').replace(/\0/g, '');

                    const device = {
                        name: manufacturerNameStr + " " + deviceNameStr + " (" + bleAdvertisements[i].uuid + ")",
                        data: {
                            uuid: bleAdvertisements[i].uuid,
                            firmware_version: firmwareVersionStr,
                            manufacturer_name: manufacturerNameStr,
                            model_number: modelNumberStr,
                            hardware_revision: hardwareRevisionStr,
                        },
                    };
                    eglo_awox_Lights.push(device);

                    await blePeripheral.disconnect();
                }
            }
            return eglo_awox_Lights;
        } catch (error) {
            await blePeripheral.disconnect();
            throw error;
        }
    }

}