Lower Case am & pm for Sunrise and Sunset

Posted on
Tue Nov 21, 2023 9:17 pm
McIntoshBear offline
Posts: 29
Joined: Apr 26, 2019
Location: Massachusetts

Lower Case am & pm for Sunrise and Sunset

Hello,

I want to use a 12 hour clock rather that the default of a 24 hour clock for Sunrise & Sunset. I changed the default in the device settings "%H" (24 hour clock) to an "%I" (12 hour clock).

Is there a Python format to display "am" & "pm" (lowecase) in the Format for Sunrise/Sunset when configuring Clock Display?

%p displays "AM" & "PM".

%P displays "P"

I realize that the sunrise and sunset times are based on a US local standard used in Python. In my research I learned that the local time standard in Python for Germany (DE) is "am" & 'pm" (lowercase). I was trained as a graphic designer and lowercase letters are easier to read than uppercase.

I should note that I used the lower case option in Clock Display for the Time shown on the a portion of a Control Page. There is no lowercase option for Sunrise & Sunset.

Screen Shot 2023-11-21 at 10.01.47 PM.png
Control Page showing Date, Time, Sunrise & Sunset from Clock Display
Screen Shot 2023-11-21 at 10.01.47 PM.png (11.58 KiB) Viewed 1393 times


Screen Shot 2023-11-21 at 10.01.05 PM.png
Clock Display Configuration
Screen Shot 2023-11-21 at 10.01.05 PM.png (30.81 KiB) Viewed 1393 times


Thanks for your assistance.

Posted on
Wed Nov 22, 2023 4:47 pm
jltnol offline
Posts: 994
Joined: Oct 15, 2013

Re: Lower Case am & pm for Sunrise and Sunset

I am hardly an expert, but just commented on this exact plugin elsewhere, but I don't think there is an option for lower case AM/PM. I guess you COULD make this work by having a trigger for when the Clock Device AM/PM changes, and put the value into a variable, and then have a trigger for when the variable is changed to evaluate if it is AM and change it to am, and a 2nd trigger to do the same for PM. Of course, no doubt this could be done with a single trigger and some elementary Python.

Not the most most elegant solution, but it should work.

Posted on
Wed Nov 22, 2023 5:24 pm
jltnol offline
Posts: 994
Joined: Oct 15, 2013

Re: Lower Case am & pm for Sunrise and Sunset

OK so I take it all back.

You can use %P (as opposed to %p), and that should give you lower case am / pm.

Hope this helps.....

Posted on
Wed Nov 22, 2023 6:13 pm
McIntoshBear offline
Posts: 29
Joined: Apr 26, 2019
Location: Massachusetts

Re: Lower Case am & pm for Sunrise and Sunset

I edited the Clock Display Configuration and changed %p to %P with the following results.

Please note: From my testing %P results in a "P" being displayed not "am/pm" as desired.

Clock Display Configuration. Sunrise/Sunset configuration is the last line.

Screen Shot 2023-11-22 at 6.48.15 PM.png
Screen Shot 2023-11-22 at 6.48.15 PM.png (56.83 KiB) Viewed 1335 times


Device Details Custom States. Note: "P" after sunrise and sunset times.

Screen Shot 2023-11-22 at 6.49.22 PM.png
Device Details Custom States for Clock Display
Screen Shot 2023-11-22 at 6.49.22 PM.png (22.75 KiB) Viewed 1335 times


Portion of a Control Page showing "P" after Sunrise and Sunset times.

Screen Shot 2023-11-22 at 6.49.55 PM.png
Screen Shot 2023-11-22 at 6.49.55 PM.png (12.33 KiB) Viewed 1335 times

Posted on
Wed Nov 22, 2023 9:41 pm
jltnol offline
Posts: 994
Joined: Oct 15, 2013

Re: Lower Case am & pm for Sunrise and Sunset

Yeahhhhh so I got a bit ahead of myself on this one., and you are right... it only shows up as "p" not "pm", so you should check my fist post on how to get that to change via the variable and trigger proposition..

Posted on
Thu Nov 23, 2023 11:19 am
jltnol offline
Posts: 994
Joined: Oct 15, 2013

Re: Lower Case am & pm for Sunrise and Sunset

Ok so I need to start over on all of this. Apparently there IS a way to get a lowercase AM/PM from the Clock data onto a webpage. Note in the 1st pic the Custom 3L state, and what I have for the Custom 3 Configure Display. Somehow the 3 "L" makes it lower case. So it's possible to generate just the lowercase am/pm you are looking for. But not a way to do that for Sunrise and Sunset.. BUT, you can kind of 'fake' that by putting the Sunrise/Sunset field on a webpage first, and then add the custom L field basically on top of it. See Pic 2 for that. It'll take a bit of experimenting, but I was easily able to make it work., as you can see in Pic 3. So not sure why there is no Sunrise/Sunset "L" version, but still think this should be easy put together. Good Luck!
Attachments
1.png
1.png (412.76 KiB) Viewed 1260 times
2.png
2.png (150.2 KiB) Viewed 1260 times
3.png
3.png (29.62 KiB) Viewed 1260 times

Posted on
Tue Nov 28, 2023 11:19 am
McIntoshBear offline
Posts: 29
Joined: Apr 26, 2019
Location: Massachusetts

Re: Lower Case am & pm for Sunrise and Sunset

Thank you for exploring the possibilities. I would not have thought of doing it that way.

Thanks again.

Sorry for the delay in responding. The holiday made a dent in the plans.

Posted on
Tue Nov 28, 2023 4:52 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Lower Case am & pm for Sunrise and Sunset

I've just pushed v3.0.17 to the plugin store.

This adds two more states SunriseL and SunsetL which are lower-case versions of these states, the same as the Custom3L etc shown above.

Peter

Posted on
Wed Nov 29, 2023 10:13 pm
jltnol offline
Posts: 994
Joined: Oct 15, 2013

Re: Lower Case am & pm for Sunrise and Sunset

Excellent! Problem solved much more neatly than my messy suggestion.....THANKS

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests

cron