openHAB 3.0 Milestone 3 discussion

When I add a script with language “ECMAScript”, the scripts page shows “Error: Handler” besides it.

When I add a script with language “Rule DSL”, should this work like rule files in OH2? Because “when” does not seem to work and when I enter garbage, I get no error message anywhere.

Basically true, but the script that you add into the “Then execute the given script” section

is exactly only that part of the former script. Sometimes you need to play around a bit. It helped me to add some logInfo() output to openhab.log to understand where a rule failed

Is anyone else having problems updating? I’m running into https://github.com/openhab/openhab-linuxpkg/issues/170 I believe.

apt-get update

Err:8 https://openhab.jfrog.io/openhab/openhab-linuxpkg testing Release
  Unknown date format Bad header data [IP: 35.231.52.82 443]
E: The repository 'https://openhab.jfrog.io/openhab/openhab-linuxpkg testing Release' no longer has a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

apt-get upgrade

E: Failed to fetch https://openhab.jfrog.io/openhab/openhab-linuxpkg/pool/main/3.0.0~M3/openhab_3.0.0~M3-1_all.deb  Unknown date format Bad header data [IP: 35.231.52.82 443]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
o

So I had error 'getHourOfDay' is not a member of 'java.time.ZonedDateTime' in the following if

    if (now.getHourOfDay() <= 3){
	    GF_LivingDining_TV_Timer_30m.sendCommand(ON)
    }

Was ok in 2.5.10

Use getHour in OH3.

4 Likes

Does anyone have the issue where it takes exactly 2 minutes for OH3 to shutdown? I’ve had this on M2 and M3 now. It takes almost exactly 120 seconds for OH to stop. Based on the logs, the bindings and things go offline almost immediately. The rules however (mostly crons) seem to run for another 2 minutes before being forced to die.

Got this when closing OH3

2020-11-26 19:25:28.223 [WARN ] [g.mqtt.handler.AbstractBrokerHandler] - Tried to unsubscribe org.openhab.binding.mqtt.homie.internal.discovery.Homie300Discovery@245f7e05 from  discovery topic homeassistant/# on broker mqtt:broker:aveiro but topic not registered for listener. Check discovery logic!
2020-11-26 19:25:28.295 [WARN ] [g.mqtt.handler.AbstractBrokerHandler] - Tried to unsubscribe org.openhab.binding.mqtt.homeassistant.internal.discovery.HomeAssistantDiscovery@28a8b44 from  discovery topic +/+/$homie on broker mqtt:broker:aveiro but topic not registered at all. Check discovery logic!
2020-11-26 19:25:28.313 [WARN ] [g.mqtt.handler.AbstractBrokerHandler] - Tried to unsubscribe org.openhab.binding.mqtt.homeassistant.internal.discovery.HomeAssistantDiscovery@28a8b44 from  discovery topic homeassistant/# on broker mqtt:broker:aveiro but topic not registered at all. Check discovery logic!
2020-11-26 19:25:28.315 [WARN ] [g.mqtt.handler.AbstractBrokerHandler] - Tried to unsubscribe org.openhab.binding.mqtt.homeassistant.internal.discovery.HomeAssistantDiscovery@28a8b44 from  discovery topic +/+/$homie on broker mqtt:broker:aveiro but topic not registered at all. Check discovery logic!

No such errors in 2.5.10 (I do not use mqtt autodiscovery, all my definitions are in things and items files)

I noticed that it takes some time to stop. But I didn’t explicitely check for it. Will have a closer look next time.

Curiosity happened so I timed it…

$ time sudo systemctl stop openhab

real    2m0.700s
user    0m0.006s
sys     0m0.002s

Is anyone else noticing serious delays between things happening and the bus updating? By the order of minutes? I have a Neeo remote and there is a solid few minutes (5 or more) between button click and it showing up on the event bus. M2 did not have this issue. I’ve also noticed that if I update the state of an item in the cli that it is taking minutes before it is hitting the bus.

EDIT: More info - As per top, my java process is permanently above 100%. Not sure why it’s sitting so high.

EDIT2: I backed out to M2 but left addons at M3 and the system is substantially more stable now. Not sure what changed from M2 to M3, but something is definitely broke. I’ve opened a bug as https://github.com/openhab/openhab-core/issues/1852

