iobroker.govee-smart 3.0.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/README.md +31 -6
  2. package/admin/custom/assets/Components-BaqFjaqD.js +1 -0
  3. package/admin/custom/assets/_virtual_mf-localSharedImportMap___mfe_internal__ConfigCustomGoveeSegmentSet__mf_owner__1-0b3ub_8M.js +1 -0
  4. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomGoveeSegmentSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-CDkXizQd.js +1217 -0
  5. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomGoveeSegmentSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__.js-whCpEChV.js +1492 -0
  6. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomGoveeSegmentSet__mf_owner__1__prebuild___mf_0_iobroker_mf_1_gui_mf_2_components__prebuild__-D--Cwr-f.js +1 -0
  7. package/admin/custom/assets/{hostInit-BIlCl_F-.js → hostInit-DUi1Gdy1.js} +1 -1
  8. package/admin/custom/assets/iconLibraryData-B5fiyl1C.js +1 -0
  9. package/admin/custom/assets/{lib-D_TOKWDo.js → lib-8aH_uNin.js} +2 -2
  10. package/admin/custom/assets/{virtual_mf-exposes___mfe_internal__ConfigCustomGoveeSegmentSet__customComponents_js-vMZWrbcg.js → virtualExposes-PWwUj0Dy.js} +1 -2
  11. package/admin/custom/assets/virtual_mf-exposes-ssr___mfe_internal__ConfigCustomGoveeSegmentSet__customComponents_js-BGm_Jg9F.js +2 -0
  12. package/admin/custom/assets/{vite-preload-helper-B7qeedMF.js → vite-preload-helper-CaC3yEL3.js} +1 -1
  13. package/admin/custom/customComponents.js +1 -1
  14. package/admin/custom/i18n/de.json +3 -0
  15. package/admin/custom/i18n/en.json +3 -0
  16. package/admin/custom/i18n/es.json +3 -0
  17. package/admin/custom/i18n/fr.json +3 -0
  18. package/admin/custom/i18n/it.json +3 -0
  19. package/admin/custom/i18n/nl.json +3 -0
  20. package/admin/custom/i18n/pl.json +3 -0
  21. package/admin/custom/i18n/pt.json +3 -0
  22. package/admin/custom/i18n/ru.json +3 -0
  23. package/admin/custom/i18n/uk.json +3 -0
  24. package/admin/custom/i18n/zh-cn.json +3 -0
  25. package/admin/custom/mf-manifest.json +1 -1
  26. package/admin/i18n/de.json +34 -17
  27. package/admin/i18n/en.json +34 -17
  28. package/admin/i18n/es.json +34 -17
  29. package/admin/i18n/fr.json +34 -17
  30. package/admin/i18n/it.json +34 -17
  31. package/admin/i18n/nl.json +34 -17
  32. package/admin/i18n/pl.json +34 -17
  33. package/admin/i18n/pt.json +34 -17
  34. package/admin/i18n/ru.json +34 -17
  35. package/admin/i18n/uk.json +34 -17
  36. package/admin/i18n/zh-cn.json +34 -17
  37. package/build/lib/account-credentials.js +36 -0
  38. package/build/lib/account-credentials.js.map +7 -0
  39. package/build/lib/appliance-frames.js +3 -12
  40. package/build/lib/appliance-frames.js.map +2 -2
  41. package/build/lib/auth-status.js +45 -0
  42. package/build/lib/auth-status.js.map +7 -0
  43. package/build/lib/ble-frame.js +213 -0
  44. package/build/lib/ble-frame.js.map +7 -0
  45. package/build/lib/capability-mapper.js +192 -65
  46. package/build/lib/capability-mapper.js.map +2 -2
  47. package/build/lib/cloud-retry.js +2 -4
  48. package/build/lib/cloud-retry.js.map +2 -2
  49. package/build/lib/color.js +58 -0
  50. package/build/lib/color.js.map +7 -0
  51. package/build/lib/command-router.js +35 -44
  52. package/build/lib/command-router.js.map +2 -2
  53. package/build/lib/device-catalog.js +64 -0
  54. package/build/lib/device-catalog.js.map +7 -0
  55. package/build/lib/device-id-migration.js +57 -9
  56. package/build/lib/device-id-migration.js.map +2 -2
  57. package/build/lib/device-id.js +27 -0
  58. package/build/lib/device-id.js.map +2 -2
  59. package/build/lib/device-key.js.map +2 -2
  60. package/build/lib/device-manager/cache.js +54 -28
  61. package/build/lib/device-manager/cache.js.map +2 -2
  62. package/build/lib/device-manager/library-loader.js +15 -10
  63. package/build/lib/device-manager/library-loader.js.map +2 -2
  64. package/build/lib/device-manager/lookups.js +6 -23
  65. package/build/lib/device-manager/lookups.js.map +2 -2
  66. package/build/lib/device-manager/reconciler.js.map +1 -1
  67. package/build/lib/device-manager.js +173 -147
  68. package/build/lib/device-manager.js.map +2 -2
  69. package/build/lib/device-move.js +9 -18
  70. package/build/lib/device-move.js.map +2 -2
  71. package/build/lib/device-registry.js.map +2 -2
  72. package/build/lib/dropdown-labels.js +81 -0
  73. package/build/lib/dropdown-labels.js.map +7 -0
  74. package/build/lib/enum-carry.js +39 -10
  75. package/build/lib/enum-carry.js.map +2 -2
  76. package/build/lib/error-category.js +89 -0
  77. package/build/lib/error-category.js.map +7 -0
  78. package/build/lib/govee-api-client.js +76 -51
  79. package/build/lib/govee-api-client.js.map +2 -2
  80. package/build/lib/govee-cloud-client.js +10 -12
  81. package/build/lib/govee-cloud-client.js.map +2 -2
  82. package/build/lib/govee-lan-client.js +25 -200
  83. package/build/lib/govee-lan-client.js.map +2 -2
  84. package/build/lib/govee-mqtt-client.js +211 -118
  85. package/build/lib/govee-mqtt-client.js.map +2 -2
  86. package/build/lib/govee-openapi-mqtt-client.js +20 -13
  87. package/build/lib/govee-openapi-mqtt-client.js.map +2 -2
  88. package/build/lib/handlers/account-handler.js +104 -0
  89. package/build/lib/handlers/account-handler.js.map +7 -0
  90. package/build/lib/handlers/app-version.js +50 -0
  91. package/build/lib/handlers/app-version.js.map +7 -0
  92. package/build/lib/handlers/cloud-creds-handler.js +2 -2
  93. package/build/lib/handlers/cloud-creds-handler.js.map +2 -2
  94. package/build/lib/handlers/cloud-retry-handler.js +54 -6
  95. package/build/lib/handlers/cloud-retry-handler.js.map +2 -2
  96. package/build/lib/handlers/connection-state.js +2 -48
  97. package/build/lib/handlers/connection-state.js.map +2 -2
  98. package/build/lib/handlers/device-events.js +56 -16
  99. package/build/lib/handlers/device-events.js.map +3 -3
  100. package/build/lib/handlers/device-reaper.js +51 -0
  101. package/build/lib/handlers/device-reaper.js.map +7 -0
  102. package/build/lib/handlers/diagnostics-handler.js +113 -2
  103. package/build/lib/handlers/diagnostics-handler.js.map +2 -2
  104. package/build/lib/handlers/dropdown-reset-helpers.js +16 -0
  105. package/build/lib/handlers/dropdown-reset-helpers.js.map +2 -2
  106. package/build/lib/handlers/group-fanout-handler.js +4 -2
  107. package/build/lib/handlers/group-fanout-handler.js.map +2 -2
  108. package/build/lib/handlers/legacy-cleanup.js +64 -0
  109. package/build/lib/handlers/legacy-cleanup.js.map +7 -0
  110. package/build/lib/handlers/music-command.js +78 -0
  111. package/build/lib/handlers/music-command.js.map +7 -0
  112. package/build/lib/handlers/online-sync.js +68 -0
  113. package/build/lib/handlers/online-sync.js.map +7 -0
  114. package/build/lib/handlers/snapshot-handler-glue.js +2 -1
  115. package/build/lib/handlers/snapshot-handler-glue.js.map +2 -2
  116. package/build/lib/handlers/state-change-router.js +31 -73
  117. package/build/lib/handlers/state-change-router.js.map +2 -2
  118. package/build/lib/handlers/wizard-handler.js +5 -4
  119. package/build/lib/handlers/wizard-handler.js.map +2 -2
  120. package/build/lib/http-client.js +5 -23
  121. package/build/lib/http-client.js.map +2 -2
  122. package/build/lib/local-snapshots.js +5 -11
  123. package/build/lib/local-snapshots.js.map +2 -2
  124. package/build/lib/log-channel-fail.js +2 -10
  125. package/build/lib/log-channel-fail.js.map +2 -2
  126. package/build/lib/message-router.js +29 -34
  127. package/build/lib/message-router.js.map +2 -2
  128. package/build/lib/object-write.js +61 -0
  129. package/build/lib/object-write.js.map +7 -0
  130. package/build/lib/reconnecting-mqtt-client.js +17 -0
  131. package/build/lib/reconnecting-mqtt-client.js.map +2 -2
  132. package/build/lib/segment-list.js +94 -0
  133. package/build/lib/segment-list.js.map +7 -0
  134. package/build/lib/segment-wizard.js +21 -20
  135. package/build/lib/segment-wizard.js.map +2 -2
  136. package/build/lib/sku-cache.js +0 -10
  137. package/build/lib/sku-cache.js.map +2 -2
  138. package/build/lib/snapshot-handler.js.map +1 -1
  139. package/build/lib/state-manager.js +227 -343
  140. package/build/lib/state-manager.js.map +2 -2
  141. package/build/lib/types.js +2 -210
  142. package/build/lib/types.js.map +2 -2
  143. package/build/lib/value-labels.js +102 -0
  144. package/build/lib/value-labels.js.map +7 -0
  145. package/build/main.js +565 -716
  146. package/build/main.js.map +3 -3
  147. package/io-package.json +15 -14
  148. package/package.json +5 -6
  149. package/admin/custom/assets/Components-DL-Na2lB.js +0 -1
  150. package/admin/custom/assets/ExpertPanel-HBCs8xk8.js +0 -1
  151. package/admin/custom/assets/_virtual_mf-localSharedImportMap___mfe_internal__ConfigCustomGoveeSegmentSet__mf_owner__1-CdZFIn7L.js +0 -1
  152. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomGoveeSegmentSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BqaV2gc_.js +0 -1243
  153. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomGoveeSegmentSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__.js-Bh78u5iG.js +0 -1494
  154. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomGoveeSegmentSet__mf_owner__1__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-ld5_knuQ.js +0 -9
  155. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomGoveeSegmentSet__mf_owner__1__prebuild___mf_0_iobroker_mf_1_gui_mf_2_components__prebuild__-DXxYvebj.js +0 -1
  156. package/admin/custom/assets/index-jHHH0u9Z.js +0 -1
  157. package/admin/custom/assets/mf-entry-bootstrap-0-b6c6486e.js +0 -35
  158. package/admin/custom/assets/virtualExposes-D866JgEB.js +0 -1
  159. package/admin/custom/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__ConfigCustomGoveeSegmentSet__customComponents_js-DZNsZXdi.js +0 -1
  160. package/admin/custom/assets/virtual_mf-exposes-ssr___mfe_internal__ConfigCustomGoveeSegmentSet__customComponents_js-DtLYPrSI.js +0 -2
  161. package/build/lib/test-helpers.js +0 -133
  162. package/build/lib/test-helpers.js.map +0 -7
  163. package/devices.schema.json +0 -155
