Hi all,
maybe there is already a solution in place but I did not find it through googling or in the forum.
And maybe someone is looking for a quite similar solution to be able to update the state of items manually, why I want to share the below. I’m happy for any comments or further ideas/ thoughts to improve.
Reason behind I did this: I use Items for monitoring purposes (like my Gas or Electricity Meters) and afterwards to visualize in Grafana. Sometimes I need to adjust the value manually due to several reasons (ESP or OpenHAB offline (during updates/ configuration puporses etc.).
What I did to reach my goal:
-
set up a WebServer like Apache including php (e.g. on a different machine or if you’re experienced to install on your OpenHAB-machine and use a different port). Maybe the php support for CometVisu is doing the trick as well? I did not test because I’m already running Apache with php on a different machine.
-
amend the attached php-file to your installation and upload to your webserver:
adjustitem.php.txt (4.0 KB) (remove the “.txt”-Extension before uploading on your webserver).
a) change the Openhab-URL ($ohurl) to your installation
b) change “ITEM1” to the Item-Name respective -Label (in ITEM1-Label). You can reduce or extent as you wish as shown below.
$ohurl = "http://<OPENHAB-IP:PORT>/rest/items/";
function ItemList()
{
?>
<select name="item" id="item">
<option class="text" value="">---</option>
<option class="text" value="<ITEM1>"><ITEM1-Label></option>
<option class="text" value="<ITEM2>"><ITEM2-Label></option>
<option class="text" value="<ITEM3>"><ITEM3-Label></option>
<option class="text" value="<ITEM4>"><ITEM4-Label></option>
<option class="text" value="<ITEM5>"><ITEM5-Label></option>
</select>
- Create/ amend your Sitemap to include the webview as shown below; change IP and Path to meet your configuration.
Webview icon=none url="http://<WEBSERVER-IP>/<PATH>/adjustitem.php" height=3
I created the php-page very minimalistic in purpose not to need too much space.
I know this is only a small one and maybe there are better aproaches (and definitely this one can be extended massively if needed), but I always tried to find a small and easy solution for this need. Now as I took the time (and not being much experienced neither in php or curl), I’m quite happy with the result.
Maybe it’ll help someone of you guys.
Cheers,
Matze.