Facility management tool

Hello,

I have an app im using today to manage my property and other things.
This is bases on facility managment, but a nice app to have.
What i would like to do, it to make in inside of Openhab so i have one app one tool, but cant see how to make this.

What i want it to do.
I want to have some task that repate every 4 weeks.
Lets say i have a heatpumpe i controlling, i want also to have a checklist that comes up every 4 weeks - “Check heatpumpe” and when i “check” it out, it should be stored, also with some notes and then add a new task again in 4 weeks.

Is this even possible? Any ide? Today i use ticktick inside of Openhab just as a link, but can not open it in the app, just in browser.

The tl;dr is you might be able to do something like this using HABPanel and some custom back end work. OH is a home automation tool, not an industrial automation tool so it lacks a lot of features you need, most importantly the ability to enter text.

Do you really mean every four weeks or, for example, the fourth Sunday of the month?

Assuming you mean every four weeks the easiest thing would be to:

rule "Every four week task"
when
    Time cron "0 0 0 * * 0"
then
    if(now.weekOfYear % 4 == 0) {
        // do every four week stuff
    }
end

The above rule executes at midnight every Sunday. If the week of the year is evenly divisible by 4 the rule executes stuff. Otherwise, it exits having done nothing. If you can shift the weeks around through some addition. For example, if you want to start your every for weeks from the first week in January you would use

if((now.weekOfYear + 1) % 4 == 0)

If you mean something like the last Sunday of the month it is even easier.

rule "Every four week task"
when
    Time cron "0 0 0 * * 0L"
then
    // do every four week stuff
end

The above cron trigger will only execute the Rule on the last Sunday of the month.

OK, this is a little bit different from above. You want 28 days after a given event independent of the calendar. We can do this too. However, it is not as straight forward is it should be. OH currently lacks a scheduler like this so we have to work around this lack in a round about way.

Switch Heatpump_Checked "Heat Pump Checked"
DateTime Heatpump_NextCheck
Switch Heatpump_ShowChecklist
var Timer heatpumpTimer = null

rule "Heatpump checked"
when
    Item Heatpump_Checked received command ON
then
    Heatpump_NextCheck.postUpdate = now.plusDays(28).withTimeAtStartOfDay.plusHours(7) // 7am four weeks from 
 now
    Heatpump_ShowChecklist.sendCommand(OFF)
end

rule "Create Heatpump timer"
when
    Item Heatpump_NextCheck changed or
    System started // timers get lost when OH restarts or .rules files change
then
    heatpumpTimer?.cancel // cancel an existing timer if one exists

    heatpumpTimer = createTimer(new DateTime((Heatpump_NextCheck.state as DateTimeType).calendar.timeInMillis, [ |
        Heatpump_ShowChecklist.sendCommand(ON)
    ])
end

rule "Show Checklist"
when
    Item Heatpump_ShowChecklist received command ON or
    System started
then
    // send alerts
end

In the above rules when the Heatpump_Checked Item receives a command it sets the Heatpump_NextCheck to 28 days in the future. The Create Heatpump timer rule creates a Timer based on the state of NextCheck. The Show Checklist Rule is just a placeholder where you have OH send you alerts when the 28 days are up.

The hard part is the “show checklist” part and the “with some notes” part is impossible at this time, though something might be possible using a custom widget in HABPanel. The big question though is once the notes are entered, where should they go? How do you plan on looking at them later?

I’m not 100% on HABPanel so I don’t know how or if you can conditionally show certain widgets based on the state of an Item (the ShoiwChecklist Item). But the over all concept would be that when the ShowChecklist Item is ON the checklist widget gets presented. In the sitemap that would be handled using the visibility tag on a Webview element. The big problem though is handling those notes. There is nothing in OH that will let you enter, retrieve and review the notes so you would have to build something for that that shows up in your webview which probably puts you right back in the same situation.

OTOH I’d be inclined to use something like Google Calendar for most of it. You can add notes and reminders to your recurring events, and openHAB can trigger events based on it

Thank you both for your answers.
Rick, i see your point, it can be possible but not optimal, i also struggle with the “database approce”.
Ben, yes, thats almost the way i do it now, only TickTick is better, but it would indeed take Openhab to a new dimension with not only controllin your house, but also maintance it. All in one app, and that does not excist today :slight_smile:

I have a slightly different approach. This works with dynamic groups

  1. Define an empty group
Group:Switch:AND(ON,OFF) gTodo_List
  1. Define a virtual Switch for every todo
Switch Todo1 "Todo 1"
Switch Todo2 "Todo 2"
  1. Define one or more rules which fill the todo-list (this example just fills the list every minute)
rule "fill Todo"
when 
	Time cron "0 * * * * ?"
then	
	Todo1.postUpdate(OFF)
	gTodo_List.addMember(Todo1)
	Todo2.postUpdate(OFF)
	gTodo_List.addMember(Todo2)
end
  1. create a rule for each todo, which removes the todo from the group
rule "remove Todo1"
when 
	Item Todo1 changed to ON
then
	gTodo_List.removeMember(Todo1)
end
rule "remove Todo2"
when 
	Item Todo2 changed to ON
then
	gTodo_List.removeMember(Todo2)
end
  1. add the group to the sitemap
sitemap Home label="Todo list" {
    Frame {
		Group item=gTodo_List
    }
}

Hope this helps.

With my example you can use google calendar to fill the todo list, you just need to trigger on the calendar instead of the time. You also can mix the triggers as you like.

I ended up with a simple solution.
Its a webview item=Test url"https://ticktick.com/pub/project/collaboration/invite/89a28ec9534f4b508bf06a53fe3d54ee?u=bd5c90663ad143028b04b8025c3d6f58"

Only problem is that in the openhab app, this does not work. It works in habpanel and in basic view on browser on phone. Anybody knows why the app “blocks” this link?

Webviews often do not work well on the phone apps.