I would like to insert in HABPanel an indication on the daily separate collection.
Where I live we have days when we collect plastic, glass, paper, etc.
They provided us with a calendar, I would like to remove the leaflet from the fridge and make it become inforamtic.
With openHab I’m doing nice things, but frankly I have no idea how to get started.
I would like to insert a dummy widget that takes the name and color based on the day.
For example:
Monday: Organic garbage, Brown
Tuesday: Glass, Green
Wednesday Organic Junk, Brown
Thursday: Paper, Blue
etc …
Working with transformations, could I do it or should I write a JSON custom widget?
Hi,
I personally don’t use Habpanel but I’ve made what you are trying to do in the Basic UI.
Maybe you can use it also in HabPanel creating your own icon/images.
Surely there is a better way, but here’s what I did:
I created a string item named TextRecycling with a custom category named recycling, then I created a rule updating that item with the number of the current day of the week every time LocalTime_Date (item from NTP binding) changes.
Here’s the rule :
rule "Update Recycling"
when
Item LocalTime_Date changed
then
TextRecycling.postUpdate(now.getDayOfWeek)
end
I have a recycling.map file that transforms the number in the correct string of what is due on that day…here’s my map file:
1=Plastic and Organic
2=Misc junk
3=Paper
4=Glass and Organic
5=Nothing to trash
6=Nothing to trash
7=Nothing to trash
-=Not inizialized
Then I crafted 8 svg images to match the day so that the TextRecycling item changes its icon dynamically:
You can then show the item in HabPanel with the icon/images you created.
I’m attaching a sample of my icons (sorry the text is in italian) but you can create your own.
I have not finished this pannel yet but I will do it with a very simple trick:
in /static I put 5 png for all days and in items I create a single string variable will hold url of the curent days trash type. With a rule similar to above I will change the reference to the image in variable
The panel is a simple template widget that does display an image of held at that moment in the variable
Will post all the code when done. for now I’m crafting the icons
I have a simmilar problem, but we dont have fixed days every week.
Its more like
Week1, Wednsday general waste,
Week2, nothing
Week3, Thuesday recycling, wednesday paper
Week 4, nothing
week 5, like week1…
In addition there are sometimes movements +/- one day due to public holidays in a week.
So was thinking that maybe I need to create a special Google Calendar for this?
Or are there other ideas how to achieve this?
Wow. You are quite messed up with recycling! Probably unlike us you have bigger baskets. Here, the plastic should be thrown once a week and we have a 50cm wide and 1mt high bust that fills up to burst!
Indeed, being a non-linear management, I would work with Google Calendar.
I would create a text item and with google calendar I would send the text using the event schedule.
I would then associate custom icons using the text sent.
@maddmax1976 : I’m attaching all my svg, you can easily change or delete the text with a software like inkscape or divide the double ones.
@HolgerL: It’s really a mess! the only other thing I can think of is that you create 3 different string item with day of the week, month, and week of the month, and than you can prepare a long and complex “if” statement…but it’s really hard to mantain…maybe sticking to Google Calendar is the best choice .
So my schedule is weekly and the rule to launch it looks the folowing:
rule "Trash icon update"
when
Time cron "0 0 11 * * ?"
then
logDebug("OTHER", "cron timed trash icon update")
val day_of_week = now.getDayOfWeek
switch day_of_week.toString {
case "1" : {postUpdate(trash_icon_url2,"http://172.16.10.4:8080/static/norecyclable.png")}
case "2" : {postUpdate(trash_icon_url2,"http://172.16.10.4:8080/static/carta.png")}
case "3" : {postUpdate(trash_icon_url2,"http://172.16.10.4:8080/static/organico.png")}
case "4" : {postUpdate(trash_icon_url2,"http://172.16.10.4:8080/static/carta.png")}
case "5" : {postUpdate(trash_icon_url2,"http://172.16.10.4:8080/static/plastic.png")}
case "6" : {postUpdate(trash_icon_url2,"http://172.16.10.4:8080/static/blank.png")}
case "7" : {postUpdate(trash_icon_url2,"http://172.16.10.4:8080/static/blank.png")}
}
logDebug("OTHER", "trash current url: " + trash_icon_url2)
end
and then the template widget in a panel is as simple as :