# Howto read rpi gpio state after reboot

**URL:** <https://discourse.nodered.org/t/howto-read-rpi-gpio-state-after-reboot/83218>\
**Category:** General\
**Created:** [27 November 2023 11:36 UTC](https://discourse.nodered.org/t/howto-read-rpi-gpio-state-after-reboot/83218 "2023-11-27T11:36:08Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kliurka](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kliurka/32/79969_2.png) [@Kliurka](https://discourse.nodered.org/u/Kliurka)\
**Post date:** [27 November 2023 11:36 UTC](https://discourse.nodered.org/t/howto-read-rpi-gpio-state-after-reboot/83218/1 "2023-11-27T11:36:08Z")

</div>

howto read rpi gpio state after rpi reboot, or howto initiate force read gpio

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [27 November 2023 12:01 UTC](https://discourse.nodered.org/t/howto-read-rpi-gpio-state-after-reboot/83218/2 "2023-11-27T12:01:54Z")

</div>

Make sure the read at start option is ticked

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/6/467c8ffe435e3f89308c0a3c514e990979bbbca1.png)

---

<div class="post-metadata">

**Author:** ![Kliurka](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kliurka/32/79969_2.png) [@Kliurka](https://discourse.nodered.org/u/Kliurka)\
**Post date:** [27 November 2023 16:26 UTC](https://discourse.nodered.org/t/howto-read-rpi-gpio-state-after-reboot/83218/3 "2023-11-27T16:26:41Z")

</div>

I check this option, but after reboot not work.  
Remark: And after deploying not always working.  
If i'm change rpi node parameter, then after deploying working, but if i'm only change rpi node place, after deploy not work.  
p.s. If I did modified deploy, if full deploy - works!.

Nodered - 3.1.0  
node-red-node-pi-gpio - 2.0.6

---

<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:** [27 November 2023 17:01 UTC](https://discourse.nodered.org/t/howto-read-rpi-gpio-state-after-reboot/83218/4 "2023-11-27T17:01:18Z")

</div>

> [@Kliurka](#):
>
> after deploy not work.  
> p.s. If I did modified deploy, if full deploy - works!.

That is expected. The gpio node will not be re-initialised if you do a partial deploy (unless the gpio node has been modified).

> [@Kliurka](#):
>
> after reboot not work.

How do you know?

---

<div class="post-metadata">

**Author:** ![Kliurka](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kliurka/32/79969_2.png) [@Kliurka](https://discourse.nodered.org/u/Kliurka)\
**Post date:** [27 November 2023 17:24 UTC](https://discourse.nodered.org/t/howto-read-rpi-gpio-state-after-reboot/83218/5 "2023-11-27T17:24:33Z")

</div>

Debug node doesn't leave any payload message. And it has should change svg graphic element color, but it not change, must change to 0-green, 1- red, after rebooting it remains colorless, until the gpio status changes.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [27 November 2023 17:36 UTC](https://discourse.nodered.org/t/howto-read-rpi-gpio-state-after-reboot/83218/6 "2023-11-27T17:36:02Z")

</div>

at boot time, the flow may start running before the dashboard connects - so the gpio state may get read and sent before the dashboard is listening.

---

<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:** [27 November 2023 17:38 UTC](https://discourse.nodered.org/t/howto-read-rpi-gpio-state-after-reboot/83218/7 "2023-11-27T17:38:37Z")

</div>

> [@Kliurka](#):
>
> Debug node doesn't leave any payload message.

On boot, by the time you open the browser window, the message from the gpio node will be long gone. Configure a debug node connected to the gpio node and select System Console (as well as debug window) in the debug node. Then reboot and open a command window and run  
`journalctl -b -u nodered`  
and it should show you the node-red log since the reboot. You should see the debug node output there.

---

<div class="post-metadata">

**Author:** ![Kliurka](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kliurka/32/79969_2.png) [@Kliurka](https://discourse.nodered.org/u/Kliurka)\
**Post date:** [27 November 2023 18:56 UTC](https://discourse.nodered.org/t/howto-read-rpi-gpio-state-after-reboot/83218/8 "2023-11-27T18:56:05Z")

</div>

Yes, after boot rpi node read gpio status, but then what would be the solution for me?  
I think need force read gpio status, but how? 🤔

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [27 November 2023 18:59 UTC](https://discourse.nodered.org/t/howto-read-rpi-gpio-state-after-reboot/83218/9 "2023-11-27T18:59:25Z")

</div>

use a change node to set status into a flow variable.  
When dashboard connect - use ui-control node to trigger another change node to read flow variable. (I.e. move it back to msg)

---

<div class="post-metadata">

**Author:** ![Kliurka](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kliurka/32/79969_2.png) [@Kliurka](https://discourse.nodered.org/u/Kliurka)\
**Post date:** [27 November 2023 19:53 UTC](https://discourse.nodered.org/t/howto-read-rpi-gpio-state-after-reboot/83218/10 "2023-11-27T19:53:39Z")

</div>

hmmm I not completely understand? 🤔

 ![Screenshot_20231127_214714](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/c/1c488cb9ec0e16098c0541e5f04dd99089bdbedf.png)

---

<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:** [28 November 2023 14:08 UTC](https://discourse.nodered.org/t/howto-read-rpi-gpio-state-after-reboot/83218/11 "2023-11-28T14:08:52Z")

</div>

> [@Kliurka](#):
>
> I not completely understand

Which bit don't you understand? See [Working with context : Node-RED](https://nodered.org/docs/user-guide/context) if it is the use of context that you do not understand.
