# Tiggering xstate machine

**URL:** https://discourse.nodered.org/t/tiggering-xstate-machine/85620
**Category:** General
**Created:** [17 February 2024 19:59 UTC](https://discourse.nodered.org/t/tiggering-xstate-machine/85620 "2024-02-17T19:59:14Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Hogi](https://avatars.discourse-cdn.com/v4/letter/h/dbc845/32.png) [@Hogi](https://discourse.nodered.org/u/Hogi)
#### Post date: [17 February 2024 19:59 UTC](https://discourse.nodered.org/t/tiggering-xstate-machine/85620/1 "2024-02-17T19:59:14Z")

</div>

Hi all  
I am new here (from Germany) and also new in using Node Red. I am looking for some support on xstate machine.  
I have implemented the states but I am failing triggering the transitions from outside.  
My transition condition is called "nacht".  
I tried using the "Inject" Node to trigger. Not working but honestly I also cannot understand the description:

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/d/ed1fddf123eef1b76b5cf01c717af51e5e6def2e.png)

Hope someone could help me with a simple explenation 😉

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [17 February 2024 20:15 UTC](https://discourse.nodered.org/t/tiggering-xstate-machine/85620/2 "2024-02-17T20:15:29Z")

</div>

Hi Hogi.

Welcome to the forum.

when discussing a node, it is good etiquette to fully name it (or better still provide a link to it from the [flows library](https://flows.nodered.org/))

Anyhow, i dont tend to use state machine nodes (I find they end up making things more complex by hiding the logic away in script blocks instead of visual/readable flows)

It may well be your task suits a state machine but lets check you are not over complicating things first.

What is your overall goal?

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [17 February 2024 20:17 UTC](https://discourse.nodered.org/t/tiggering-xstate-machine/85620/3 "2024-02-17T20:17:32Z")

</div>

Did you import the example referenced in the readme to see how that works?  
Assuming that you are talking about [node-red-contrib-xstate-machine](https://flows.nodered.org/node/node-red-contrib-xstate-machine).

---

<div class="post-metadata">

### Author: ![Hogi](https://avatars.discourse-cdn.com/v4/letter/h/dbc845/32.png) [@Hogi](https://discourse.nodered.org/u/Hogi)
#### Post date: [17 February 2024 20:52 UTC](https://discourse.nodered.org/t/tiggering-xstate-machine/85620/4 "2024-02-17T20:52:58Z")

</div>

Using this:  
node-red-contrib-xstate-machine

I explicitly chose NodeRed to use that state machine...

---

<div class="post-metadata">

### Author: ![Hogi](https://avatars.discourse-cdn.com/v4/letter/h/dbc845/32.png) [@Hogi](https://discourse.nodered.org/u/Hogi)
#### Post date: [17 February 2024 21:25 UTC](https://discourse.nodered.org/t/tiggering-xstate-machine/85620/5 "2024-02-17T21:25:35Z")

</div>

I copied the state machine code in the state machine. If the example also contain the triggers outside I need to know how to import the complete model...

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [17 February 2024 21:32 UTC](https://discourse.nodered.org/t/tiggering-xstate-machine/85620/6 "2024-02-17T21:32:08Z")

</div>

I think you will need to ask the author for help via an issue on the node's GitHub page.

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [17 February 2024 21:34 UTC](https://discourse.nodered.org/t/tiggering-xstate-machine/85620/7 "2024-02-17T21:34:42Z")

</div>

Node-red nodes often have examples. You import examples using `ctrl-i`

This node also has a full flow example here: [node-red-contrib-xstate-machine/examples/flows at master · sonntam/node-red-contrib-xstate-machine · GitHub](https://github.com/sonntam/node-red-contrib-xstate-machine/tree/master/examples/flows)

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [17 May 2024 21:35 UTC](https://discourse.nodered.org/t/tiggering-xstate-machine/85620/8 "2024-05-17T21:35:15Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
