boneIO 1.5.0.dev1__py3-none-any.whl → 1.5.0.dev2__py3-none-any.whl

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 (43) hide show
  1. boneio/core/manager/irrigation.py +21 -10
  2. boneio/version.py +1 -1
  3. boneio/webui/frontend-dist/assets/ConfigEditor-DVdxuuOd.js +1 -0
  4. boneio/webui/frontend-dist/assets/aiWizardPrompt-Qk4nus2t.js +2 -0
  5. boneio/webui/frontend-dist/assets/codicon-ngg6Pgfi.ttf +0 -0
  6. boneio/webui/frontend-dist/assets/css.worker-CvXBzhp8.js +89 -0
  7. boneio/webui/frontend-dist/assets/editor.worker-Cn2oRESe.js +26 -0
  8. boneio/webui/frontend-dist/assets/html.worker-BO6WuOEO.js +502 -0
  9. boneio/webui/frontend-dist/assets/index-Bz9etcWZ.js +130 -0
  10. boneio/webui/frontend-dist/assets/index-CJECcrbK.css +2 -0
  11. boneio/webui/frontend-dist/assets/json.worker-BkJRGcCJ.js +58 -0
  12. boneio/webui/frontend-dist/assets/monaco-61yH0vfd.js +1212 -0
  13. boneio/webui/frontend-dist/assets/monaco-Br_kD0ds.css +1 -0
  14. boneio/webui/frontend-dist/assets/rolldown-runtime-QTnfLwEv.js +1 -0
  15. boneio/webui/frontend-dist/assets/ts.worker-B0J26iPs.js +67734 -0
  16. boneio/webui/frontend-dist/assets/vendor-pmGLHP0_.js +55 -0
  17. boneio/webui/frontend-dist/assets/workbox-window.prod.es5-Bd17z0YL.js +2 -0
  18. boneio/webui/frontend-dist/assets/yaml.worker-BKRoXlmz.js +450 -0
  19. boneio/webui/frontend-dist/index.html +6 -8
  20. boneio/webui/frontend-dist/sw.js +1 -1
  21. boneio/webui/frontend-dist/workbox-4918f2f6.js +1 -0
  22. {boneio-1.5.0.dev1.dist-info → boneio-1.5.0.dev2.dist-info}/METADATA +1 -1
  23. {boneio-1.5.0.dev1.dist-info → boneio-1.5.0.dev2.dist-info}/RECORD +27 -26
  24. boneio/webui/frontend-dist/assets/ConfigEditor-CPp8M41v.js +0 -1
  25. boneio/webui/frontend-dist/assets/aiConfig-DxFilBWK.js +0 -2
  26. boneio/webui/frontend-dist/assets/aiWizardPrompt-CrWwS7zb.js +0 -2
  27. boneio/webui/frontend-dist/assets/codicon-DCmgc-ay.ttf +0 -0
  28. boneio/webui/frontend-dist/assets/editor.worker-BVjSvWeP.js +0 -12
  29. boneio/webui/frontend-dist/assets/index-CwwZnggl.js +0 -110
  30. boneio/webui/frontend-dist/assets/index-DLlP5vtY.css +0 -2
  31. boneio/webui/frontend-dist/assets/json.worker-CqOJL4FD.js +0 -51
  32. boneio/webui/frontend-dist/assets/monaco-B9WiNxkw.css +0 -1
  33. boneio/webui/frontend-dist/assets/monaco-CAZoGZNF.js +0 -1047
  34. boneio/webui/frontend-dist/assets/rolldown-runtime-Dw2cE7zH.js +0 -1
  35. boneio/webui/frontend-dist/assets/useTranslation-CWdBD1EW.js +0 -13
  36. boneio/webui/frontend-dist/assets/vendor-BD5Ml_Uz.js +0 -55
  37. boneio/webui/frontend-dist/assets/workbox-window.prod.es5-BJd1pjeW.js +0 -2
  38. boneio/webui/frontend-dist/assets/yaml.worker-nZQZSRZ7.js +0 -375
  39. boneio/webui/frontend-dist/workbox-4eca85ba.js +0 -1
  40. {boneio-1.5.0.dev1.dist-info → boneio-1.5.0.dev2.dist-info}/WHEEL +0 -0
  41. {boneio-1.5.0.dev1.dist-info → boneio-1.5.0.dev2.dist-info}/entry_points.txt +0 -0
  42. {boneio-1.5.0.dev1.dist-info → boneio-1.5.0.dev2.dist-info}/licenses/LICENSE +0 -0
  43. {boneio-1.5.0.dev1.dist-info → boneio-1.5.0.dev2.dist-info}/top_level.txt +0 -0
