Trigger Gladys ambiance scenes with NFC cards

Hello,

I’m thinking about a small interactive project using physical cards equipped with NFC tags to trigger different moods in Gladys.

The idea would be to place a very thin NFC tag in the pocket of each card. When the card is scanned with a phone, it sends an identifier to Gladys via HTTP or MQTT.

Gladys could then:

  • change the color and brightness of the lights

  • play a music or local sound ambiance

  • activate a scene for a set duration

  • record the last scanned card

  • display its name on the dashboard

  • automatically return to the normal ambiance after a few minutes

The project would contain 78 different cards. Here is the list I would use to associate each NFC identifier with a name and a mood:

I specify that I participate in the maintenance of the linked site. I share this page solely to show the dataset and the 78 entries that the automation should handle.

I am now looking for the best architecture in Gladys.

1. HTTP or MQTT to transmit the identifier?

For mainly local use, is it better for the phone to publish the card identifier directly on an MQTT topic?

For example:

gladys/nfc/card

With a value like:

the-world

Or would it be simpler to use NFC Tools or Tasker to send an HTTP request to the Gladys API?

2. A virtual device to store the card

I thought of creating an MQTT virtual device with a text or numeric feature representing the last scanned card.

Is this a good method to allow scenes to react to the value, or should a different scene be triggered directly from the phone?

3. Avoid creating 78 scenes

I would prefer not to create a separate scene for each card.

Is there a clean way to create a single scene that:

  1. retrieves the received identifier

  2. looks up this identifier in a lookup table

  3. retrieves the associated color, brightness, sound, and duration

  4. executes the corresponding actions

The table could look like this:

{
  "the-world": {
    "color": "#D4AF37",
    "brightness": 45,
    "duration": 900
  },
  "the-hermit": {
    "color": "#6B7280",
    "brightness": 20,
    "duration": 1200
  }
}

Can this type of logic be handled directly in Gladys, or would it be better to go through Node-RED or a small external integration?

4. Detecting the card upright or reversed

A card can be placed normally or turned 180 degrees.

I could record two different NFC actions on the phone, for example:

the-world:upright
the-world:reversed

But this would probably require two tags per card.

Do you see a simpler method to also transmit the card’s orientation?

5. Timing and restoring the previous state

After 10 or 15 minutes, I would like to restore the lights and devices to their previous state.

Does Gladys allow saving the states before launching the scene, then automatically restoring them at the end?

Otherwise, I could simply launch a normal ambiance scene after a fixed delay.

6. Display on the dashboard

Finally, would it be possible to display in the dashboard:

  • the name of the last card

  • the scan time

  • its orientation

  • the currently active ambiance

I want to start with a prototype with only three cards before preparing the 78.

For this type of project, would you rather use MQTT, the Open API, Node-RED, or Gladys’s future external integrations system?