Start a new topic

Timed message board

I would love a Lametric TIME app that works like the currently built-in app "Message Build" except you can put specific time-frames for each message to appear. For example I'd have a message that says "Work" that only appears from 12:00 to 16:00, and a different message that says "Clean house" from "16:00" to "18"00" and so on. When no messages are set to display at the current time, the app simply hides itself as if it's set to not display, so that it won't simply show a "No messages at the moment" message if you have your apps set to Auto-scroll. This would be super helpful in helping remind me what I'm supposed to be doing at a given moment.

Sorry I meant like the currently built-in app "Message Board", not Message Build Instead or making a whole new app, adding this functionality to the existing app would also be very welcome.

1 person likes this

Before we dive into the app creation, let's briefly discuss the Lametric TIME platform. It's a digital display that can show various information, including custom-built apps. These apps are typically created using HTML, CSS, and JavaScript.

App Structure and Functionality:

For your desired app, we'll need the following components:

Message Storage: This will store the messages, their content, and the timeframes when they should appear.Time Tracking: A function to continuously check the current time and compare it to the stored message timeframes.Display Logic: A mechanism to decide which message to display based on the current time.Hiding Mechanism: A way to hide the app when no messages are scheduled.

Code Example:

Here's a basic JavaScript code structure to achieve slope:

 

JavaScript

// Message storage (replace with your preferred data structure)
const messages = [
  { content: "Work", startTime: "12:00", endTime: "16:00" },
  { content: "Clean house", startTime: "16:00", endTime: "18:00" }
];

// Time tracking and display logic
function updateDisplay() {
  const currentTime = new Date();
  let currentMessage = null;

  for (const message of messages) {
    const startTime = new Date(currentTime.getFullYear(), currentTime.getMonth(), currentTime.getDate(), message.startTime.split(":")[0], message.startTime.split(":")[1]);
    const endTime = new Date(currentTime.getFullYear(), currentTime.getMonth(), currentTime.getDate(), message.endTime.split(":")[0], message.endTime.split(":")[1]);

    if (currentTime >= startTime && currentTime < endTime) {
      currentMessage = message;
      break;
    }
  }

  if (currentMessage) {
    // Display the message on the Lametric TIME device
    // (e.g., using Lametric's API or a custom integration)
    displayMessage(currentMessage.content);
  } else {
    // Hide the app
    hideApp();
  }
}

// Function to display a message on the Lametric TIME device
function displayMessage(message) {
  // Your Lametric TIME-specific code here
}

// Function to hide the app
function hideApp() {
  // Your Lametric TIME-specific code here
}

// Update the display every minute (adjust as needed)
setInterval(updateDisplay, 60000);

Login or Signup to post a comment