{"record":{"id":"20150249768c5da2","repo":"mgth/LittleBigMouse","slug":"enter-the-projector-wi-fi-mac-address-first","errorCode":null,"errorMessage":"Enter the projector Wi-Fi MAC address first.","messagePattern":"Enter the projector Wi-Fi MAC address first\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"LittleBigMouse.Plugins/LittleBigMouse.Plugin.Vcp.Avalonia/HisenseVidaa/HisenseVidaaService.cs","lineNumber":193,"sourceCode":"            c.Brand = \"his\";\n        }\n        _store.Save(c);\n    }\n    /// <summary>\n    /// Slower burst than Tizen, and the trailing delay is kept: awaiting PowerOnAsync\n    /// therefore leaves the projector 150 ms to react before the caller reconnects.\n    /// </summary>\n    static readonly WakeOnLanOptions WakeOnLanBurst = new()\n    {\n        PacketCount = 3,\n        Port = 9,\n        DelayBetweenPackets = TimeSpan.FromMilliseconds(150),\n        DelayAfterLastPacket = true,\n    };\n\n    public Task PowerOnAsync(string id, CancellationToken ct = default)\n    {\n        var c=Required(id); if (string.IsNullOrWhiteSpace(c.MacAddress)) throw new InvalidOperationException(\"Enter the projector Wi-Fi MAC address first.\"); return WakeOnLan.SendAsync(c.MacAddress, WakeOnLanBurst, cancellationToken: ct);\n    }\n    HisenseVidaaConfiguration Required(string id) => _store.Get(id) is { } c && !string.IsNullOrWhiteSpace(c.IpAddress) ? c : throw new InvalidOperationException(\"Associate a Hisense VIDAA projector first.\");\n\n    async Task<HisenseVidaaClient> ClientForAsync(string id, HisenseVidaaConfiguration configuration)\n    {\n        HisenseVidaaClient? previous = null;\n        HisenseVidaaClient client;\n        lock (_clientLock)\n        {\n            if (_clients.TryGetValue(id, out client!)\n                && SameConnection(client.Configuration, configuration)) return client;\n\n            previous = client;\n            client = new HisenseVidaaClient(configuration);\n            _clients[id] = client;\n        }\n\n        if (previous is not null) await previous.DisposeAsync().ConfigureAwait(false);","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/mgth/LittleBigMouse/blob/7a42f01d47d99d223b8ee33ba4019af82adf1c48/LittleBigMouse.Plugins/LittleBigMouse.Plugin.Vcp.Avalonia/HisenseVidaa/HisenseVidaaService.cs#L175-L211","documentation":"PowerOnAsync wakes a Hisense VIDAA projector by sending a Wake-on-LAN magic packet to the device's stored Wi-Fi MAC address. Before sending, it loads the configuration via Required(id) and checks that MacAddress is non-empty; if the MAC address was never configured (or was cleared), it throws InvalidOperationException telling the user to enter the projector Wi-Fi MAC address first.","triggerScenarios":"Calling PowerOnAsync(id) when HisenseVidaaConfiguration.MacAddress for that id is null, empty, or whitespace — e.g. the projector was added with only an IP address, or the MAC field was cleared after saving.","commonSituations":"Setting up a new projector without completing the MAC address field; configuring by IP only and assuming WoL will work; a config migration or manual edit dropping the MacAddress; powering on before the projector has ever been on the network to learn its MAC.","solutions":["Open the Hisense VIDAA configuration for this device id and enter the projector's Wi-Fi MAC address (see NormalizeMac for accepted formats).","Find the MAC on the projector's network settings screen or from your router's DHCP lease list, then save the config and retry.","Before calling PowerOnAsync, check the stored configuration: var c = store.Get(id); if (string.IsNullOrWhiteSpace(c?.MacAddress)) prompt for the MAC.","Catch InvalidOperationException and direct the user to the MAC address field in the UI."],"exampleFix":"// before\nawait service.PowerOnAsync(id); // throws if MacAddress missing\n// after\nvar config = store.Get(id);\nif (string.IsNullOrWhiteSpace(config?.MacAddress))\n    throw new InvalidOperationException(\"Configure the projector Wi-Fi MAC address before power-on.\");\nawait service.PowerOnAsync(id);","handlingStrategy":"validation","validationCode":"var config = store.Get(id);\nif (config is null || string.IsNullOrWhiteSpace(config.IpAddress))\n    throw new InvalidOperationException(\"Associate a Hisense VIDAA projector first.\");\nif (string.IsNullOrWhiteSpace(config.MacAddress))\n    throw new InvalidOperationException(\"Enter the projector Wi-Fi MAC address first.\");\nawait service.PowerOnAsync(id);","typeGuard":"public static bool IsPowerOnReady(HisenseVidaaConfiguration? c) =>\n    c is { IpAddress: { Length: > 0 }, MacAddress: { Length: > 0 } };","tryCatchPattern":"try { await service.PowerOnAsync(id); }\ncatch (InvalidOperationException ex) { ShowConfigError(ex.Message); /* direct user to MAC field */ }","preventionTips":["Validate the full configuration (IpAddress + MacAddress) when saving the projector settings, not at power-on time.","Normalize and store the MAC via HisenseVidaaProtocol.NormalizeMac at save time.","Disable the Power On button in the UI until the MAC address field is filled.","Re-check config after any migration or manual edit of the settings store."],"tags":["wake-on-lan","configuration","missing-mac-address","network","hisense"],"backgroundTag":"missing-required-config-field","analyzedSha":"7a42f01d47d99d223b8ee33ba4019af82adf1c48","analyzedAt":"2026-09-16T00:35:00.514Z","contentChangedAt":"2026-09-16T00:35:00.514Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}