@@ -193,19 +193,30 @@ class IrrigationManager:
193
193
  )
194
194
 
195
195
  async def reconnect(self) -> None:
196
- """Handle MQTT reconnect — re-subscribe topics and re-publish states.
197
-
198
- IMPORTANT: This does NOT restart schedule tasks. Schedule tasks are
199
- long-lived asyncio.Tasks that sleep until the next fire time.
200
- Restarting them on every MQTT reconnect would cancel the pending sleep
201
- and recalculate the next fire time from "now", potentially skipping
202
- a schedule that was about to fire.
203
-
204
- Only MQTT subscriptions and state publication are refreshed.
196
+ """Handle MQTT (re-)connect — re-subscribe topics and re-publish states.
197
+
198
+ On **first connection** (no schedule tasks running yet), schedule tasks
199
+ are started for each controller. On subsequent MQTT reconnects the
200
+ existing schedule tasks are left untouched — they are long-lived
201
+ ``asyncio.Task``s that sleep until the next fire time. Restarting
202
+ them would cancel the pending sleep and recalculate the next fire time
203
+ from "now", potentially skipping a schedule that was about to fire.
205
204
  """
206
- _LOGGER.info("Irrigation MQTT reconnect: re-subscribing topics and re-publishing states")
205
+ # Detect first connection: if any controller has no schedule tasks yet,
206
+ # we treat this as the initial start.
207
+ first_connect = any(
208
+ ctrl._schedule and not ctrl._schedule_tasks
209
+ for ctrl in self._controllers.values()
210
+ )
211
+ if first_connect:
212
+ _LOGGER.info("Irrigation: first MQTT connection — starting schedule tasks")
213
+ else:
214
+ _LOGGER.info("Irrigation MQTT reconnect: re-subscribing topics and re-publishing states")
215
+
207
216
  for ctrl in self._controllers.values():
208
217
  await self._subscribe_controller(ctrl)
218
+ if first_connect and ctrl._schedule and not ctrl._schedule_tasks:
219
+ ctrl.start_schedules()
209
220
  await ctrl.publish_all_states()
210
221
 
211
222
  async def stop(self) -> None:
boneio/version.py CHANGED
@@ -1,2 +1,2 @@
1
1
  # flake8: noqa
2
- __version__ = "1.5.0dev1"
2
+ __version__ = "1.5.0dev2"
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{a as t,c as n,i as r,n as i,o as a,r as o,t as s}from"./monaco-61yH0vfd.js";import{b as c}from"./vendor-pmGLHP0_.js";import{a as l,c as u,i as d,l as f,n as p,o as m,r as h,s as g}from"./index-Bz9etcWZ.js";var _=e(n(),1);function v(){let[e,t]=(0,_.useState)(`dark`);return(0,_.useEffect)(()=>{t(localStorage.getItem(`theme`)||`dark`);let e=new MutationObserver(e=>{e.forEach(e=>{e.attributeName===`data-theme`&&t(document.documentElement.getAttribute(`data-theme`)||`dark`)})});return e.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]}),()=>e.disconnect()},[]),e}function y(e){return u({tag:`svg`,attr:{viewBox:`0 0 24 24`},child:[{tag:`path`,attr:{d:`M11.28 9.53 8.81 12l2.47 2.47a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215l-3-3a.75.75 0 0 1 0-1.06l3-3a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734Z`},child:[]},{tag:`path`,attr:{d:`M3.75 2h16.5c.966 0 1.75.784 1.75 1.75v16.5A1.75 1.75 0 0 1 20.25 22H3.75A1.75 1.75 0 0 1 2 20.25V3.75C2 2.784 2.784 2 3.75 2ZM3.5 3.75v16.5c0 .138.112.25.25.25H15v-17H3.75a.25.25 0 0 0-.25.25Zm13 16.75h3.75a.25.25 0 0 0 .25-.25V3.75a.25.25 0 0 0-.25-.25H16.5Z`},child:[]}]})(e)}var b=c();function x({isOpen:e,onClose:t}){let{t:n}=p(),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(null),s=async()=>{i(!0);try{let e=await f.get(`/api/check_configuration`);o({status:e.data.status,message:e.data.message})}catch{o({status:`error`,message:n(`config_check.failed`)})}finally{i(!1)}};return e?(0,b.jsx)(`div`,{className:`fixed inset-0 bg-base-300/80 flex items-center justify-center z-50`,children:(0,b.jsxs)(`div`,{className:`bg-base-200 p-8 rounded-lg shadow-lg max-w-2xl w-full mx-4`,children:[(0,b.jsx)(`h2`,{className:`text-2xl font-bold mb-6`,children:n(`config_check.title`)}),r?(0,b.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-8`,children:[(0,b.jsx)(`div`,{className:`loading loading-spinner loading-lg`}),(0,b.jsx)(`p`,{className:`text-lg`,children:n(`config_check.checking`)})]}):a?(0,b.jsxs)(`div`,{className:`space-y-4`,children:[(0,b.jsx)(`div`,{className:`text-lg font-semibold ${a.status===`success`?`text-success`:`text-error`}`,children:a.status===`success`?n(`config_check.valid`):n(`config_check.error`)}),a.message&&(0,b.jsx)(`pre`,{className:`bg-base-300 p-4 rounded-lg whitespace-pre-wrap`,children:a.message}),(0,b.jsxs)(`div`,{className:`flex justify-end gap-4 mt-6`,children:[(0,b.jsx)(`button`,{className:`btn btn-ghost`,onClick:()=>{o(null),t()},children:n(`common.close`)}),(0,b.jsx)(`button`,{className:`btn btn-primary`,onClick:()=>{o(null),s()},children:n(`config_check.check_again`)})]})]}):(0,b.jsxs)(`div`,{className:`space-y-6`,children:[(0,b.jsx)(`p`,{className:`text-base-content/70`,children:n(`config_check.description`)}),(0,b.jsxs)(`div`,{className:`flex justify-end gap-4`,children:[(0,b.jsx)(`button`,{className:`btn btn-ghost`,onClick:t,children:n(`common.cancel`)}),(0,b.jsx)(`button`,{className:`btn btn-primary`,onClick:s,children:n(`config_check.check_button`)})]})]})]})}):null}function S(e){return new Worker(`/assets/yaml.worker-BKRoXlmz.js`,{name:e?.name})}self.MonacoEnvironment={getWorker(e,t){return t===`yaml`?new S:t===`json`?new s:new i}},a.config({monaco:r});var C;function w(){let[e,n]=(0,_.useState)([]),[r,i]=(0,_.useState)(null),[a,s]=(0,_.useState)(``),[c,u]=(0,_.useState)(!1),[p,S]=(0,_.useState)(`waiting`),[w,T]=(0,_.useState)(!0),[E,D]=(0,_.useState)(!1),O=v(),k=async()=>{try{n((await f.get(`/api/files`)).data.items)}catch(e){console.error(`Error loading directory:`,e)}},A=async e=>{try{let t=`/api/files/${encodeURIComponent(e)}`,n=await f.get(t);i(e),s(n.data.content),localStorage.setItem(`lastOpenedFile`,e)}catch(e){console.error(`Error loading file:`,e)}},j=async()=>{if(r)try{await f.put(`/api/files/${encodeURIComponent(r)}`,{content:a}),console.log(`File saved successfully`)}catch(e){console.error(`Error saving file:`,e)}},M=async e=>{if(!C){let t=(await f.get(`/schema/config.schema.json`)).data;C=await o(e,{enableSchemaRequest:!0,schemas:[{uri:window.location.origin+`/schema/config.schema.json`,fileMatch:[`config.yaml`,`config.yml`],schema:t},...Object.keys(t.properties).map(e=>({uri:window.location.origin+`/schema/${e}.schema.json`,fileMatch:[`${e}.yaml`,`${e}.yml`],schema:t.properties[e]}))],validate:!0})}},N=async(e,t)=>{e.addCommand(t.KeyMod.CtrlCmd|t.KeyCode.KeyS,()=>{j()})},P=e=>{n(t=>{let n=t=>t.map(t=>t.path===e?{...t,isOpen:!t.isOpen}:t.children?{...t,children:n(t.children)}:t);return n(t)})},F=(e,t=0)=>e.map(e=>{let n=t==0||e.isOpen;return(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`button`,{className:`flex items-center gap-2 w-full px-2 py-1 hover:bg-base-300 ${r===e.path?`bg-primary/10`:``}`,style:{paddingLeft:`${t*16+8}px`},onClick:()=>e.type===`file`?A(e.path):P(e.path),children:[e.type===`directory`&&(0,b.jsx)(`span`,{className:`text-xs`,children:n?(0,b.jsx)(h,{}):(0,b.jsx)(d,{})}),(0,b.jsx)(`span`,{className:`text-base-content/70`,children:e.type===`directory`?n?(0,b.jsx)(g,{}):(0,b.jsx)(m,{}):(0,b.jsx)(l,{})}),(0,b.jsx)(`span`,{className:`text-sm truncate`,children:e.name})]}),e.type===`directory`&&n&&e.children&&F(e.children,t+1)]},e.path)}),I=async()=>{try{return await f.get(`/api/files`),!0}catch{return!1}},L=async()=>{for(u(!0),S(`waiting`),await new Promise(e=>setTimeout(e,2e3)),S(`checking`);;){if(await I()){S(`ready`),await new Promise(e=>setTimeout(e,1e3)),u(!1),k();break}await new Promise(e=>setTimeout(e,1e3))}};return(0,_.useEffect)(()=>{(async()=>{await k();let e=localStorage.getItem(`lastOpenedFile`);e&&A(e)})()},[]),(0,b.jsxs)(`div`,{className:`flex h-full bg-base-300`,children:[c?(0,b.jsx)(`div`,{className:`fixed inset-0 bg-base-300/80 flex items-center justify-center z-50`,children:(0,b.jsxs)(`div`,{className:`bg-base-200 p-8 rounded-lg shadow-lg text-center`,children:[(0,b.jsx)(`div`,{className:`loading loading-spinner loading-lg mb-4`}),(0,b.jsxs)(`h2`,{className:`text-xl font-bold mb-4`,children:[p===`waiting`&&`Restarting Service...`,p===`checking`&&`Waiting for Service...`,p===`ready`&&`Service Restarted!`]}),(0,b.jsxs)(`p`,{className:`text-base-content/70`,children:[p===`waiting`&&`Initiating service restart`,p===`checking`&&`Checking if service is back online`,p===`ready`&&`Redirecting...`]})]})}):null,(0,b.jsxs)(`div`,{className:`${w?`w-64`:`w-0`} transition-all duration-300 bg-base-200 border-r border-base-content/10 overflow-hidden`,children:[(0,b.jsx)(`div`,{className:`p-2 text-sm font-semibold text-base-content/70 uppercase`,children:`Explorer`}),(0,b.jsx)(`div`,{className:`overflow-y-auto`,children:F(e)})]}),(0,b.jsxs)(`div`,{className:`flex-1 overflow-hidden flex flex-col h-full max-h-screen`,children:[(0,b.jsxs)(`div`,{className:`flex items-center p-2 border-b border-base-content/10`,children:[(0,b.jsx)(`button`,{onClick:()=>T(!w),className:`btn btn-ghost btn-sm p-1`,title:w?`Hide file tree`:`Show file tree`,children:(0,b.jsx)(y,{className:`h-5 w-5 opacity-70 transition-transform duration-200 ${w?``:`rotate-180`}`})}),r&&(0,b.jsx)(`span`,{className:`ml-2 text-sm opacity-70`,children:r})]}),(0,b.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,b.jsx)(t,{height:`100%`,width:`100%`,defaultLanguage:`yaml`,path:r||`config.yaml`,theme:O===`light`?`vs-light`:`vs-dark`,value:a,onChange:e=>s(e||``),onMount:N,beforeMount:M,options:{minimap:{enabled:!0},scrollBeyondLastLine:!1,fontSize:14,automaticLayout:!0,readOnly:!1,formatOnType:!0,formatOnPaste:!0,quickSuggestions:{other:!0,comments:!1,strings:!0}}})}),(0,b.jsxs)(`div`,{className:`h-12 bg-base-200 border-t border-base-content/10 flex items-center justify-end px-4 gap-4`,children:[(0,b.jsx)(`button`,{onClick:j,disabled:!r,className:`btn btn-primary btn-sm`,children:`Save`}),(0,b.jsx)(`button`,{onClick:()=>D(!0),className:`btn btn-primary btn-sm`,children:`Check Config`}),(0,b.jsx)(`button`,{onClick:async()=>{await j();try{if((await f.post(`/api/restart`)).data.status===`not available`){let e=document.getElementById(`toast`);e&&(e.classList.remove(`hidden`),setTimeout(()=>{e.classList.add(`hidden`)},5e3))}else console.log(`Service restarted successfully`),L()}catch(e){console.error(`Error restarting service:`,e)}},disabled:!r,className:`btn btn-secondary btn-sm`,children:`Save and Restart`})]})]}),(0,b.jsx)(`div`,{id:`toast`,className:`toast toast-end hidden`,children:(0,b.jsx)(`div`,{className:`alert alert-warning`,children:(0,b.jsx)(`span`,{children:`Restart not possible. Application is not running as systemd service. Restart manually.`})})}),(0,b.jsx)(x,{isOpen:E,onClose:()=>D(!1)})]})}export{w as default};
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./index-Bz9etcWZ.js";function t(t){let n=e(t);return[`=== ROLE ===`,`You are a friendly boneIO Black input configuration wizard.`,`Your job is to help the user configure a physical input (button/switch) step by step.`,``,`=== CONVERSATION RULES ===`,`1. Ask ONE question at a time. Keep questions short and clear.`,`2. ONLY use IDs and values from the CONTEXT section below — never invent IDs.`,`3. When the user describes an action in natural language, match it to the closest available output, cover, or remote device from the context.`,`4. After each user answer, confirm what you understood before moving on.`,`5. When the user mentions a "light" or ESPHome light output, ask follow-up questions about:`,` - Action type (TOGGLE, ON, OFF, BRIGHTNESS_UP, BRIGHTNESS_DOWN, SET_BRIGHTNESS)`,` - Transition time (in seconds)`,` - Brightness level (0-255)`,` - Color temperature (if supported)`,`6. When the user mentions a "cover" or "blind" or "roller shutter", ask about:`,` - Cover action (TOGGLE, OPEN, CLOSE, STOP, SMART_TOGGLE, TILT)`,` - Position (0-100) if applicable`,`7. When the user mentions MQTT action, ask for the MQTT topic and message payload.`,`8. Skip questions about features the user says they don't need.`,``,`=== CONVERSATION FLOW ===`,`Follow this order (skip steps the user already answered):`,``,`Step 1: Ask which physical input to configure (e.g. IN_01 to IN_49).`,` Show a few available inputs from the context if helpful.`,` IMPORTANT: Check "configured_inputs" in the context first.`,` If an input is already configured, warn the user and ask if they want to reconfigure it.`,`Step 2: Ask what name to give this input (e.g. "Bedroom Light Switch").`,`Step 3: Ask which area/room it belongs to (show available areas).`,`Step 4: Ask what should happen on SINGLE CLICK.`,` - Which output/cover/remote device should it control?`,` - What action? (TOGGLE, ON, OFF, etc.)`,` - If it's a light with brightness: ask about transition, brightness.`,`Step 5: Ask if the user wants a DOUBLE CLICK action.`,` - If yes, same sub-questions as Step 4.`,` - If no, skip to Step 6.`,`Step 6: Ask if the user wants a LONG PRESS action.`,` - If yes, same sub-questions as Step 4.`,` - If no, skip to Step 7.`,`Step 7: Ask if they want any advanced settings (bounce_time, double_click_duration, etc.).`,` - Most users will say no — that's fine, use defaults.`,`Step 8: Show a summary of the configuration and ask for confirmation.`,`Step 9: Output the final JSON.`,``,`=== OUTPUT FORMAT ===`,`When the user confirms the configuration, output ONLY a valid JSON block.`,`No markdown code fences, no explanations around the JSON.`,`The JSON must have this exact shape:`,`{"version":1,"entity_type":"event","apply_to":"current_form","changes":{...}}`,``,`The "changes" object should contain ALL fields for the configured input:`,`- "name": display name`,`- "boneio_input": the selected input ID (e.g. "IN_01")`,`- "area": room/area ID (if selected)`,`- "actions": object with click type keys, each containing an array of action objects`,``,`Action object fields: action, boneio_output, action_output, boneio_cover, action_cover,`,`remote_device, output_id, cover_id, brightness, color_temp, transition, topic, action_mqtt_msg.`,`Only include fields relevant to the action type.`,``,`=== EXAMPLE FINAL JSON ===`,JSON.stringify({version:1,entity_type:`event`,apply_to:`current_form`,changes:{name:`Bedroom Light`,boneio_input:`IN_01`,area:`bedroom`,actions:{single:[{action:`output`,boneio_output:`out_01`,action_output:`TOGGLE`}],double:[{action:`output`,boneio_output:`out_01`,action_output:`ON`,brightness:255}],long:[{action:`output`,boneio_output:`out_01`,action_output:`OFF`}]}}},null,2),``,`=== CONTEXT (your knowledge about this boneIO device) ===`,JSON.stringify(n,null,2),``,`=== BEGIN ===`,`Start by greeting the user and asking which input (IN_01 to IN_49) they want to configure.`,`If there are no available inputs left, let the user know.`].join(`
2
+ `)}export{t as buildAiWizardPrompt};