# Session Close/Open Behavior while Swan sleeps

**URL:** <https://discuss.blues.com/t/session-close-open-behavior-while-swan-sleeps/3275>\
**Category:** Troubleshooting\
**Created:** [September 1, 2025, 11:06pm UTC](https://discuss.blues.com/t/session-close-open-behavior-while-swan-sleeps/3275 "2025-09-01T23:06:25Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![scavoj](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@scavoj](https://discuss.blues.com/u/scavoj)\
**Post date:** [September 1, 2025, 11:06pm UTC](https://discuss.blues.com/t/session-close-open-behavior-while-swan-sleeps/3275/1 "2025-09-01T23:06:25Z")

</div>

is there a way to force a new session open after the previous session has been closed? From what I see, if there is a note waiting to be sent to notehub, this will happen automatically. But if my Swan is in sleep mode and the session is closed, it can’t wake up on, say, an environment variable change since there is no connection from notehub to the notecard. I must be missing something.

I have the hub.set duration set to -1 but it still closes the session after some time has elapsed (it seems like every few days).

Thanks,

Joe

---

<div class="post-metadata">

**Author:** ![tjvantoll](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/tjvantoll/32/231_2.png) [@tjvantoll](https://discuss.blues.com/u/tjvantoll)\
**Post date:** [September 2, 2025, 12:47pm UTC](https://discuss.blues.com/t/session-close-open-behavior-while-swan-sleeps/3275/3 "2025-09-02T12:47:47Z")

</div>

Hey @scavoj,

How often your Notecard receives environment variables updates is determined by your `inbound` interval and not your session duration.

For example, if you want to check for inbound data (including environment variable updates) every hour you can use the following `hub.set` configuration:

```json
{"req":"hub.set","mode":"periodic","inbound":60}

```

or

```json
{"req":"hub.set","mode":"continuous","inbound":60}

```

If you want your Notecard immediately receive environment variable updates you could utilize the `hub.set` request’s `sync` argument.

```json
{"req":"hub.set","mode":"continuous","sync":true}

```

With either of those configuration approaches in place, you can then use the `card.attn` request to set up your Notecard to wake your Swan when it receives environment variables updates. If you have questions on any of this let me know.

Thanks,

TJ

---

<div class="post-metadata">

**Author:** ![scavoj](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@scavoj](https://discuss.blues.com/u/scavoj)\
**Post date:** [September 2, 2025, 11:24pm UTC](https://discuss.blues.com/t/session-close-open-behavior-while-swan-sleeps/3275/4 "2025-09-02T23:24:56Z")

</div>

TJ,

Yes, thank you. I have all of these settings in place and the notecard is waking up the Swan when an environment variable is changed. I do have sync set to true and I am getting environment variable updates immediately.

My question is regarding the the session close/open.

If the session is closed and an environment variable is changed, does the notecard receive the new environment variable value? My guess is no, since notehub has no connection to the notecard. Correct? And this would also apply to any inbound notes sent through the api. The notecard won’t get them since the session is closed.

So, how do I open a new session on the notecard without having to send a new note to the notecard (a note waiting to be sent seems to automatically open another session). The Swan is sleeping, so it can’t queue up a note on the notecard.

I guess this is a long winded way of asking if I can tell the notecard to open another session after a previous session has closed. Because even if I set the duration to -1, it still closes the session eventually.

Thanks,

Joe

---

<div class="post-metadata">

**Author:** ![tjvantoll](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/tjvantoll/32/231_2.png) [@tjvantoll](https://discuss.blues.com/u/tjvantoll)\
**Post date:** [September 3, 2025, 4:26pm UTC](https://discuss.blues.com/t/session-close-open-behavior-while-swan-sleeps/3275/5 "2025-09-03T16:26:17Z")

</div>

Hey @scavoj,

When in periodic mode, Notecard starts new sessions whenever it makes a connection to Notehub, either because of its `inbound` or `outbound` interval is up, or because of an explicit `hub.sync` request.

When in continuous mode, Notecard starts new sessions according to the `duration` argument you set as part of the `hub.set` request.

You might find part of [this video](https://www.youtube.com/watch?v=RPH2FkGINWs) I recorded a few weeks ago helpful as I cover the `hub.set` request and how all this works in detail (around the 3-minute mark).

> I guess this is a long winded way of asking if I can tell the notecard to open another session after a previous session has closed. Because even if I set the duration to -1, it still closes the session eventually.

If you’re in continuous mode you cannot explicitly start a new session. The minimum value for the `duration` argument is `15`, and so the shortest sessions you can have are 15 minutes long.

I’m curious why you’re looking to start a new session though. Sessions only determine how often Notecard sends [session-specific data to Notehub in `_session.qo` Notes](https://dev.blues.io/api-reference/system-notefiles/#session-qo). Sessions do not control how often Notecard sends or receives inbound or outbound data.

TJ

---

<div class="post-metadata">

**Author:** ![scavoj](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@scavoj](https://discuss.blues.com/u/scavoj)\
**Post date:** [October 11, 2025, 7:34pm UTC](https://discuss.blues.com/t/session-close-open-behavior-while-swan-sleeps/3275/6 "2025-10-11T19:34:30Z")

</div>

Here is what I am seeing:

hub.set inbound set to 1, outbound set to 0 (Software does an explicit sync), mode is continuous, sync is True. Duration set to 1440.

Notecard on battery. Swan sleeping.

1:00 pm - notecard ends session

Notecard changed to USB. Swan wakes on USB. Swan software sends a note to notecard outbound queue.

1:06pm - I change an environment variable

1:09pm - new session open and notehub gets the note and notecard gets the environment variable change.

The problem is that if I change an environment variable, I need to see the change right away. It works fine if I change an environment variable while a session is open. It’s like the session closure is getting in the way of my environment variable change response time.

And it doesn’t matter if I have duration set to the default. It WILL end the session eventually and I have the same problem as setting the duration to 1440.

If I missed a setting that I should have mentioned, please let me know.

Thanks,

Joe

---

<div class="post-metadata">

**Author:** ![tjvantoll](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/tjvantoll/32/231_2.png) [@tjvantoll](https://discuss.blues.com/u/tjvantoll)\
**Post date:** [October 13, 2025, 5:09pm UTC](https://discuss.blues.com/t/session-close-open-behavior-while-swan-sleeps/3275/7 "2025-10-13T17:09:01Z")

</div>

Hey Joe,

You’re correct that you should be seeing environment variable updates relatively immediately with this configuration.

Can you try this:

1. Connect your Notecard to the [In-Browser Terminal](https://dev.blues.com/terminal).

2. In the Terminal, ensure you’re connected to Notehub by running a `{"req":"hub.status"}` command, and making sure you get `"connected": true` back.

3. In Notehub, update some environment variable for that device.

4. In the Terminal, run a `{"req":"env.get"}` request every few seconds to see how long it takes you to get the update.

I just ran this test on factory-reset Notecard with `{"mode": "continuous","sync": true}` (and no `duration` specified), and I’m consistently seeing my environment-variable updates within 2–3 seconds.

TJ

---

<div class="post-metadata">

**Author:** ![scavoj](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@scavoj](https://discuss.blues.com/u/scavoj)\
**Post date:** [October 15, 2025, 3:20am UTC](https://discuss.blues.com/t/session-close-open-behavior-while-swan-sleeps/3275/8 "2025-10-15T03:20:30Z")

</div>

TJ,

Yes, I am seeing environment variable changes immediately when there is an open session. However, when the session gets closed and the swan is sleeping (it can’t add notes), the environment variable changes don’t get through to the notecard to wake the Swan. Seems like a deadlock situation.

Even if I have duration set to the default, the session does get closed eventually. And I have the same problem.

Thanks,

Joe

---

<div class="post-metadata">

**Author:** ![tjvantoll](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/tjvantoll/32/231_2.png) [@tjvantoll](https://discuss.blues.com/u/tjvantoll)\
**Post date:** [October 16, 2025, 3:52pm UTC](https://discuss.blues.com/t/session-close-open-behavior-while-swan-sleeps/3275/9 "2025-10-16T15:52:38Z")

</div>

Hey @scavoj,

Sorry for the late response here. I’ll do some asking around today and see if anyone has any ideas. In the meantime can you let me know what firmware version your Notecard is using?

TJ

---

<div class="post-metadata">

**Author:** ![tjvantoll](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/tjvantoll/32/231_2.png) [@tjvantoll](https://discuss.blues.com/u/tjvantoll)\
**Post date:** [October 16, 2025, 4:13pm UTC](https://discuss.blues.com/t/session-close-open-behavior-while-swan-sleeps/3275/10 "2025-10-16T16:13:20Z")

</div>

Also, when this situation occurs, do you know how long it takes before you start receiving environment variable updates again?

When a session ends Notecard does temporarily drop its connection to Notehub, but it should re-establish it fairly quickly.

TJ

---

<div class="post-metadata">

**Author:** ![scavoj](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@scavoj](https://discuss.blues.com/u/scavoj)\
**Post date:** [October 20, 2025, 8:22pm UTC](https://discuss.blues.com/t/session-close-open-behavior-while-swan-sleeps/3275/11 "2025-10-20T20:22:35Z")

</div>

TJ,

Current Notecard version is:

“version”: “notecard-u5-9.2.3”, “ver\_major”: 9, “ver\_minor”: 2, “ver\_patch”: 3, “ver\_build”: 17324, “built”: “Aug 11 2025 12:07:58”

The most recent session was opened in about a minute, but there was a geolocate in there that may have effected it. I’m still trying to figure out why it sometimes waits so long to reopen the connection. I’ve seen it go 10+ minutes or even longer. Sometimes I’ll try and test it and my low battery skews the results. That’s why it’s taking me so long. That and working on other issues at the same time.

Thanks,

Joe
