Inventory number of items, things, rules

How many items do you have, how many lines of code, how many…?

This to have a kind of view on my openHAB installation.

  • Example:

In the future I want to add

  • Number of different binding.
  • Finetune my script a bit so empty rules, and comments, are not taken into account. Important for exact numer of items

How I did this?

  1. Small script for each calcuations.
    This is just an example for the numer of items lines.

    cat /etc/openhab2/scripts/

    localHeader="Accept: application/json" 
    NumberItems=$(curl -s -X GET --header ${localHeader} ${localUrl}/items?recursive=false | python -m json.tool | grep name | wc -l)
    echo $NumberItems
  2. Then I’m using the command REGEX in Things:

  3. For my items

    String	numberItems	"Number of Items [%s]"		 {channel="exec:command:numberItems:output"}
  4. And in the sitemap

    Text item=numberItems

Suggestions or comments are more then welcome!

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.