A todo list / check list approach within openHAB

This is a simple approach to create a todo list / check list within openhab. Although this is just a copy/paste from another topic, i think this shouldn’t be buried in that topic. Maybe this helps someone.

  1. Define an empty group and a group which contaisn all todos.
Group:Switch:AND(ON,OFF) gTodo_List
Group gAllTodos
  1. Define a virtual Switch for every todo
Switch Todo1 "Todo 1" (gAllTodos)
Switch Todo2 "Todo 2" (gAllTodos)
  1. Define one or more rules which fill the todo-list (this example just fills the list every minute, you can use multiple rules / triggers, just as you like and need.
rule "fill Todo"
when 
	Time cron "0 * * * * ?"
then	
for (item : gAllTodos.members)
{
	item.postUpdate(OFF)
	gTodo_List.addMember(item)
}
end
  1. Create a single rule, which removes a todo from the group. If you need to do something special, you can do it here as well. If you need something special, you can create additional rules.
rule "remove Todo"
when 
	Member of gAllTodos changed from OFF to ON	
then
      	Thread::sleep(300)
	gTodo_List.removeMember(triggeringItem)
end
  1. Add the group to the sitemap
sitemap Home label="Todo list" {
    Frame {
		Group item=gTodo_List
    }
}
1 Like

I like this but where does all this go? Is it one file, 3 files? What folder? ~/openhab/conf?

Thanks for the info!

yes.

1.+2. in one or more *.items file in the items folder
3.+4. in one or more *.rules file in the rules folder
5. in a *.sitemap file in the sitemaps folder

Cool! I’ll go look…

I just checked, the android app works fine. (i did just test this at first.)

Using the browser (chrome in my case), needs an adjustment: A small delay before removing the item from the group. Edited the original post.

Very Interesting,
Could a text file be read to create or enable the todo items, and therefore the labels be used from the text file,as I thing the ToDo system must be hardcoded ?

Could the data be read out of a REST API?
Did you find an answer to your question?

With the current possibilities “Member of” and “triggeringItem” this can be extremely simplified.

You can easily generate the *.items from something else.

Since it is still of interest, i will update the stuff today.

any updates?

Sorry, was busy with other stuff. I will update tomorrow hopefully.

I updated the first post with the features, “triggeringItem” & “Member of”.

You can now easily generate the items file in 2. The logic is now generic so the only thing which needs to be generated is the items file.

1 Like