diyhue / diyHue

Main diyHue software repo
https://diyhue.org/
Other
1.57k stars 279 forks source link

Cant add Milight devices on WEBUI #1025

Closed Justdigit closed 3 months ago

Justdigit commented 4 months ago

Issue does not already exist?

I have searched and found no existing issue

Select Environment

Docker

Home Assistant related?

No

Description

In the WebUI i cant add a device. I want to add two milight lamps. But when i press the "add Light" button noting happens. Also no error or confirmation notice in the upper right corner.

Looks like the button is not mapped?

Errorlog:

This can be downloaded from the webUI.
DiyHue > Bridge > Brdige Control > Download debug > Log tar
This is also included in Full debug
[diyhue_log (5).zip](https://github.com/user-attachments/files/16150641/diyhue_log.5.zip)
If diyHue does not start upload from normal log

Steps to reproduce

Add Milight light and click "add light"

Please enter your operating system details here

OS: Linux Architecture: aarch64 os_version: '#1 SMP PREEMPT Tue Jun 18 15:11:43 UTC 2024' os_release: 6.6.31-haos-raspi Hue-Emulator Version: '2024-07-09 22:15:19.000000000' WebUI Version: '2024-07-09 22:15:30.000000000'

Upload debug tar


This can be downloaded from the webUI.
DiyHue > Bridge > Brdige Control > Download debug > Full debug
Do not upload from Force config dump, Force config dump contains sensitive information
``
[config_debug (6).zip](https://github.com/user-attachments/files/16150633/config_debug.6.zip)

### What DiyHue version(branch) are you using?

master (latest)
Justdigit commented 4 months ago

Here a piece of the live debug log in Home Assistant.

In this part i have pressed the Add light Button.

024-07-09 23:17:32,826 - werkzeug - INFO - 192.168.1.166 - - [09/Jul/2024 23:17:32] "GET /lights HTTP/1.1" 200 - 2024-07-09 23:17:34,812 - werkzeug - INFO - 192.168.1.166 - - [09/Jul/2024 23:17:34] "GET /lights HTTP/1.1" 200 - 2024-07-09 23:17:36,813 - werkzeug - INFO - 192.168.1.166 - - [09/Jul/2024 23:17:36] "GET /lights HTTP/1.1" 200 - 2024-07-09 23:17:37,814 - werkzeug - INFO - 192.168.1.166 - - [09/Jul/2024 23:17:37] "GET /api/0d5a1ca83e3111efae18e45f015ca97f/config/swupdate2 HTTP/1.1" 200 - 2024-07-09 23:17:37,820 - werkzeug - INFO - 192.168.1.166 - - [09/Jul/2024 23:17:37] "GET /api/0d5a1ca83e3111efae18e45f015ca97f/groups/0 HTTP/1.1" 200 - 2024-07-09 23:17:38,812 - werkzeug - INFO - 192.168.1.166 - - [09/Jul/2024 23:17:38] "GET /lights HTTP/1.1" 200 - 2024-07-09 23:17:39,924 - services.stateFetch - INFO - start lights sync 2024-07-09 23:17:39,925 - services.stateFetch - DEBUG - fetch tasmota-1A039E-0926 2024-07-09 23:17:39,925 - lights.protocols.tasmota - DEBUG - tasmota: invoked! 2024-07-09 23:17:40,006 - services.stateFetch - DEBUG - {'on': True, 'xy': [0.32272672086556803, 0.3290229095590793], 'bri': 255, 'colormode': 'xy'} 2024-07-09 23:17:40,007 - services.stateFetch - DEBUG - fetch wled-Woonkamer_seg0 2024-07-09 23:17:40,071 - services.stateFetch - DEBUG - {'bri': 255, 'on': True, 'xy': [0.4486385908145413, 0.37213909220552277], 'colormode': 'xy'} 2024-07-09 23:17:40,072 - services.stateFetch - DEBUG - fetch wled-Wall_seg0 2024-07-09 23:17:40,349 - services.stateFetch - DEBUG - {'bri': 255, 'on': True, 'xy': [0.17320560525754272, 0.10532662744942092], 'colormode': 'xy'} 2024-07-09 23:17:40,350 - services.stateFetch - DEBUG - fetch Ambilight Monitor 1 2024-07-09 23:17:40,481 - services.stateFetch - DEBUG - {'on': True, 'bri': 254, 'xy': [0.494417, 0.286214], 'ct': 447, 'hue': 0, 'sat': 254, 'colormode': 'xy'} 2024-07-09 23:17:40,483 - services.stateFetch - DEBUG - fetch wled-Hue Play Li_seg0 2024-07-09 23:17:40,693 - werkzeug - INFO - 192.168.1.166 - - [09/Jul/2024 23:17:40] "GET /lights HTTP/1.1" 200 - 2024-07-09 23:17:42,658 - werkzeug - INFO - 192.168.1.166 - - [09/Jul/2024 23:17:42] "GET /api/0d5a1ca83e3111efae18e45f015ca97f/groups/0 HTTP/1.1" 200 - 2024-07-09 23:17:42,662 - werkzeug - INFO - 192.168.1.166 - - [09/Jul/2024 23:17:42] "GET /api/0d5a1ca83e3111efae18e45f015ca97f/config/swupdate2 HTTP/1.1" 200 - 2024-07-09 23:17:42,695 - werkzeug - INFO - 192.168.1.166 - - [09/Jul/2024 23:17:42] "GET /lights HTTP/1.1" 200 - 2024-07-09 23:17:44,812 - werkzeug - INFO - 192.168.1.166 - - [09/Jul/2024 23:17:44] "GET /lights HTTP/1.1" 200 - 2024-07-09 23:17:46,811 - werkzeug - INFO - 192.168.1.166 - - [09/Jul/2024 23:17:46] "GET /lights HTTP/1.1" 200 - 2024-07-09 23:17:47,820 - werkzeug - INFO - 192.168.1.166 - - [09/Jul/2024 23:17:47] "GET /api/0d5a1ca83e3111efae18e45f015ca97f/config/swupdate2 HTTP/1.1" 200 - 2024-07-09 23:17:47,816 - werkzeug - INFO - 192.168.1.166 - - [09/Jul/2024 23:17:47] "GET /api/0d5a1ca83e3111efae18e45f015ca97f/groups/0 HTTP/1.1" 200 - 2024-07-09 23:17:48,815 - werkzeug - INFO - 192.168.1.166 - - [09/Jul/2024 23:17:48] "GET /lights HTTP/1.1" 200 -

hendriksen-mark commented 4 months ago

Hi, on my setup i can add lights via the webui, including milight(i dont have them) and i get a added notification.

2024-07-09 23:16:26,271 - flaskUI.restful - INFO - {'protocol': 'milight', 'ip': '192.168.1.200', 'config': {'lightName': 'test', 'lightModelID': 'LOM001', 'miID': '0x1234', 'miModes': 'rgbw', 'miGroups': '1'}}
2024-07-09 23:16:26,273 - werkzeug - INFO - 192.168.1.3 - - [09/Jul/2024 23:16:26] "POST /api/xxx/lights HTTP/1.1" 200 -

Can you change other things on the webui? like search for updates(pres the bell on the top right and then on no update) or change the sw version?

Justdigit commented 4 months ago

Hi, on my setup i can add lights via the webui, including milight(i dont have them) and i get a added notification.

2024-07-09 23:16:26,271 - flaskUI.restful - INFO - {'protocol': 'milight', 'ip': '192.168.1.200', 'config': {'lightName': 'test', 'lightModelID': 'LOM001', 'miID': '0x1234', 'miModes': 'rgbw', 'miGroups': '1'}}
2024-07-09 23:16:26,273 - werkzeug - INFO - 192.168.1.3 - - [09/Jul/2024 23:16:26] "POST /api/xxx/lights HTTP/1.1" 200 -

Can you change other things on the webui? like search for updates(pres the bell on the top right and then on no update) or change the sw version?

Yes i can change everything and see the status message. It finds the WLED lights automatically.

Only manual adding lights not. I have tried with other Webbrowsers and incognito mode. Is there a URL which I can try which simulates "add light"?

hendriksen-mark commented 4 months ago

that is strange. it is a post url so you cant do it in a browser, you need to use postman or something. what does the console of the browser say? right click on screen > inspect > console.

Justdigit commented 3 months ago

console

Is see some errors??? But i dont know how to handle. I removed The Chrome extension

hendriksen-mark commented 3 months ago

This is the log for the webui. Strange thing is preventdefault is not used anymore. I will look into it. When i know more i will let you know.

hendriksen-mark commented 3 months ago

I think i found the issue, please update en let me know if it works now. You can update via the webui on the top right or rebuild the HA addon.

Justdigit commented 3 months ago

I think i found the issue, please update en let me know if it works now. You can update via the webui on the top right or rebuild the HA addon.

Nope unfortunatly it didnt fix the problem. I have fired up a VM and tried on other Browser Edge. Its still the same. Here a screenshot. Screenshotdiyhue

hendriksen-mark commented 3 months ago

So you still have the same error in the console of the browser? Can you click on the AddLight.jsx 23:9 and send a screen?

Justdigit commented 3 months ago

`import { useState } from "react";

import axios from "axios"; import { toast } from "react-hot-toast";

import GenericButton from "../GenericButton/GenericButton"; import GenericText from "../GenericText/GenericText"; import SelectMenu from "../SelectMenu/SelectMenu";

const AddLight = ({ HOST_IP, API_KEY }) => { const [lightData, setLightData] = useState({ protocol: "auto", });

const handleChange = (key, value) => { setLightData({ ...lightData,

});

};

const handleForm = (evt) => { evt.preventDefault(); const { protocol: lightproto, ip: lightip, ...rest } = lightData; const formattedData = { protocol: lightproto, ip: lightip, config: rest, }; axios .post(${HOST_IP}/api/${API_KEY}/lights, formattedData) .then(() => { toast.success("Light added!"); }) .catch((error) => { console.error(error); toast.error(Error occurred: ${error.message}); });

};

const protocols = [ { value: "auto", label: "Autodetect" }, { value: "domoticz", label: "Domoticz" }, { value: "flex", label: "Flex" }, { value: "jeedom", label: "Jeedom" }, { value: "milight", label: "MiLight" }, { value: "mibox", label: "Mi Box" }, { value: "wiz", label: "Wiz" }, ];

const milightGroups = [ { value: "1", label: "1" }, { value: "2", label: "2" }, { value: "3", label: "3" }, { value: "4", label: "4" }, ];

const milightModes = [ { value: "rgbw", label: "RGBW" }, { value: "cct", label: "CCT" }, { value: "rgb_cct", label: "RGB-CCT" }, { value: "rgb", label: "RGB" }, ];

const lightModelIds = [ { value: "LOM001", label: "On/Off Plug" }, { value: "LWB010", label: "Dimmable Light" }, { value: "LTW001", label: "Color temperature Light" }, { value: "LCT015", label: "Color Light" }, { value: "LST002", label: "Color Strip" }, ];

return (<> <SelectMenu label="Protocol:" defaultValue={protocols[0]} options={protocols} placeholder={lightData.protocol} onChange={(e) => handleChange("protocol", e)} />

handleChange("ip", e)} />
{lightData.protocol !== "auto" && (
  <>
    <div className="form-control">
      <GenericText
        label="Name"
        type="text"
        placeholder="Name used on diyhue"
        value={lightData.lightName}
        onChange={(e) => handleChange("lightName", e)}
      />
    </div>
    <div className="form-control">
      <SelectMenu
        label="Emulated light type:"
        options={lightModelIds}
        placeholder={lightData.lightModelID}
        onChange={(e) => handleChange("lightModelID", e)}
      />
    </div>
  </>
)}
{(lightData.protocol === "milight" || lightData.protocol === "mibox") && (
  <>
    <div className="form-control">
      <GenericText
        label="Device ID"
        type="text"
        placeholder="0x1234"
        value={lightData.miID}
        onChange={(e) => handleChange("miID", e)}
      />
    </div>
    <div className="form-control">
      <SelectMenu
        label="Choose light mode:"
        options={milightModes}
        placeholder={lightData.miModes}
        onChange={(e) => handleChange("miModes", e)}
      />
    </div>
    <div className="form-control">
      <SelectMenu
        label="Choose light group:"
        options={milightGroups}
        placeholder={lightData.miGroups}
        onChange={(e) => handleChange("miGroups", e)}
      />
    </div>
  </>
)}
{lightData.protocol === "mibox" && (
  <div className="form-control">
    <GenericText
      label="Port"
      type="number"
      placeholder="Mi Box port"
      value={lightData.miBoxPort}
      onChange={(e) => handleChange("miboxPort", e)}
    />
  </div>
)}
{lightData.protocol === "domoticz" && (
  <div className="form-control">
    <GenericText
      label="Device ID"
      type="text"
      placeholder="Device ID"
      value={lightData.domoticzID}
      onChange={(e) => handleChange("domoticzID", e)}
    />
  </div>
)}
{lightData.protocol === "jeedom" && (
  <>
    <div className="form-control">
      <GenericText
        label="Light Api"
        type="text"
        placeholder="Light Api"
        value={lightData.jeedomlightAPI}
        onChange={(e) => handleChange("jeedomlightAPI", e)}
      />
    </div>
    <div className="form-control">
      <GenericText
        label="Light ID"
        type="text"
        placeholder="Light ID"
        value={lightData.jeedomlightID}
        onChange={(e) => handleChange("jeedomlightID", e)}
      />
    </div>
  </>
)}
<div className="form-control">
  <GenericButton
    value="Add Light"
    color="blue"
    size=""
    type="submit"
    onClick={() => handleForm()}
  />
</div>

</>); };

export default AddLight; `

hendriksen-mark commented 3 months ago

Ok thank you, new release is online, please try again. i already had found this issue but did not push it to the main, sorry.

Justdigit commented 3 months ago

Ok thank you, new release is online, please try again. i already had found this issue but did not push it to the main, sorry.

Yes!!! i can add the milight lamps again... Thanks for the quick help. Awesome!!