Skip to content

Deno Server Doesn't Know if Bat Signal is On/Offline #3

@its-all-waves

Description

@its-all-waves

This issue is part of the Below C Level Hacktivity - 25.11.04 (Issue #5).

Issue

The Deno Server is currently unaware of Bat Signal's connected/disconnected status. This means the frontend will behave as if Bat Signal is powered on and connected to Arduino Cloud regardless of whether this is true, providing no feedback that the system isn't up.

Hint

The Deno Server currently uses the npm pkg arduino-iot-js to listen for and send Cloud Variable changes, but this library is limited. We can't use it to get Associcated Device on/offline status. Arduino provides another way to do this. (Because we won't be upgrading our Arduino account, webhooks and triggers are unavailable. Think "polling.")

Possible Fix

Employ Arduino IoT Cloud API (REST) either manually or using the helper npm pkg @arduino/arduino-iot-client. Use Devices V2 Show and not Devices V2 GetStatusEvents. The latter requires start and limit params, which makes it impossible to reliably get the very last event (which tells us the current on/offline status). If there are no recent events, an empty array is returned (the cache duration unknown), so we won't know if the last event was a CONNECTED or DISCONNECTED. Also, we'll want to disable the frontend when Bat Signal is offline.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions