I am getting more and more frustrated using Openhab - Need some basic understandings

Hi@all,

I am migrating from Pimatic to Openhab because the project is discontinued. No more bindings etc. So I decided migrating to Openhab as I liked the structure with things and Items.
I the past, everything I needed to configure like perhaps exec a command like curl or dealing with rules was very easy and did not take much time. Since I use Openhab I find myself struggling with all of my goals and every approach to reach a goal is time consuming and end up in googling for hours. Most of my rules now need a script and I am not a programmer. Today I tried for more than 5 hours so set up a basic exec command which took just 2 minutes in Pimatic. I am ending up in errors and as I look in the logs I see the need to put that command in a white list first.
An exception occurred while formatting the command line ‘curl -s http://192.168.182.135/json-rpc?request={“command”:“adjustment”,“adjustment”:{“classic_config”:false,“brightness”:5}}’ with the current time ‘Sat Mar 01 18:39:01 CET 2025’ and input value ‘null’: Conversion = ‘2’

My question now is. Why is everything so difficult and why is the rule set so minimal, that everything needs programming skills. Is Openhab only for someone who is a programmer?
Should I better go with HomeAssistant?

Another example: One device needs the number 0258777 to do something. I craeated a rule to send a mqtt command when a thing was updatet to this number but it didnt work like in Pimatic. Then after trying for an hour I removed the 0 from that number and the rule began to work.


Hopefully someone else will jump in that is more knowledgeable, but here goes. I am not much of a programmer and have never used curl or the exec binding. I would also need to know more about your devices to give specific advice. However, I sense you are used to operating at a lower level than required for OH. I’m sure it is possible, but not necessary. From the docs, the key concept is that the “item” is the primary control. The “item” changes are linked to the device (thing) via a channel.

To your example, the device that needs 258777 could be a generic MQTT thing. First add the MQTT binding, set up the MQTT broker, then create a generic MQTT thing, then add a channel to it with the desired MQTT topic, then link that channel to a number item. Then add a standalone widget with your range of number commands.

Here is a thermostat example (I tried to fit it all in a couple of pictures)


Note the channel is an MQTT topic.

No rule required, although I have rules that trigger a setpoint change based on a cron.

Your other thing looks like a dimmer. Same story MQTT channel

Hope that helps a bit.

It seems, you did not read any of the available docs, but used google instead.
Please start with reading the openHAB beginners guide from our docs.

The rule set is not minimal but really flexible. If you don‘t want to deal with scripts or write code yourself, try using Blockly for creating your rules.

Without knowing anything about the device, ist is difficult to say, why that was needed.

Overall, instead of googling for answers, ask your questions here, within individual topics, and you will get help.

3 Likes

I am actually wondering why you even use the exec command? I have more than a hundred devices and >400 items and never had to use the exec command nor curl.

Do you mind telling what devices you have and how you control them? Depending on that, we can guide you into the right and simplest direction to get started.

Usually I avoid MQTT not because of openHAB but because I found it too complicated or inconvenient (but I know a lot of people who love it and it is very well supported).

openHAB is even able to detect your devices on the network automatically


How did you install openHAB? The simplest way is to use a Raspbi, image an SD-card and the initial setup works by itself and finally there is a wizard that guides you through the initial setup.

As far as Rule-writing is concerned, you can even create simple rules in seconds with Blockly where you don’t need any program language skills at all.

Don’t be frustrated, let’s go step by step


MQTT is not a problem. I am familar with MQTT. I set the rule like “when item xyz is updated to 0258777 then do something”. The Item is updated to 0258777 but the rule is not trigged. When I set the rule like “when item xyz was updated to 258777 then do something” then the rule triggers although the item is updated to 0258777. That makes no sense to me.

Please show us your Item config.

The rule has different options to trigger:

  • updated: it is triggered even if it is updated to the same value
  • changed: the rule only triggers when the value is changed. This is probably what you are looking for.

Also show the logs if you see that your item has indeed changed. I am 100% sure if the item changes and you configure it as above the rule will trigger.

