Help, I'm ready to give up

I’m on my phone so can’t do a lengthy reply. All I will add is the developer’s an maintainers ate aware of the problems with rules and nonprogrammer users. Frankly a lot of programmers hate it as well given they are written in a customized version of an obscure language.

The entire reason there is an OH 2.0 instead of a 1.9 is to address some internal architectural changes necessary to get to a state where monkeying Aarons in a bunch of text files is no line needed.

We are not there yet. We are a long way from there. But that is the goal. All the work that went into PaperUI, Habpanel, the introduction of Things and Channels, and the Experimental rules engine are all steps towards that direction. Hell, even Habmin has a way to build rules using a Scratch like environment.

Finally, some users are very happily using Node Red with openHAB.

I’m confused. If i add the z-wave multisensor from monoprice do i have to have a hub or does openhab operate as the hub?

You need to provide a Z-Wave stick to your openHAB server

To elaborate, you need a zwave controller which is a USB device that you plug into your OH server. With that then OH acts as the hub. The docs for the zwave binding list some dongles known to work. The Gen5 Aeon Controller seems to be the most popular around here.

You might also want to look into the z-way binding which is an alternative way to work with zwave in OH. It requires purchasing a controller with a specific license though. Again, see the docs.

Finally, some people, either because the existing bindings do not yet support a needed command class (e.g. SECURITY to include door locks) or because they are transitioning off of a commercial system like Vera, leave their zwave devices connected to one of these external hubs and interact with then using the hub’s API.

1 Like

If you define parameters in a .cfg file, but later change the key or comment out the key (to the left of the = sign), the old key and value remains in the configuration stored in the server. This can wreak havoc and lead to many otherwise inexplicable problems. Users expect, quite reasonably, that the old key no longer mentioned in the .cfg file disappears from the configuration, but it doesn’t. This is particularly irksome when you use a 1.x binding like MQTT or the Weather binding that allows dynamically named keys, like myhouse.url=…

Thanks a lot, you just saved my night!!

Being a seasoned programmer myself (mainly C/C++ on embedded devices) my main problem with obenHAB is the complexity of the architecture. I once tried to implement a bindig myself, but having no Java/OSGI/Eclipse experience and the notorious lack of time just in resulted in not being able to get started in reasonable time.

Main issue with openHAB is the lack of “forgiveness” of the rule language regarding undefined elements and type casting. I have quite a few rules where are more testings if a value is undefined and typecasts than actual code.

But having said that, openHAB is a great project I like a lot. Coming from MisterHouse and having tried some other home automation projects, it is by far the best I now!

There are ways to deal with this sort of thing:

  1. Use Designer to catch syntax errors for you
  2. Use persistence with restoreOnStartup to avoid the NULLs
  3. Make use of the ? operator for a quick test for null
if(timers.get("foo") != null) timers.get("foo").cancel

can be replaced with

timers.get("foo")?.cancel
  1. Make use of Groups
  2. be aware that OH 2 is a lot better at handling casts for your so you rarely need to do something like if(MyItem.state as DecimalType > 20) any longer.

With the above I find I have no more tests than I do in any other not strongly typed language such as Python or JavaScript.

2 Likes

@rlkoshak

Thanks for your explanations! I already used persistence and this really helped a lot, but I had to implement a delay in some rules to allow for restoring the items. The ? operator is nice, I did not know it! And I will surly test automatic casting in openHAB2!!

Regarding the cache: What would I use if I cleared the cache on every startup ( I am only using textual configuration)?

I don’t understand the question. You can use a script to clear it out on every restart but be aware that all the bindings will reinstall so startup might take a lot longer. You need to define your addons in addons.cfg as well.

Thanks, that answers my question. I just was not sure, what side effects deleting the cache might have. I do not mind, when starting takes longer. My openHAB 1 Installation is nearly never restarted, so that does not matter.

The designer is unfortunately no help for OH2. Not even the ESH and OH methods (logDebug, postUpdate, …) are available and one can’t integrate any actions (sendTelegram, …). For example my security.rules has 55 lines of source code without blank lines. 33 of these are marked as defective.

