[TUTORIAL] How to use an Ulanzi Pixelclock with Awtrix Light for notification

Thx a lot :slight_smile:

Custom icons not yet available? @Bckp

There is flow for that :slight_smile: experimental one

1 Like

I see! Nice! I had the wrong (non-experimental one). Works like a charm! Thanks for this app!

Love the app, but experimenting via MQQT as well to try new apps next to the custom ones. Does anyone know if it possible to define the time a custom app is shown?

Usecase: i love the native calendar app. I want this to be my main app. Through the custom/1 MQQT I can add another app. But the second I only want to display a few seconds. And than back to calendar app for a min. The only way I see to do this now is through a custom Homey flow which I trigger each min and use notify MQQT function where I define the duration as well.

Is there another option to define individually how long each app is shown?

The documentation describes all possible ways:

As far as I could test the behavior you have to distinguish between native and custom apps. To manipulate the display time of a native app you can only use the global key ATIME which configs the duration an app is displayed in seconds for ALL! apps (global setting).

For custom apps you can use the key duration which overwrites the global ATIME key.

But I think for your use case you find the best solution with your config already.

The main advantage of a custom app over a notification is that the awtrix takes over the switching between the constant app infos and you are able to insert an ad hoc information in between.

I read all of the documentation. But indeed, my current config suits best.
Love the clock and Awtrix. Have the calendar as a standard display, when we are at home it shows the outside temp and current weather state each 5 min (notify). Than returning to calendar.
If the laundry is running it shows the remaining time every 8 minutes (notify) and when the laundry is finished it pushed a notification (notify) as well.
Furthermore if the doorbell rings, it shows a ding dong with corresponding bel icon (notify).

Just a few ideas that came to live past 24h. Seeing a lot more usecases though!

Custom apps will be added, im not using mqtt as with it the app will be bigger (build in mqtt) and harder to config, or dependent on 3td party service, so im not experimenting with it for now.

Right now i have dev version that can set any app as current view, with auto-switch apps off, and flow with app listing, you can do whatever you want… but there are so many options in custom apps, it is not eady to put into flow… maybe as experiment with json data, but i have no good solution atm… even notifications have so more options

2 Likes

I’m playing with this, and I love it!
I’ve noticed the icon downloader was removed from the latest release, so I made some python to do it for me, saves me the manual download, rename and upload through the quite slow webinterface…

I’m adding custom apps in an Advanced Flow to do the following:

  • display PM2.5 level
  • display current indoor temperature
  • display current weather
  • display moon standings (although I’m missing some input data for this)

This topic is interesting:

I think it’s possible to replicate the same logic with advanced flows.

1 Like

Okay I got a lot of the stuff working, with custom apps now… however, the icon functionality doesn’t seem to function yet in the test version, the list of icons doesn’t update currently:
image

So I made a small workaround which does the trick for now:

Now it’s working. Not sure if I like the scrolling information… I might make a separate app for rain probabilty, rain level, etc.

1 Like

Adding a trash indicator.

Edit:
I decided this can be done in a nicer way, and I let ChatGPT write a homeyscript for me. Note, this is still a work in progress.

Moonphase.js:

const createCustomApp = async (icon, text, rainbow, duration) => {
  await Homey.flow.runFlowCardAction({
    uri: 'homey:manager:logic',
    id: 'http_advanced',
    args: {
      method: 'post',
      url: 'http://192.168.1.14/api/custom?name=moon',
      headers: 'Content-Type: application/json',
      body: `{
        "icon": "${icon}",
        "text": "${text}",
        "rainbow": ${rainbow},
        "duration": ${duration}
      }`,
    },
  });
};