It kind of makes sense to me if the item is a number. Who writes numbers with a leading 0?. you could try a string item and my guess it would work.

Hi Stefan,

most of my devices are tasmota based plugs or relays. I do not know a way to control them without MQTT. Additional I have some Hyperhdr server for ambilight, which can be controlled by http only. So I need a curl command to control them. I tried the HTTP Thing but I am not able to get it work. Also I cannot get the Exec Thing to work.

Use the blockly http block: this is much easier:

It should give you all options you need.

Would you be so kind to tell me how to confige this for my desired command “curl -s http://192.168.182.135/json-rpc?request={“command”:“adjustment”,“adjustment”:{“classic_config”:false,“brightness”:5}}” because I have no clue and I dont understand the http protocol. I dont understand the HTTP Thing either. So I am not able to get this to work.

It is a HTTP GET call. The -s option isn’t important for our call. It only suppresses some parts in the response when using curl.

Everything behind the ? is perceived as a parameter (if you have more than one you need to add a & inbetween). It is constructed by key / value pairs. In your case:

key: request
value: {“command”:“adjustment”,“adjustment”:{“classic_config”:false,“brightness”:5}}]

You don’t even need any http thing or binding. Just use this block!

So, I would assume, you end up with this simple block:

Please read the comprehensive blockly documentation on how to create that rule and add this block.

And of course, you need to have an item of type dimmer (here called slider1) from which you want to retrieve the brightness. Unfortunately that leads to something which is a bit more complicated because you need to retrieve the brightness from that item.

  • Create a string that concatenates
    • the first part of the string
    • with the brightness value
    • and the ending of that string

then send that string as the value for the param “request”

And do me a favor: don’t blame openHAB to be complicated when you are using low level hardware - openHAB is known to provide many ways to get almost any hardware connected. Using standard home automation hardware doesn’t require you to know things like http request but if you have them, expect that you need to understand a bit to actually address that. As you can see, even in this case, with a bit of knowledge on openHAB (like every software) it is actually pretty simple and there are lots of tutorials in the docs and the forum about this.

Hope the above helps.

Why cant I use a simple exec command which would do the job? No need for complicated Blockly or whatever. To execute this curl command is done in one minute in Pimatic. No need to google or write in communities. Everything is so time consuming in Openhab.
And I have no need for a slider. I need two commands for setting the brightness for exactly two values I need. So why implement a useless slider for that?

Can someone explain how to do this with the Exec Binding. I do not want to use Blockly. I want to use a simple Exec command. But with the Exex Binding Openhab complaints about whitelists and throws errors about transformation problems. I give up.

Reading the docs should help:

Here it is explained why and how to configure the whitelist.

As an also newbie, yes, this product is powerful. But it’s bloated af. It is not “plug’n’play”. Unfortunately, the documention is also bloated AF and leads you down roads you don’t need/want to. Best thing to do is follow it, and at the end, you’ll be able to delete a bunch of shtuff you don’t need or want.

What to include at the start is a subject of much debate. If you wish to contribute a opinion of what could be trimmed from an initial install of OH, then that could be helpful information, but it would be much better to start a separate topic about that as it is only tangentially related to this topic.

2 Likes

I’d suggest to hold on for a minute or two.
You must not expect OH (or any other serious home automation system) to be a drop-in replacement for whatever home automation control system you have been using so far.
Switching your controller over is a complex task, and you should not be starting that journey by using Google, hacking around on the low layers, trying to replicate bits of what you know from your old system and then to try to work your way up.
That is not a good idea and will only result in more frustration and more wasted time.
Better stop and restart by systematically and comprehensively reading the docs first, and don’t skip the Getting Started tutorial.
Yes, even if you think you are an expert in home automation and all of this stuff.
Particularly so when you think you are.