did expire make it into this one?

Yes you add it to item as metadata

1 Like

The time thingy has changed

The next-gen rule engine (NGRE) of openHAB 2.5 has now become the official rule engine within openHAB. Good news is that your rule DSL files are not impacted by this change and should run smoothly on it. The only change you’ll have to look our for in your rules is the fact that rules now use Java Time API instead of Jodatime, so some expressions need to be slightly adapted.

From

Try

now.getHour()

2 Likes

just played around a bit with the model and want to mass edit the model. I didn’t find the “Code”-functionality as it is with things. or “Select” as it is with items. Is it something, that’s being worked on to ensure consistent user experience! :wink:

One thing to understand about the model is it’s all just Items. Locations (always) and Equipment (mostly) are just regular old Groups with a semantic tag. Points are just regular old Items with semantic tags and a group membership to place them in a location and as part of an equipment. Knowing how it works will help you understand why you won’t see a code view of the model. It’s not built using one definition that could be shown as a single YAML. The closest you could come is showing a YAML with all you semantically tagged Items listed.

Given this, depending on the operation you want to perform, the bulk actions will take place on the appropriate Item’s page. For example, to move a bunch of equipment from one room to another, go to the Group Item for the room, and bulk select the Items to add as members. Then do the same to remove them.

I suspect over time there will be improvements to the model UI but any improvements are going to be quite complex to achieve I think so we need to be patient on that front.

2 Likes

2.5x this is also there, I hoped it would not be in version 3. But still, these warnings are present. It irritates. I read all the topics on the forum that mention this warning, I did not find a single explanation of why this is needed. Once there was a mention - do not pay attention, but I would not want the incomprehensible, not used by me features were automatically enabled, plus everything, issued warnings. Is there a way to disable this?

5 posts were split to a new topic: OH2 rule failing in OH3

Hi, I’m facing error

2020-11-28 10:00:01.666 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'tmp_LivingDining-9' failed: An error occurred during the script execution: Could not invoke method: java.util.List.size() on instance: [Ljava.lang.String;@9e18950 in tmp_LivingDining

in the following rule (it was ok in 2.5.10)

rule "Descodificar estados da lareira"
when
	Item GF_LivingDining_Stove_Out changed
then
	var lines = GF_LivingDining_Stove_Out.state.toString.split('\n')
	if (lines.size('\n') > 6) {
		val estado_lar = lines.get(4).split('=').get(1)
		GF_LivingDining_Stove_Stat.postUpdate(estado_lar)
		var temp_amb = Double::parseDouble(lines.get(7).split('=').get(1))
		GF_LivingDining_Stove_Temperature.postUpdate(temp_amb)
	}

	// caso a lareira tenha sido ligada/desligada fora do OpenHAB vamos actualizar o estado
	if (GF_LivingDining_Stove_Stat.state == "0" && GF_LivingDining_Stove.state == ON){
		// a lareira foi desligada
		GF_LivingDining_Stove.sendCommand(OFF)
	} else if (GF_LivingDining_Stove_Stat.state == "7" && GF_LivingDining_Stove.state == OFF){
		// a lareira foi ligada
		GF_LivingDining_Stove.sendCommand(ON)
	}
end

GF_LivingDining_Stove_Out is updated with a script (Exec add-on) and contains:

error_MODO_on_off=0
on_off=0
modo_operacion=1
modo_func=1
estado=0
consigna_potencia=5
consigna_temperatura=23.0
temperatura=19.7
temperatura_ext=---.-
0

I need to parse contents of lines 5 & 8 and assign their value to some items.

Are you sure this worked? lines.size(’\n’) is kind of nonsense. lines is an array created by splitting the string on ‘\n’. That split removed all the ‘\n’ as a result. So even if this worked the call to size would always return 0 because there are no more \n.

But the perform goes even deeper because there is no size method that takes a String on Lists. So remove the argument to size and it should be ok.

1 Like

As I played around a bit on my test-installation I already built my whole model for my smarthome… But as I messed around, I also did some major misconfiguration, I wanted to solve. I figured, if I could get my model as “code”, I could easily remove those and insert them in my “staging”-environment before I’m ready to switch fully to OH3 (at least for my main installation, I have to have an OH2 around for some legacy 1.x bindings I use).