package/README.md CHANGED
@@ -32,7 +32,7 @@ Full user documentation lives in the **[Wiki](https://github.com/krobipd/ioBroke
32
32
 
33
33
  ## Features
34
34
 
35
- - **Capability-driven** — states are generated from what the Govee API reports for each device. No SKU hardcoding, no hand-maintained device list to fall behind.
35
+ - **Capability-driven** — states are generated from what the Govee API reports for each device, so a model nobody has listed yet still gets its datapoints. Per-model code exists only where a model needs it: a catalog correction where Govee's own data is wrong, a decoder for a device's status frames once they are measured.
36
36
  - **LAN-first for lights** — UDP multicast discovery, sub-50 ms commands, status updates via AWS IoT MQTT
37
37
  - **Cloud + MQTT push for sensors and appliances** — readings via the App API, events via the OpenAPI MQTT broker
38
38
  - **Per-segment color and brightness** for LED strips with the right capability, including batch commands and a visual segment-detection wizard (with a live, correctable strip map) for cut strips
@@ -95,6 +95,36 @@ This adapter's MQTT authentication and BLE-over-LAN (ptReal) protocol implementa
95
95
  ### **WORK IN PROGRESS**
96
96
  -->
97
97
 
98
+ ### 3.1.0 (2026-10-01)
99
+
100
+ - Fixed: a rejected background token refresh of the Govee account now counts toward the login protection and asks to check email/password instead of retrying silently
101
+ - Fixed: "Test login" in the connection card counts toward the account's login limit (3 per hour) and says when the next test is possible
102
+ - Fixed: segment colours and brightness are confirmed only after the command went out — a refused Cloud command no longer leaves them acked
103
+ - Fixed: stopping the adapter while it is still starting really stops it — it no longer goes on to search the network or log in to your Govee account afterwards
104
+ - Fixed: a light found on the network before the saved data loads keeps its scene speed and remembered libraries after a restart
105
+ - Fixed: a group offers only the colour temperatures every member supports, so no member is sent a value outside its range
106
+ - Fixed: when Govee no longer accepts the account session, scene, music and DIY libraries, snapshots and groups ask for a fresh login instead of reading as empty
107
+ - Fixed: a Cloud rate limit or rejected API key is reported once, with the real waiting time — no longer three times or with a wrong retry hint
108
+ - Fixed: moving a 2.x device tree to its new id no longer loses recordings or room assignments when the move fails or is interrupted
109
+ - Fixed: a light whose scene library has not loaded yet keeps its `scenes.scene_speed` datapoint, value and recording — a start without saved data deleted and re-created it
110
+ - Improved: a restart leaves the object tree untouched when nothing changed, so scripts and history that watch object changes no longer see needless updates
111
+ - Fixed: a mode or level dropdown only takes a value the device declares — a fan speed no longer shows `50`, an air purifier's level no longer `0` in Auto mode
112
+ - Fixed: the manual device sync after a failed start shows the Cloud connected and stops the pending retry; a device it adds gets its first values without a log warning
113
+ - Fixed: a Govee e-mail or password of spaces only counts as not entered — at start, in the sensor hint and in the connection card's test
114
+ - Fixed: the refresh button of a light keeps its scene list across restarts and corrects a wrong segment count; devices that are not lights no longer use up Cloud calls
115
+ - Fixed: a temperature reading carries °C whichever way it arrives — a model that declares Fahrenheit no longer flips the unit to °F (the value is always °C)
116
+ - Fixed: a segment colour above 255 is sent as 255 — it wrapped to 0 before; a segment brightness is rounded like the light's brightness
117
+ - Improved: a lamp that is unplugged or unreachable on your network leaves one warning in the log instead of a new warning for every command you send to it
118
+ - Fixed: a group that is switched off or set to a colour clears its scene and music dropdowns the same way a single light already does
119
+ - Fixed: a heater that declares no temperature unit shows none instead of an invented °F; a command delivered after the device came back shows the value that was sent
120
+ - Fixed: an untested model without catalog corrections no longer warns to turn on the experimental switch — it works as it is; the log only asks for a diagnostics report
121
+ - Fixed: the settings describe the experimental switch for what it does — it turns on the catalog corrections of untested models; every device appears without it
122
+ - Improved: after you press the device sync or the refresh button, the log tells you what it found, for example which new devices were added to the object tree
123
+ - Fixed: the connection card words every answer in the admin's language — a full login window shows the time on your own clock, and a repeated login test no longer claims a code was just requested
124
+ - Fixed: the music mode read from Govee's state answer showed the mode at that position instead of the reported one; a mode the device never declared is no longer written
125
+ - Fixed: the segment detection wizard no longer counts a dark segment at the end when the measurement runs all the way to the longest strip Govee supports
126
+ - Improved: appliance modes and levels and the device type show readable names in your ioBroker language; scripts may still write the names Govee uses, such as Auto
127
+
98
128
  ### 3.0.1 (2026-09-27)
99
129
 
100
130
  - Improved: the note the Admin shows before an update to 3.x is short now: the warning, one example old → new and a link to the details
@@ -136,11 +166,6 @@ This adapter's MQTT authentication and BLE-over-LAN (ptReal) protocol implementa
136
166
  - Improved: Temperature, humidity, battery, air quality and filter life carry translated names — the cloud path wrote Govee's English wording in every language
137
167
  - Improved: Bluetooth-only models are no longer listed as supported, and the Wi-Fi meat thermometer H5610 was added
138
168
 
139
- ### 2.39.2 (2026-09-22)
140
-
141
- - Fixed: App groups are no longer asked for a device state at every start — Govee answered each call with an error that only filled the diagnostics report
142
- - Fixed: A scene request Govee refuses is no longer taken as "no scenes" — the cached scenes and snapshots stay, and the report names the reason once
143
-
144
169
  [Older changelogs can be found there](CHANGELOG_OLD.md)
145
170
 
146
171
  ## Support
@@ -0,0 +1 @@
1
+ import{t as e}from"./_virtual_mf___mfe_internal__ConfigCustomGoveeSegmentSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__.js-whCpEChV.js";import{Ci as t,Ga as n,Hr as r,Ii as i,Ja as a,Jr as o,Kr as s,Oi as c,Pi as l,Ua as u,Wa as d,Xr as f,_i as p,ci as m,ei as h,fi as g,ni as _,po as v,un as y,xi as b}from"./_virtual_mf___mfe_internal__ConfigCustomGoveeSegmentSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-CDkXizQd.js";v();function x(e){try{if(e instanceof Error){let t=`code`in e?e.code:void 0,n=e.message,r=e.name,i=String(n||(typeof t==`string`?t:r)),a=e.cause,o=``;if(a instanceof Error){let e=`code`in a?a.code:void 0,t=a.message;o=(typeof t==`string`?t:``)||(typeof e==`string`?e:``)}else a!=null&&(o=x(a));return o&&!i.includes(o)?`${i} (${o})`:i}return typeof e==`string`?e:typeof e==`function`?Object.prototype.toString.call(e):typeof e!=`object`||!e?String(e):JSON.stringify(e)??Object.prototype.toString.call(e)}catch{return Object.prototype.toString.call(e)}}var S=[`ok`,`verifyRequired`,`codeInvalid`,`passwordRejected`,`emailNotRegistered`,`rateLimited`,`accountLocked`,`loginWindowFull`,`loginFailed`,`mqttNotUp`,`codeSent`,`codeRejected`,`needCredentials`,`throttled`,`unknownAction`];function C(e,t){let n=(n,r)=>e.sendTo(t,`mqttAuth`,{action:n,email:r.email,password:r.password,code:r.code});return{testLogin:e=>n(`test`,e),requestCode:e=>n(`requestCode`,e)}}function w(e,t){let[n,r]=a.useState({cloud:!1,mqtt:!1,verifyPending:!1});return a.useEffect(()=>{if(!e)return;let n=`${t}.info.cloudConnected`,i=`${t}.info.mqttConnected`,a=`${t}.info.verificationPending`,o=!0,s=(e,t)=>{o&&r(e=>({...e,cloud:!!(t!=null&&t.val)}))},c=(e,t)=>{o&&r(e=>({...e,mqtt:!!(t!=null&&t.val)}))},l=(e,t)=>{o&&r(e=>({...e,verifyPending:!!(t!=null&&t.val)}))};return Promise.resolve(e.getState(n)).then(e=>s(n,e)).catch(()=>void 0),Promise.resolve(e.getState(i)).then(e=>c(i,e)).catch(()=>void 0),Promise.resolve(e.getState(a)).then(e=>l(a,e)).catch(()=>void 0),Promise.resolve(e.subscribeState(n,s)).catch(()=>void 0),Promise.resolve(e.subscribeState(i,c)).catch(()=>void 0),Promise.resolve(e.subscribeState(a,l)).catch(()=>void 0),()=>{o=!1,e.unsubscribeState(n,s),e.unsubscribeState(i,c),e.unsubscribeState(a,l)}},[e,t]),n}function T(e){switch(e){case`ok`:return`success`;case`verifyRequired`:case`codeSent`:return`info`;case`codeInvalid`:case`codeRejected`:case`needCredentials`:case`throttled`:case`loginWindowFull`:return`warning`;default:return`error`}}var E=new Set(S);function D(e){return e===`verifyRequired`||e===`codeSent`||e===`codeInvalid`||e===`codeRejected`}function O({on:e,testId:t}){return d(o,{component:`span`,"data-testid":t,"data-on":e?`true`:`false`,sx:{display:`inline-block`,width:12,height:12,borderRadius:`50%`,flexShrink:0,bgcolor:e?`success.main`:`action.disabled`}})}function k(e){let{socket:t,namespace:c,values:l,onChange:u}=e,{apiKey:g,email:v,password:b,code:S}=l,k=a.useMemo(()=>C(t,c),[t,c]),A=w(t,c),[j,M]=a.useState(``),[N,P]=a.useState(null),[F,I]=a.useState(!1),[L,R]=a.useState({apiKey:g,email:v,password:b,code:S});a.useEffect(()=>{R(e=>{let t={...e},n=!1;return e.apiKey!==g&&(t.apiKey=g,n=!0),e.email!==v&&(t.email=v,n=!0),e.password!==b&&(t.password=b,n=!0),e.code!==S&&(t.code=S,n=!0),n?t:e})},[g,v,b,S]);let z=(e,t,n)=>{R(e=>({...e,[t]:n})),u(e,n)};a.useEffect(()=>{A.verifyPending&&I(!0)},[A.verifyPending]);let B=(e,...t)=>y.t(e,...t),V=e=>{P({status:`loginFailed`,text:B(`gsw_conn_err`,e)})},H=(e,t)=>{let n=typeof t.reason==`string`?t.reason:``;return(e===`loginFailed`||e===`codeRejected`)&&n?B(`gsw_conn_st_${e}Reason`,n):e===`loginWindowFull`&&typeof t.retryAt==`number`&&Number.isFinite(t.retryAt)?B(`gsw_conn_st_loginWindowFull`,new Date(t.retryAt).toLocaleTimeString()):B(`gsw_conn_st_${e===`loginWindowFull`?`rateLimited`:e}`)},U=e=>{let t=e==null?void 0:e.status;if(typeof t!=`string`||!E.has(t)){V(typeof(e==null?void 0:e.error)==`string`&&e.error?e.error:y.t(`gsw_conn_st_loginFailed`));return}P({status:t,text:H(t,e)}),D(t)&&I(!0)},W=async()=>{M(`login`);try{U(await k.testLogin({email:L.email,password:L.password,code:L.code}))}catch(e){V(x(e))}finally{M(``)}},G=async()=>{M(`code`);try{U(await k.requestCode({email:L.email,password:L.password}))}catch(e){V(x(e))}finally{M(``)}},K=L.email.trim()!==``&&L.password.trim()!==``;return n(o,{sx:{maxWidth:640},children:[n(i,{direction:`row`,spacing:1.5,sx:{py:1,alignItems:`center`},children:[d(O,{on:!0,testId:`dot-lan`}),n(o,{children:[d(s,{variant:`subtitle2`,children:B(`gsw_conn_lan_title`)}),d(s,{variant:`body2`,color:`text.secondary`,children:B(`gsw_conn_lan_desc`)})]})]}),d(m,{}),n(i,{direction:`row`,spacing:1.5,sx:{py:1.5,alignItems:`flex-start`},children:[d(o,{sx:{pt:1},children:d(O,{on:A.cloud,testId:`dot-cloud`})}),n(o,{sx:{flexGrow:1},children:[d(s,{variant:`subtitle2`,children:B(`gsw_conn_cloud_title`)}),d(s,{variant:`body2`,color:`text.secondary`,sx:{mb:1},children:B(`gsw_conn_cloud_desc`)}),d(r,{fullWidth:!0,size:`small`,type:`password`,label:B(`gsw_conn_apikey_label`),value:L.apiKey,onChange:e=>z(`apiKey`,`apiKey`,e.target.value),slotProps:{htmlInput:{"data-testid":`conn-apikey`}},autoComplete:`off`})]})]}),d(m,{}),n(i,{direction:`row`,spacing:1.5,sx:{py:1.5,alignItems:`flex-start`},children:[d(o,{sx:{pt:1},children:d(O,{on:A.mqtt,testId:`dot-mqtt`})}),n(o,{sx:{flexGrow:1},children:[d(s,{variant:`subtitle2`,children:B(`gsw_conn_rt_title`)}),d(s,{variant:`body2`,color:`text.secondary`,sx:{mb:1},children:B(`gsw_conn_rt_desc`)}),n(i,{spacing:1,children:[d(r,{fullWidth:!0,size:`small`,label:B(`gsw_conn_email_label`),value:L.email,onChange:e=>z(`goveeEmail`,`email`,e.target.value),slotProps:{htmlInput:{"data-testid":`conn-email`}},autoComplete:`off`}),d(r,{fullWidth:!0,size:`small`,type:`password`,label:B(`gsw_conn_password_label`),value:L.password,onChange:e=>z(`goveePassword`,`password`,e.target.value),slotProps:{htmlInput:{"data-testid":`conn-password`}},autoComplete:`off`}),d(o,{children:d(f,{variant:`contained`,size:`small`,"data-testid":`conn-connect`,disabled:!K||j!==``,onClick:()=>void W(),startIcon:j===`login`?d(h,{size:16,color:`inherit`}):void 0,children:B(`gsw_conn_connect_btn`)})}),d(_,{in:F,unmountOnExit:!0,children:n(i,{spacing:1,sx:{mt:1,pl:1,borderLeft:`2px solid`,borderColor:`divider`},children:[d(s,{variant:`body2`,color:`text.secondary`,children:B(`gsw_conn_2fa_hint`)}),d(r,{fullWidth:!0,size:`small`,label:B(`gsw_conn_code_label`),value:L.code,onChange:e=>z(`mqttVerificationCode`,`code`,e.target.value),slotProps:{htmlInput:{maxLength:8}},autoComplete:`off`}),n(i,{direction:`row`,spacing:1,children:[d(f,{variant:`outlined`,size:`small`,disabled:!K||j!==``,onClick:()=>void G(),startIcon:j===`code`?d(h,{size:16,color:`inherit`}):void 0,children:B(`gsw_conn_request_btn`)}),d(f,{variant:`contained`,size:`small`,disabled:!K||L.code.trim()===``||j!==``,onClick:()=>void W(),startIcon:j===`login`?d(h,{size:16,color:`inherit`}):void 0,children:B(`gsw_conn_verify_btn`)})]})]})})]})]})]}),N&&d(p,{severity:T(N.status),sx:{mt:1},onClose:()=>P(null),children:N.text})]})}v();var A=class extends e{renderItem(t,n){let r=this.props.oContext,i=`${r.adapterName}.${r.instance}`,a=t=>{let n=e.getValue(this.props.data,t);return typeof n==`string`?n:``};return d(k,{socket:r.socket,namespace:i,values:{apiKey:a(`apiKey`),email:a(`goveeEmail`),password:a(`goveePassword`),code:a(`mqttVerificationCode`)},onChange:(e,t)=>void this.onChange(e,t)})}},j=class extends Error{};function M(e,t){return{async listDevices(){let n;try{n=await e.sendTo(t,`diagnostics`,{action:`list`})}catch(e){throw new j(x(e))}let r=n==null?void 0:n.devices;if(!Array.isArray(r))throw new j(`The adapter did not answer with a device list`);return r}}}function N(e){return e.filter(e=>e.online&&e.segments>0)}v();var P=4e3;function F(e,t){let n=a.useMemo(()=>M(e,t),[e,t]),[r,i]=a.useState({status:`loading`,slow:!1});return a.useEffect(()=>{let e=!0;i({status:`loading`,slow:!1});let t=setTimeout(()=>{i(e=>e.status===`loading`?{status:`loading`,slow:!0}:e)},P);return n.listDevices().then(t=>{e&&i({status:`ready`,devices:t})}).catch(t=>{e&&i({status:`failed`,message:t instanceof j&&t.message?x(t):y.t(`gsw_listFailed`)})}),()=>{e=!1,clearTimeout(t)}},[n]),r}function I({state:e}){return e.status===`loading`?d(o,{sx:{p:2},children:n(i,{direction:`row`,spacing:2,sx:{alignItems:`center`},children:[d(h,{size:24}),n(o,{children:[d(s,{variant:`body2`,children:y.t(`gsw_loadingDevices`)}),e.slow?d(s,{variant:`caption`,color:`text.secondary`,"data-testid":`list-slow-hint`,children:y.t(`gsw_loadingDevicesSlow`)}):null]})]})}):e.status===`failed`?d(o,{sx:{p:2},children:d(p,{severity:`error`,"data-testid":`list-failed`,children:e.message})}):null}function L(e){return typeof e.fileName==`string`}function R(e,t){return{exportReport(n){return e.sendTo(t,`diagnostics`,{action:`export`,device:n})}}}v();function z(e,t){let n=URL.createObjectURL(new Blob([t],{type:`application/json`})),r=document.createElement(`a`);r.href=n,r.download=e,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}function B({socket:e,namespace:r}){let m=a.useMemo(()=>R(e,r),[e,r]),_=F(e,r),[v,x]=a.useState(``),[S,C]=a.useState(!1),[w,T]=a.useState(``),[E,D]=a.useState(``),O=_.status===`ready`?_.devices:[];a.useEffect(()=>{O.length===1&&x(O[0].value)},[O]);let k=a.useCallback(()=>{C(!0),T(``),D(``),m.exportReport(v).then(e=>{L(e)?(z(e.fileName,e.content),D(e.fileName)):T(e.error)}).catch(()=>T(y.t(`gsw_diagExportFailed`))).finally(()=>C(!1))},[m,v]);return _.status===`ready`?d(o,{sx:{p:2,maxWidth:720},children:n(i,{spacing:2,children:[d(s,{variant:`body2`,children:y.t(`gsw_diagIntro`)}),O.length===0?d(p,{severity:`info`,"data-testid":`diag-no-devices`,children:y.t(`gsw_diagNoDevices`)}):n(u,{children:[n(g,{fullWidth:!0,children:[d(b,{id:`gsw-diag-device`,children:y.t(`gsw_diagDevice`)}),d(l,{"data-testid":`diag-device-select`,labelId:`gsw-diag-device`,label:y.t(`gsw_diagDevice`),value:v,onChange:e=>x(String(e.target.value)),children:O.map(e=>d(c,{value:e.value,children:e.label},e.value))})]}),d(o,{children:d(f,{"data-testid":`diag-export`,variant:`contained`,disabled:!v||S,onClick:k,startIcon:S?d(h,{size:16}):void 0,children:y.t(`gsw_diagExport`)})})]}),E?n(p,{severity:`success`,children:[y.t(`gsw_diagDone`,E),` `,d(t,{href:`https://github.com/krobipd/ioBroker.govee-smart/issues/new/choose`,target:`_blank`,rel:`noreferrer`,children:y.t(`gsw_diagOpenIssue`)})]}):null,w?d(p,{severity:`error`,children:w}):null,d(s,{variant:`caption`,color:`text.secondary`,children:y.t(`gsw_diagPrivacy`)})]})}):d(I,{state:_})}v();var V={confirmed:{bgcolor:`success.main`,color:`success.contrastText`},flashing:{bgcolor:`warning.light`,color:`#000`,boxShadow:3},gap:{bgcolor:`error.main`,color:`error.contrastText`},open:{bgcolor:`action.disabledBackground`,color:`text.secondary`}};function H(e,t,n,r){return n===e?`flashing`:t.has(e)?`confirmed`:r.has(e)?`gap`:`open`}function U(e){let{total:t,confirmed:n,flashing:r,gaps:i,editable:a,onToggle:s}=e,c=new Set(n),l=new Set(i);return d(o,{sx:{display:`flex`,flexWrap:`wrap`,gap:.5},children:Array.from({length:Math.max(0,t)},(e,t)=>{let n=H(t,c,r,l);return d(o,{"data-testid":`seg-cell-${t}`,className:`seg-cell ${n}`,onClick:a?()=>s==null?void 0:s(t):void 0,sx:{width:34,height:34,display:`flex`,alignItems:`center`,justifyContent:`center`,borderRadius:1,fontSize:12,userSelect:`none`,cursor:a?`pointer`:`default`,...V[n]},children:t},t)})})}function W(e,t){let n=``,r=(n,r,i)=>{let a={action:n,device:r};return i&&(a.indices=i),e.sendTo(t,`segmentWizard`,a)};return{start(e){return n=e,r(`start`,e)},yes:()=>r(`yes`,n),no:()=>r(`no`,n),abort:()=>r(`abort`,n),apply:(e,t)=>r(`apply`,e,t)}}v();function G(e,t){let n=new Set(t),r=[];for(let t=0;t<e;t++)n.has(t)||r.push(t);return r}function K(e){let t=a.useMemo(()=>W(e.socket,e.namespace),[e.socket,e.namespace]),r=F(e.socket,e.namespace),u=a.useMemo(()=>r.status===`ready`?N(r.devices):[],[r]),[m,h]=a.useState(`select`),[_,v]=a.useState(``),[S,C]=a.useState(null),[w,T]=a.useState(0),[E,D]=a.useState([]),[O,k]=a.useState(0),[A,j]=a.useState(``),M=a.useRef(!1);a.useEffect(()=>{v(u.length?u[0].value:``)},[u]),a.useEffect(()=>()=>{M.current&&(M.current=!1,Promise.resolve().then(()=>t.abort()).catch(()=>void 0))},[t]);let P=()=>{C(null),h(`select`)},L=e=>e.error?(M.current=!1,j(e.error),P(),!0):e.aborted?(M.current=!1,j(``),P(),!0):e.applied||e.done?(M.current=!1,k(e.segmentCount??0),C(null),h(`success`),!0):(j(``),e.snapshot&&C(e.snapshot),!1),R=e=>{M.current=!1,j(x(e)),P()},z=async()=>{_&&(j(``),L(await t.start(_))||(M.current=!0,h(`measure`)))},B=async()=>{try{await z()}catch(e){R(e)}},V=async e=>{try{L(await(e?t.yes():t.no()))}catch(e){R(e)}},H=()=>{let e=S;if(!e||e.currentIndex<1)return;let t=e.currentIndex;T(t),D(e.confirmed.filter(e=>e<t).sort((e,t)=>e-t)),h(`review`)},K=e=>{D(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e].sort((e,t)=>e-t))},q=async()=>{if(E.length)try{L(await t.apply(_,E))}catch(e){R(e)}},J=async()=>{try{await t.abort(),M.current=!1,await z()}catch(e){R(e)}},Y=async()=>{try{await t.abort(),M.current=!1,P()}catch(e){R(e)}},X=()=>{j(``),h(`select`)},Z=A?d(p,{severity:`error`,"data-testid":`wiz-error`,sx:{mb:2},children:y.t(`gsw_error`,A)}):null;if(r.status!==`ready`)return d(I,{state:r});if(m===`select`)return n(o,{sx:{maxWidth:520},children:[Z,u.length===0?d(p,{severity:`info`,"data-testid":`wiz-no-devices`,children:y.t(`gsw_noDevices`)}):n(i,{spacing:2,children:[n(g,{fullWidth:!0,children:[d(b,{children:y.t(`gsw_deviceLabel`)}),d(l,{"data-testid":`wiz-device-select`,value:_,label:y.t(`gsw_deviceLabel`),onChange:e=>v(e.target.value),children:u.map(e=>d(c,{value:e.value,children:y.t(`gsw_deviceOption`,e.label,String(e.segments))},e.value))})]}),d(o,{children:d(f,{variant:`contained`,"data-testid":`wiz-start`,disabled:!_,onClick:()=>void B(),children:y.t(`gsw_start`)})})]})]});if(m===`measure`&&S){let e=S.currentIndex;return n(o,{sx:{maxWidth:520},children:[d(s,{variant:`h6`,sx:{mb:1},children:y.t(`gsw_measureHint`)}),d(U,{total:e+1,confirmed:S.confirmed,flashing:e,gaps:G(e,S.confirmed),editable:!1}),d(s,{sx:{my:2},children:y.t(`gsw_question`,e)}),n(i,{direction:`row`,spacing:1,sx:{flexWrap:`wrap`},useFlexGap:!0,children:[d(f,{variant:`contained`,color:`success`,"data-testid":`wiz-lit`,onClick:()=>void V(!0),children:y.t(`gsw_lit`)}),d(f,{variant:`outlined`,"data-testid":`wiz-dark`,onClick:()=>void V(!1),children:y.t(`gsw_dark`)}),d(f,{variant:`contained`,"data-testid":`wiz-finish`,disabled:e<1,onClick:H,children:y.t(`gsw_finish`)}),d(f,{variant:`text`,color:`secondary`,"data-testid":`wiz-cancel`,onClick:()=>void Y(),children:y.t(`gsw_cancel`)})]})]})}if(m===`review`){let e=E.length?Math.max(...E)+1:0,t=e-E.length,r=t>0?y.t(`gsw_resultGaps`,e,t):y.t(`gsw_resultNoGaps`,e);return n(o,{sx:{maxWidth:520},children:[d(s,{variant:`h6`,sx:{mb:1},children:r}),d(s,{variant:`body2`,sx:{mb:1,opacity:.8},children:y.t(`gsw_reviewHint`)}),d(U,{total:w,confirmed:E,flashing:null,gaps:G(w,E),editable:!0,onToggle:K}),n(i,{direction:`row`,spacing:1,sx:{mt:2,flexWrap:`wrap`},useFlexGap:!0,children:[d(f,{variant:`contained`,"data-testid":`wiz-apply`,disabled:!E.length,onClick:()=>void q(),children:y.t(`gsw_apply`)}),d(f,{variant:`outlined`,"data-testid":`wiz-remeasure`,onClick:()=>void J(),children:y.t(`gsw_remeasure`)}),d(f,{variant:`text`,color:`secondary`,"data-testid":`wiz-cancel`,onClick:()=>void Y(),children:y.t(`gsw_cancel`)})]})]})}return n(o,{sx:{maxWidth:520},"data-testid":`wiz-success`,children:[d(p,{severity:`success`,sx:{mb:2},children:y.t(`gsw_applied`,O)}),d(f,{variant:`contained`,"data-testid":`wiz-close`,onClick:X,children:y.t(`gsw_close`)})]})}v();var q=new Set([`_main`,`_expert`]);function J(e){let t=e.split(`.`)[0];try{let e=window._localStorage??window.localStorage,n=new Set,r=`App.${t}`;if(q.has(e.getItem(r)??``)&&n.add(r),typeof e.length==`number`&&typeof e.key==`function`)for(let r=0;r<e.length;r++){let i=e.key(r);i!=null&&i.endsWith(`.${t}`)&&q.has(e.getItem(i)??``)&&n.add(i)}for(let t of n)e.removeItem(t)}catch{}}function Y({socket:e,namespace:t}){let[r,c]=a.useState(`wizard`);return a.useEffect(()=>(J(t),()=>J(t)),[t]),d(o,{sx:{p:2},children:n(i,{spacing:2,children:[d(s,{variant:`body2`,children:y.t(`gsw_expertIntro`)}),n(i,{direction:`row`,spacing:1,sx:{flexWrap:`wrap`},children:[d(f,{"data-testid":`expert-tool-wizard`,variant:r===`wizard`?`contained`:`outlined`,onClick:()=>c(`wizard`),children:y.t(`gsw_expertWizard`)}),d(f,{"data-testid":`expert-tool-diagnostics`,variant:r===`diagnostics`?`contained`:`outlined`,onClick:()=>c(`diagnostics`),children:y.t(`gsw_expertDiagnostics`)})]}),d(r===`wizard`?K:B,{socket:e,namespace:t})]})})}v();var X={ConnectionConfig:A,ExpertConfig:class extends e{renderItem(e,t){let n=this.props.oContext,r=`${n.adapterName}.${n.instance}`;return d(Y,{socket:n.socket,namespace:r})}}};export{X as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./vite-preload-helper-CaC3yEL3.js";var t={react:async()=>await e(()=>import(`./_virtual_mf___mfe_internal__ConfigCustomGoveeSegmentSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-CDkXizQd.js`).then(e=>(e.ho(),e.mo)),[],import.meta.url),"react/jsx-runtime":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__ConfigCustomGoveeSegmentSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-CDkXizQd.js`).then(e=>e.Ka),[],import.meta.url),"react-dom":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__ConfigCustomGoveeSegmentSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-CDkXizQd.js`).then(e=>e.aa),[],import.meta.url),"@mui/material":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__ConfigCustomGoveeSegmentSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-CDkXizQd.js`).then(e=>e.Li),[],import.meta.url),"@mui/icons-material":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__ConfigCustomGoveeSegmentSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-CDkXizQd.js`).then(e=>e.Ar),[],import.meta.url),"@iobroker/gui-components":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__ConfigCustomGoveeSegmentSet__mf_owner__1__prebuild___mf_0_iobroker_mf_1_gui_mf_2_components__prebuild__-D--Cwr-f.js`),[],import.meta.url),"@iobroker/json-config":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__ConfigCustomGoveeSegmentSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__.js-whCpEChV.js`).then(e=>e.n),[],import.meta.url)},n={react:{name:`react`,version:`19.3.0`,scope:[`default`],loaded:!1,eager:!1,from:`ConfigCustomGoveeSegmentSet`,canLiveRebind:!0,async get(){n.react.loaded=!0;let{react:e}=t,r={...await e()};return r.__esModule!==!0&&Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"react/jsx-runtime":{name:`react/jsx-runtime`,version:`19.3.0`,scope:[`default`],loaded:!1,eager:!1,from:`ConfigCustomGoveeSegmentSet`,canLiveRebind:!0,async get(){n[`react/jsx-runtime`].loaded=!0;let{"react/jsx-runtime":e}=t,r={...await e()};return r.__esModule!==!0&&Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"react-dom":{name:`react-dom`,version:`19.3.0`,scope:[`default`],loaded:!1,eager:!1,from:`ConfigCustomGoveeSegmentSet`,canLiveRebind:!0,async get(){n[`react-dom`].loaded=!0;let{"react-dom":e}=t,r={...await e()};return r.__esModule!==!0&&Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"@mui/material":{name:`@mui/material`,version:`9.4.0`,scope:[`default`],loaded:!1,eager:!1,from:`ConfigCustomGoveeSegmentSet`,canLiveRebind:!0,async get(){n[`@mui/material`].loaded=!0;let{"@mui/material":e}=t,r={...await e()};return r.__esModule!==!0&&Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"@mui/icons-material":{name:`@mui/icons-material`,version:`9.4.0`,scope:[`default`],loaded:!1,eager:!1,from:`ConfigCustomGoveeSegmentSet`,canLiveRebind:!0,async get(){n[`@mui/icons-material`].loaded=!0;let{"@mui/icons-material":e}=t,r={...await e()};return r.__esModule!==!0&&Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"@iobroker/gui-components":{name:`@iobroker/gui-components`,version:`10.3.7`,scope:[`default`],loaded:!1,eager:!1,from:`ConfigCustomGoveeSegmentSet`,canLiveRebind:!1,async get(){n[`@iobroker/gui-components`].loaded=!0;let{"@iobroker/gui-components":e}=t,r={...await e()};return r.__esModule!==!0&&Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}},"@iobroker/json-config":{name:`@iobroker/json-config`,version:`9.1.2`,scope:[`default`],loaded:!1,eager:!1,from:`ConfigCustomGoveeSegmentSet`,canLiveRebind:!0,async get(){n[`@iobroker/json-config`].loaded=!0;let{"@iobroker/json-config":e}=t,r={...await e()};return r.__esModule!==!0&&Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`*`,strictVersion:!1,eager:!1}}},r=[];export{r as usedRemotes,n as usedShared};