const checkAndCreateMoonApp = async () => {
  try {
    const conditionResult = await Homey.flow.runFlowCardCondition({
      uri: 'homey:device:<guid of weather app>',
      id: 'Moonphase_type',
      args: {
        moonphase_type: 'VM', // Default value if the condition doesn't match any dropdown value
      },
    });

    console.log('Condition result:', conditionResult);

    // Extract moon phase from the condition result
    const moonPhaseType = conditionResult.result ? 'VM' : 'default';

    // Define icons based on moon phase types
    const moonIcons = {
      'NM': 'new_moon',
      'ZS': 'waxing_crescent',
      'ZH': 'first_quarter',
      'ZM': 'waxing_gibbous',
      'VM': 'full_moon',
      'AM': 'waning_gibbous',
      'AH': 'last_quarter',
      'AS': 'waning_crescent',
    };

    // Get the icon based on the moon phase type
    const icon = moonIcons[moonPhaseType] || 'default_moon';
    console.log('Moon Phase:', moonPhaseType, 'Icon:', icon);

const text = `${
  moonPhaseType === 'NM' ? 'Nieuwe Maan' :
  moonPhaseType === 'ZS' ? 'Wassende Sikkel' :
  moonPhaseType === 'ZH' ? 'Eerste Kwartier' :
  moonPhaseType === 'ZM' ? 'Wassende Maan' :
  moonPhaseType === 'VM' ? 'Volle Maan' :
  moonPhaseType === 'AM' ? 'Afnemende Maan' :
  moonPhaseType === 'AH' ? 'Laatste Kwartier' :
  moonPhaseType === 'AS' ? 'Afnemende Sikkel' :
  'default'
}`;

    // Create the custom app with the moon phase information
    await createCustomApp(icon, text, false, 10);
  } catch (error) {
    console.error('Error checking and creating Moon app:', error.message);
  }
};

// Trigger the moon app creation logic
checkAndCreateMoonApp();


trashLogic.js:

const createCustomApp = async (icon, text, rainbow, duration) => {
  await Homey.flow.runFlowCardAction({
    uri: 'homey:manager:logic',
    id: 'http_advanced',
    args: {
      method: 'post',
      url: 'http://192.168.1.14/api/custom?name=trash',
      headers: 'Content-Type: application/json',
      body: `{
        "icon": "${icon}",
        "text": "${text}",
        "rainbow": ${rainbow},
        "duration": ${duration}
      }`,
    },
  });
};

// Check if today is a day for various trash pickups and create custom apps
const checkAndCreateTrashApps = async () => {
  const trashPickups = [
    { type: 'PAPIER', message: 'Papier', icon: 'papier' },
    { type: 'PMD', message: 'Plastic', icon: 'plastic' },
    { type: 'REST', message: 'Restafval', icon: 'rest' },
    { type: 'GFT', message: 'GFT', icon: 'groen' },
  ];

  for (const trash of trashPickups) {
    const { result: isTrashPickupDay } = await Homey.flow.runFlowCardCondition({
      uri: 'homey:app:com.trashchecker',
      id: 'days_to_collect',
      args: {
        when: 'today',
        trash_type: trash.type,
      },
    });

    const whatsappRecipient = '<Whatsapp recipient>'; // Replace with the actual recipient

    if (isTrashPickupDay) {
      await createCustomApp(trash.icon, trash.message, false, 10);

      const whatsappMessage = `Afval aan de weg zetten: ${trash.message}`;
      
      await Homey.flow.runFlowCardAction({
        uri: 'homey:device:<guid of whatsapp client app>',
        id: 'action_send_message',
        args: {
          recipient: whatsappRecipient,
          message: whatsappMessage,
        },
      });
    }
  }
};

// Execute the function to check and create trash apps
checkAndCreateTrashApps();

1 Like

I would like to set up the Ulanzi Pixelclock with Awtrix Light firmware connected to my Homey 2023. Am I right that you always need a Homey MQTT broker app and one of the following options:

  • Homey Awtrix Light app OR
  • Homey MQTT client app OR
  • use the standard Homey Logic app/functionality for POST commands.

What are the pros and cons of each of these options?

You can use just the Awtrix app and create custom apps and notifications with regular Homey flows.

The Ulanzi Pixelclock Easter sales price is now €33,60. Good price combined with the AWTrix 3 firmware and the Homey AWTrix app.
I’m not related to Ulanzi, but an enthusiastic user of the device.

2 Likes