Weiter zum Inhalt
  • Home
  • Aktuell
  • 0 Ungelesen 0
  • Kategorien
  • Unreplied
  • Beliebt
  • GitHub
  • Docu
  • Hilfe
Skins
  • Hell
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dunkel
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Standard: (Kein Skin)
  • Kein Skin
Einklappen
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. English
  3. Development
  4. [New Adapter] statechart - build state machines graphically

NEWS

  • Monatsrückblick Oktober 2026 ist online!
    BluefoxB
    Bluefox
    11
    1
    419

  • Mitmachen: Sprich „ioBroker“ ein – für ein lokales Aktivierungswort
    BluefoxB
    Bluefox
    6
    1
    555

  • Neuer Blogbeitrag: KI in ioBroker, vom Helfer im Admin bis zum eigenen Smart Assistant
    BluefoxB
    Bluefox
    5
    1
    609

[New Adapter] statechart - build state machines graphically

Geplant Angeheftet Gesperrt Verschoben Development
4 Beiträge 3 Kommentatoren 125 Aufrufe 4 Beobachtet
  • Älteste zuerst
  • Neuste zuerst
  • Meiste Stimmen
Antworten
  • In einem neuen Thema antworten
Anmelden zum Antworten
Dieses Thema wurde gelöscht. Nur Nutzer mit entsprechenden Rechten können es sehen.
  • I
    I
    Igge
    schrieb am zuletzt editiert von
    #1

    Hi everyone,

    I'd like to introduce my adapter ioBroker.statechart and I'm looking for testers before it goes into the beta repository.

    Many automations are really state machines: the light is on or off, the heating is in comfort, eco or window open mode, the washing machine is running or done. In scripts or Blockly this quickly spreads over many triggers, helper variables and timers. With this adapter you draw such logic as a statechart directly in the admin: states as boxes, transitions as arrows with conditions. The adapter executes the chart exactly as it is drawn.

    image.jpeg

    Example alarm system (available as a template when you create a chart): In Disarmed, the chart waits to be armed, or arms itself at 11 pm if no window is open. An open window is reported. Armed contains the substates Exit delay (30 s), Monitoring, Entry delay (20 s) and Alarm. Door, window or motion for at least 2 s trigger it, motion not during night mode. In the alarm, two parallel regions run: the Siren goes silent after 3 minutes, the Notification sends a reminder every 10 minutes. Pressing the panic button three times triggers the alarm immediately. Disarming ends everything, whatever substate the chart is in.

    Highlights

    • Nested and parallel states, entry/during/exit actions, transitions as event[condition]{action}
    • Temporal logic like after(5, min), every, counting button presses, at("22:30") or at("sunset", -30)
    • Inputs and outputs are any ioBroker states, your own JavaScript functions in function blocks
    • Live view with active states and values, history, and a simulation with fast-forward, breakpoints and single steps, without switching anything
    • Checks while editing, templates for new charts, restore former versions, import/export

    image.jpeg

    image.jpeg

    Installation

    Until the adapter is in the beta repository, install the released version from npm: Admin → Adapters → Install from custom URL → tab Custom → iobroker.statechart (or on the console: iobroker url iobroker.statechart). Then add an instance of State Machine.

    Requirements: Node.js 22, js-controller ≥ 6.0.11, admin ≥ 7.6.20

    Docs: Getting started · Reference

    Feedback

    I'm especially interested in whether you can get started without prior knowledge, and which of your automations fit well or badly into a chart. Please report bugs as an issue on GitHub, questions and ideas here in the thread.

    This is an early version, the format of the charts may still change until 1.0. Please don't rely on it blindly for critical things like an alarm system or heating in winter yet.

    Looking forward to your feedback!

    1 Antwort Letzte Antwort
    3
    • BluefoxB
      BluefoxB
      Bluefox
      schrieb am zuletzt editiert von Bluefox
      #2

      @Igge nice work, the simulation with fast-forward and breakpoints is something we have been missing for logic in ioBroker.

      One question: how are the actions and function blocks executed at runtime? Directly in the adapter process or in some kind of sandbox (vm)? If a user writes an endless loop or throws an exception in a during action, what happens to the other charts and to the adapter?

      Once you have the first feedback from testers, create a PR in ioBroker.repositories to add it to the latest repository. The repository checker will tell you what still has to be fixed before that.

      Following notes:

      • It would be cool, that theme of ioBroker (dark/light) would be supported
      • It would be useful to see in the description to condition the example with Variable

      image.jpeg

      1 Antwort Letzte Antwort
      0
      • I
        I
        Igge
        schrieb zuletzt editiert von
        #3

        Hi Bluefox,

        thanks for the question and the notes!

        How code runs today (0.5.x): conditions, actions and function blocks run in the adapter process, in a separate JavaScript context per chart (Node.js vm) without require or process, with a time limit of 1 second and inside a try/catch. An exception is logged as a warning and the chart continues, other charts are not affected. An endless loop is aborted after 1 second, but since all charts share one process, the whole adapter is blocked for that second, and a during action would do that again on every wakeup. Code in Promise callbacks escapes both protections. It is no security sandbox, just like the JavaScript adapter.

        Planned for the next version:

        • A chart whose code exceeds the time limit is stopped, with an error in the log. Fix it and start it again with ▶.
        • Promise callbacks get the same time limit, their exceptions are caught.
        • A chart which writes states far more often than plausible (e.g. a feedback loop) is stopped as well.

        Your notes: both good points, I'll include them in the next release:

        • The editor will follow the dark/light theme of ioBroker.
        • The explanation of the condition field will get an example with a variable.
        1 Antwort Letzte Antwort
        1
        • mcm1957M
          mcm1957M
          mcm1957
          Developer Most Active
          schrieb zuletzt editiert von
          #4

          Note

          This is an english version of Topic https://forum.iobroker.net/topic/85834/test-adapter-statechart-v0.5.1-grafische-zustandsautomaten addressed to non german speakers. Whoever speak german is welcome to use the german section.

          Entwicklung u Betreuung: envertech-pv, hoymiles-ms, ns-client, pid, snmp Adapter;
          Support Repositoryverwaltung.

          Wer 'nen Kaffee spendieren will: https://paypal.me

          LESEN - gute Forenbeitrage

          1 Antwort Letzte Antwort
          0

          Hey! Du scheinst an dieser Unterhaltung interessiert zu sein, hast aber noch kein Konto.

          Hast du es satt, bei jedem Besuch durch die gleichen Beiträge zu scrollen? Wenn du dich für ein Konto anmeldest, kommst du immer genau dorthin zurück, wo du zuvor warst, und kannst dich über neue Antworten benachrichtigen lassen (entweder per E-Mail oder Push-Benachrichtigung). Du kannst auch Lesezeichen speichern und Beiträge positiv bewerten, um anderen Community-Mitgliedern deine Wertschätzung zu zeigen.

          Mit deinem Input könnte dieser Beitrag noch besser werden 💗

          Registrieren Anmelden
          Antworten
          • In einem neuen Thema antworten
          Anmelden zum Antworten
          • Älteste zuerst
          • Neuste zuerst
          • Meiste Stimmen


          Support us

          ioBroker
          Community Adapters
          Donate

          316

          Online

          33.2k

          Benutzer

          84.3k

          Themen

          1.4m

          Beiträge
          Community
          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
          ioBroker Community 2014-2026
          logo
          • Anmelden

          • Du hast noch kein Konto? Registrieren

          • Anmelden oder registrieren, um zu suchen
          • Erster Beitrag
            Letzter Beitrag
          0
          • Home
          • Aktuell
          • Ungelesen 0
          • Kategorien
          • Unreplied
          • Beliebt
          • GitHub
          • Docu
          • Hilfe