Lametric customized content with URL via My Data (DIY) App

Hello OpenHAB community,

Not able to provide an URL with JSON payload to achieve a custom content on the Lametric TIME via the Lametric App My Data (DIY)
It is stated that this has to be done " 1. Expose your data to some URL available in the same local network with the device in predefined JSON format (more about that below)." But i couldn’t find any source where and how it was achieved with OpenHAB3 and maybe the HTTP binding in specific the configuration of the HTTP Thing.


  • OpenHABian 3 installation on RPi3
  • Lametric TIME in the same local network
  • HTTP binding installed

Creating a thing and maybe channel in the HTTP binding. But i already don’t know what to put for the “Basis-URL”. The IP of the Lametric or OpenHAB or something totally different?

And i would maybe use “sendHttpPostRequest” in a rule to POST a JSON payload to an URL.

rule "Update My Data DIY"
        Item PostHTTP received command ON
        val String URL = ""
        var String contenttype = "application/json"
        var String jsondata = '{"frames" : [ {"icon": "794","text": "Hello!"}]}'

        sendHttpPostRequest(URL, contenttype, jsondata)

But here i get the following error

2023-03-23 16:37:32.407 [INFO ] [core.model.script.Update My Data DIY] - {
            "message":"Authorization is required"

Thanks in advance.
Greets Simon

The http binding will not help you. It is used to do POST/GET requests to a http server.
The Lametric would like to access an URL to download the JSON response from that server.

I would try to solve that by using nginx.

Sorry, forgot to tell you to setup Lametric DIY App, you have to enter url: http://your_openhab_ip:8080/static/lametric.json
No HTTP binding needed, Lametric App will read json file exposed by rules


This is nice! Can you give an example how this kind of rule could look like?

Here it is

  1. My path naming seems to be different “\\openhab\etc” from yours “…/etc/openhab/”. Is this still the right path?
  2. I couldn’t add a JSON file there but only under “\\openHAB-userdata\etc” i created a folder “html” manually because it wasn’t there and added “lametric.json” file. The folder structure appeared shortly under the other path. The JSON file has the content:
  "frames" : [ 
      "icon": "794",
      "text": "Hello!"
  1. I put the URL “” in the My Data (DIY) App but nothing appears on the Lametric Time.

Is there some possibilty to check if the file is at least accessible like by putting the URL in the browser or similar? Because if i try that i get this:

I really want to understand and solve this! :thinking:

Looks like you access the folder via the samba share from a windows host ?
As long as you see directories items, things, rules and others next to html then you are in the right directory. Change into the html directory. In case you can’t write here you are not connected with correct user permissions.

This is the wrong directory. It is a different one ( /var/lib/openhab/etc vs. /etc/openhab/ ).
I think there is no html directory.

Are you able to login using ssh / putty as user openhabian ?
Then you should be able to move the file from folder /var/lib/openhab/etc to /etc/openhab/html.

Yes i use the access over the mounted network drive over windows.

As long as you see directories items, things, rules and others next to html then you are in the right

That was a good hint because the path then for me is: \\openHAB-conf\html
I just copied the “lametric.json” file with the content which i mentioned above to this folder and…

Yes it works. Now i’m able to push custom content to the Lametric Time. :star_struck:
Thanks to the forum and the help from you all!

Now i’ll have to dive in how to modify the file periodically with a rule. Hope i’ll will understand your rule in the near future :face_with_peeking_eye:

1 Like

Thanks. I could make the rule run. But I had to declare the variables. So it looks like this:

val clear         = "R0lGODlhCAAIAJEDAPHeAOjIAPrxAP///yH/C05FVFNDQVBFMi4wAwEAAAAh/wtYTVAgRGF0YVhNUDw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDcuMi1jMDAwIDc5LjU2NmViYzViNCwgMjAyMi8wNS8wOS0wODoyNTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo5N2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IK3GRhy+2sXkOmAAA7"
//other base64 icons

rule "LaMetriс"
when Time cron "*/15 * * * * ?" //run every 15 seconds
//some your code
var String iconBase64
iconBase64 = clear
var Number Power
Power = Sma_ActivePower.state

    executeCommandLine(Duration.ofSeconds(6), "/bin/sh", "-c",
    "(echo '
    \"frames\": [
            \"text\": \"" + Power + "\",
            \"icon\": \"34921" + "\"
	' > /etc/openhab/html/lametric.json) >/dev/null 2>&1; echo $?")

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