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?
-
Small script for each calcuations.
This is just an example for the numer of items lines.cat /etc/openhab2/scripts/numberItems.sh
#!/bin/sh localUrl=http://localhost:8080/rest 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 exit
-
Then I’m using the command REGEX in Things:
-
For my items
String numberItems "Number of Items [%s]" {channel="exec:command:numberItems:output"}
-
And in the sitemap
Text item=numberItems
Suggestions or comments are more then welcome!