After that figure out the best way in OH of connecting your devices.
Tasmota is a hack in itself. What are those devices of yours, DIY electronics? Almost any other tasmota device I know of used to be some commercial product like a Shelly, Wemo or TP-Link device that some enthusiast reflashed because he did not possess the software that can natively control it. But openHAB (usually) can. It has a Shelly binding and a Wemo binding and a tplink binding and some more so it can. So the very first thing to check should be if you can use the original firmware with the respective OH binding rather than a genuine binding like MQTT and HTTP.
Assuming it’s really all-DIY and there really is no better option than MQTT or HTTP, then to just google and start using exec to start curl to do HTTP because “exec binding” was the first Google hit and you know curl and that worked for you in some other time and space with some totally different system doesn’t mean it is a good idea to attempt that in openHAB.
I’d rather call that an abuse. Better spend the patience it takes to figure out how to get the HTTP binding to work. The documentation and examples you need for that are all here:

I recall there’s also some lengthy thread on this forum dealing with the HTTP 2 binding, it has several more examples and explanations. Use the forum search function.

5 Likes

My tip: stay with Pimatic or whatever.
People want help but constantly stress that some other system is better. This is an all volunteer project. We’re proud about what can be achieved with openhab. If it’s not for you: Fine. Try something else but close the door quietly

5 Likes

The http binding docs probably needs some more examples. It isn’t super easy to understand when you’re new to openhab. After some trial and error, I could get it to work.

The equivalent for this:
curl -s http://192.168.182.135/json-rpc?request={"command":"adjustment","adjustment":{"classic_config":false,"brightness":5}}

Create a mythings.things file inside conf/things/ folder

Thing http:url:foo "Foo" [baseURL="http://192.168.182.135/json-rpc", refresh=0] {
        Channels:
            Type dimmer : brightness [ commandExtension="?request={\"command\":\"adjustment\",\"adjustment\":{\"classic_config\":false,\"brightness\":%2$s}}" ]
}

Create a myitems.items file inside conf/items/ folder

Dimmer MyBrightness { channel="http:url:foo:brightness" }

Now try sending a command to MyBrightness and see if that works.

You can do this by creating Things / Items in the UI too, but that would require several screenshots.

You can execute curl if you wish, although it isn’t the best / most efficient way, but I understand that it’s the easiest and most familiar to you.

To execute a curl command, you can either use the Exec binding, but if you did that, you might as well use the HTTP Binding.

Alternatively you can execute a command using a script. You can choose RulesDSL but you might find it weird. The easiest way to execute a command that I know of, is to use JRubyscripting addon. So you’d need to install this addon first, then in your rule, create a Ruby inline script

Your JRuby script could then contain this:

`curl -s http://192.168.182.135/json-rpc?request={"command":"adjustment","adjustment":{"classic_config":false,"brightness":5}}`

In other words, just enclose your command with backticks.

This of course assumes that curl command exists on the system. You might need to use the full path.

To see the output of that curl command, to aid debugging, add logger.info in front of that backtick. Then you can view the log in the Karaf console, or inside userdata/logs/openhab.log file. I think the latest version of openhab also includes a log viewer, although this particular feature is very new and it isn’t very mature/polished yet, but it is usable.

You can vary that brightness value, but you’ll need to tell me where the value comes from before I can provide further examples.

2 Likes

Hi so as you can see from reading all the replies there are at least 3 or more different ways you could solution your action.
That is the beauty of OpenHAB. It is a very feature rich application and offers you complete control to customize things to work pretty much any way you want them to. However, you do have to invest some time understanding how the application works. It is not always as simple as copying something you used in previous applications into openHAB and having it “just work” Your first post asked about 2 different solutions, and you were offered multiple ways to accomplish them. Does openHAB have a learning curve? Yes, but once you have invested the time to review the documentation and spent some real time trying to understand how the application works you will quickly find a approach that you will be most comfortable with.
My advice instead of saying it is to complex and giving up try to actually read some of the documentation. If you have a hard time with updating a simple text file that is used as a whitelist then perhaps you need to spend some time understanding what ever OS you are using to accomplish that.
The point is as many folks above have stated the path you are trying to take here will work but it is not the easiest one that you could use out of the many options available.
However, all of the approaches still require you to read and consume the documentation for that specific method of doing what you want.

1 Like