Which version are you using? You should be using Eclipse SmartHome Designer version 0.8 at this point. When you go to the official download page: https://github.com/eclipse/smarthome/blob/master/docs/documentation/community/downloads.md#designer-builds

that is the version made available.

Version 0.9 which was there for awhile has an issue that pretty much breaks its ability to recognize pretty much everything.

openHAB Designer only works with 1.8.

It is true that and separately installed actions are not recognized yet even with the 0.8 version. But that should only amount to a handful of lines marked as errors and in these cases it will be obvious that it is not a real problem.

Because OH’s errors are not all that helpful in identifying syntax errors having the ability to have something syntax check Rules (and sitemaps and items) for you will save tons of time.

The issue to fix what broke 0.9 is actively being worked and long term there is work to create a web based replacement for Designer.

1 Like

gnarf I tried the 0.9 version several times, because of:

I never noticed that warning. Until the major issue gets fixed that line should be removed.

Hey, sooooo

  1. that line is my doing :see_no_evil: sorry guys
  2. hopefully the problem will be solved in the next few days https://github.com/eclipse/smarthome/issues/2190

How can I see what version I am running?
Does it do auto-completion? (How to invoke?)
It errors on assigning a PointType to a PointType value.

Also from your rules it underlines everything, yet it works.
It says multiple markers it can’t resolve.

Now I remember why I quit using it… it is not of any use. :frowning:

  1. I’m not sure. If you have any doubts download from the link above.

  2. Yes, ctrl-space

  3. And 4. Sounds like you are not running 0.8. when running 0.8 the only false negatives will be calls to add-on actions.

There was a couple day period when 0.9 was the current download at that site.

If it were useless I would not advocate it’s use.

Thanks – as always…

found in my change log distribution-1.8.3-designer-win.zip
just downloaded eclipsesmarthome-incubation-0.8.0-designer-win64.zip
started it… and…

… looks (evidence) whatever I touch in this OH context never works from the start.

No idea what to do with this.

Any help appreciated…

I may have misremembered. You are running 1.8? In that case I told you wrong and you need openHAB Designer. But I’m pretty sure that isn’t being maintained any longer. I’m not even sure where to download it any longer. I’m sure it’s on bintray or cloudbees. I’m on my phone so can’t really search at the moment.

No worries… a reason to get rid of it for good! :slight_smile:

Could someone take a look at this rule to turn on/off a light based on a motion sensor? BA_HUE_Motion is of course the hue motion sensor and bathroom_light is the hue light. The rule is working all EXCEPT keeping the light as long as motion is detected. I’ve searched around the site and found several ways to do this and tried them but couldn’t get them to work. This is what I’ve pieced together myself. If you have some other .rule code that works I’m game to switch to that. Note that I am checking if the time is between 6am and 11pm if it is then the bathroom_light is 100% if not then it’s 15%.

rule "BALightOn"
    when   
            Item BA_HUE_Motion changed       
    then   
logInfo('BA_HUE_Motion', 'Motion detected in Bathroom')
logInfo('bathroom_light', 'Turning Bathroom Light ON')
var DateTime t11p = new DateTime(now.getYear(), now.getMonthOfYear(), now.getDayOfMonth(), 23, 00, 0)
var DateTime t6a = new DateTime(now.getYear(), now.getMonthOfYear(), now.getDayOfMonth(), 6, 00, 0)

	if(BA_HUE_Motion.state==ON) {    
		if(now.isBefore(t11p) && (now.isAfter(t6a)) )	{
               	bathroom_light.sendCommand(100)
               	if(timer!=null){
        			timer.cancel
        			timer = null
        		}
     	} else {
                bathroom_light.sendCommand(15)
                if(timer!=null){
        			timer.cancel
        			timer = null
        		}
		}
	} else {
        	if(BA_HUE_Motion.state==OFF){
        		timer = createTimer(now.plusMinutes(3)) [|
        			bathroom_light.sendCommand(0)
        			logInfo('BA_HUE_Motion', 'No Motion in Bathroom for 3 minutes')
        			logInfo('bathroom_light', 'Turning Bathroom Light OFF')   			
        		]
        	} 
	}
end