Using Blynk Time Input Widget for Display

Hi Blynkers.

I use the Time Input Widget for time range input to my Blynk apps and love it.
I recently added Sunrise and Sunset capabilities using Time Input Widgets for inputs and Automations to tell me when sunrise and sunset are each day. Thanks.

I also use the Time Input Widget as a Display. Here’s my generic code

Blynk.virtualWrite  ( TIME_WIDGET_DISPLAY_VPIN, // DISPLAY Time Input widgets
                      startTime, stopTime,      // in minutes
                      tzone,                    // const char tzone[] = "AmericaNew_York";
                      dayChar[convertedDayOfWeek] ); // char "1" to "7" M to Su

This works well. But now that I am ALSO accepting Sunrise and Sunset from Time Input Widget INPUTS, I’d love to display “sunrise” or “sunset” in the Time Input Widget I use for time range DISPLAY.

Possible?
Thanks.

Have you considered using a sunrise/sunset library for this, or an API call to a weather service that provides this information?

The library would require latitude and longitude to give you the details. A weather API usually needs a location such as the name of a town.

If you made the move over to the dark side and started using Node-Red then there are a multitude of plug-ins that can provide that information.

Pete.

Hah! I haven’t ventured to the Node Red dark side, yet. I’m still all-Blynk-all-the time.

I opted for Blynk’s excellent Automations to signal me each day with the day’s sunrise and sunset times.That works and is very easy. (BLYNK_WRITE at Sunrise has param[0] = 255. At sunset BLYNK_WRITE has param[0] = 0.) I looked at sunrise/sunset libraries which seemed straightforward enough, thought I’d try a Blynk Automations instead. (Blynk signals me 30 minutes before sunrise and again 30 minutes before sunset each day. I note the time and use it in my sketch.)

My query to the Community is on using the Time Input Widget for display. It works fine with the Blynk.virtualWrite call I showed, above. I’ve tried several options for the start-time and stop-time values, but haven’t been able to get the Time Input Widget to DISPLAY anything except a time in HH:MM format. It works perfectly well, but if the User selected “Sunrise” for example (using a different Time Input widget), I’d love to be able to show “Sunrise” as the selected time in the Time Input widget I use for DISPLAY.

All thoughts welcome.

I think the issue with automations is that it simply sends an on/off high/low signal when the sunrise/set event occurs.
Clearly the server knows when sunrise/set is (presumably at the sever location) but that data isn’t available as a “sunrise is in x minutes” value.
Hence the need to use a library to give you those times for your location, so that you can do the math on how much time is remaining until the next event occurs.

Pete.

So I have a scheduling app that ‘schedules’ a fleet of SONOFFs and Shellys. The Scheduler app manages three different (user-specified) schedules and any of the SONOFFs or Shellys can be included in any of the three schedules.

Now that I have enabled sunrise and sunset as start or stop times, I have more flexibility than with only time of day. I’ve set up two Blynk Automations to signal me 30 minutes before sunrise and 30 minutes before sunset each day, plenty of time to calculate the actual sunrise and sunset and include them in my scheduling. Coding was very simple using BLYNK_WRITE to receive the Blynk Automation signals. The Blynk sunrise and sunset automations use your location for accuracy. I’m sure an Arduino library would have also done the trick, but I was delighted at how easy and accurate (enough) the Blynk sunrise and sunset Automations are for my application.

I’m still trying to see how flexible the Blynk Time Input widget is for displaying time start and stop info, though. It Would Be Nice (IWBN) to be able to display “sunrise” and “sunset” as well as the HH:MM displays they offer today.

So should this be an “Ideas” category of topic rather than a “Need help…” ?

Pete.

Done!

Still trying to use Time Input widgets to DISPLAY sunrise or sunset instead of HH:MM. All help welcome.

I use open weather API to display sunrise sunset, and other informations