Clarification of how to configure OH2 with txt files?

Can you just check your answer for number 1 please? I do want to configure with config files (retracting as the typo was corrected) :slight_smile:

Thanks, I will have a read. I am in two minds about upgrading at all, it was a long journey to get to where I am happy with my setup. But I like a challengeā€¦ though I do keep looking at Home Assistant to see what that is up to.

Oh no that was a typo of course :wink:

Let me tell you from personal experience. Upgrading is totally worth it and if you decide to not use PaperUI, you just have to adopt to a few details in your configuration files. I have gone that path a few months back and am not looking back!
The details have been discussed exhaustively before:

Just for clarification, Iā€™ve not yet really focused on the approach that doesnā€™t use PaperUI yet. That second link makes heavy use of PaperUI. And I should say I donā€™t really have a problem with it except for the requirement of jumpping back and forth between it and text files to map Items to channels and creating Things for bindings that do not do autodiscovery. I assume that will get better with time.

Iā€™ve also not played around with Habmin much but I understand Chris has added the ability to do just about anything through it without touching the text files at all.

Iā€™m sorry that I still didnā€™t take the time to read it in full -.-
Would you like me to continue with the Paperless guide? It would reference your migration guide and only discuss differences when working without PaperUIā€¦

Can I suggest to make it clear that you canā€™t configure things that are configured using text files at all. This is quite a common question (ie ā€œI get the ā€˜canā€™t save unmanaged thingā€™ errorā€). All configuration needs to be done with text files which means itā€™s not possible to configure devices (eg ZWave devices). Users will need to use other software to do this (eg open ZWave or Zensys software for ZWave).

The guide is a great start! I think it would be fine to even concentrate more on the textual configuration as this is where 1.x users are coming from and what they are familiar with. See e.g. the services/addons.cfg file, where they could simply list the bindings that they currently have in their addons folder - no need to click through a UI for that.

I would definitely say yes! Actually, I wonder if we can somehow achieve a documentation structure where we can show how to do the same thing through the different options. Note that also HABmin is now an official part of the project, so we do not only have text files, Paper UI, but also HABmin. Installing a new addon can therefore be done through at least 3 different options (yeah, openHAB is about flexibility and not a one-size-fits-all approach, this clearly makes some things more complicatedā€¦). Actually ā€œcommand line / shellā€ might be even a fourths optionā€¦

Does anybody have a good idea, how the different options could be dealt with in the documentation? I wouldnā€™t want to declare ONE way the right one, but really leave the users a choice. Only the tutorials could decide for one way to do it (the 1.x migration rather leaning towards textual, the beginner tutorial towards Paper UI, etc.).

This isnā€™t correct - they can be configured, but that needs to be done in the text files. So things defined in text are configured in text, things defined through UI are configured through the UI.

What you refer to though is ā€œdevice configurationā€ as discussed here. The only binding that does this is to my knowledge Z-Wave, so for now I would document this aspect in the Z-Wave binding documentation specifically.

Ok - do you mean there something in the thing handler to send configuration updates to the the configuration update method on startup?

@kai - what do you expect the binding to do in order to support this? I canā€™t find anything in the docs, and the ZWave binding doesnā€™t do anything special here which is why I made the original point that itā€™s not supported in ZWave.

Can you please explain how itā€™s meant to work in the binding and Iā€™ll take a look.

It does - it uses the Thing (handler) configuration mechanism for device management as we have discussed in the linked thread. There is nothing that I ask you to change in the Z-Wave binding.

Ok, sorry, I thought from the way you described this as though you meant that there was something different for the startup since Iā€™m only using the standard handleConfigurationUpdate method and I assumed other bindings were using this.

Can you explain how this works for the startup with text file configurations - does the parser send these parameters using the handleConfigurationUpdate method - does it send these immediately after the device goes online? Iā€™m just trying to understand the timing as thereā€™s a lot happening on the network at startup and Iā€™m wondering if thereā€™s anything I need to account for here.

It works just the same way as with Things from the database (or any other source): The framework calls the registered ThingHandlerFactory.createHandler(Thing thing) and passes the Thing (which includes its configuration). Most factories then instantiate the handler by passing the Thing as a constructor parameter.
As outlined here, a Thing is nothing else than a structured binding configuration String, so it is normally treated as statically defined.

Sure, I understand how the thing is created - thatā€™s not my question. I mean how (or when) does it call the handleConfigurationUpdate method to set the configuration that is specified in the text files.

Never, because the configuration is there from the start.

Or is your question what happens upon a change in the text file? Afaik, the file will be re-parsed and there will be a ā€œThing updatedā€ event, which will call thingUpdated(Thing thing) on the handler.

Hmmm - ok, so if handleConfigurationUpdate is never called, then the configuration will never be set which is why I thought that text configuration would not be sent to the device.

Correct, as it was never meant to be sent to the device, but only be used by the handler for accessing the device :slight_smile:

Yep - but my original point was that we canā€™t configure devices with this method so weā€™re back to the old discussion about device configuration. Currently this is the only method we have to configure devices - I know your position is that the system isnā€™t meant to support device configuration, but without this ZWave would be pretty hard to use at all.

Hey guys, you lost me in the middle but I want to agree on this, being able to send configurations to devices would be a big step forward making openHAB a complete system. Iā€™m still forced to do configuration in the homematic configuation wizard, which is quite buggy. Are you telling me this is currently not possible because there is no core functionality a binding can use?

The system provides a configuration mechanism, but in ESH itā€™s stated that this is only designed for configuring the thing (ie the software) and not the device.

However, I only found this out recently (having written the binding 12 months ago), so itā€™s fully possible to configure devices in ZWave - I provide the ability to configure the devices so long as youā€™re not using text files (hence my original point). Kais point is that the configuration mechanism is not meant to be used for this, so Iā€™m breaking the rules (slightly) :wink: and there is some ongoing discussion about implementing something else for device management within the ESH forum.

Again, FTR: Eclipse Community Forums: Eclipse SmartHome Ā» Device configuration system

Hello,
I use paper UI for discovering things and I use sitemap, rule and things for DEV in files.
The two system speak very well (only a little thing on motion alarm by zwave is not working, but Chris is a very well software engineer and will resolve :slight_smile: ).
I use Zwave things with key usb, hue bulbs and squeezebox for sound. All enabled by voice with android app.
I paste my code (now itā€™s not working because yesterday I did some change fot the alarm and I have to debug) maybe can help you:

I write my ā€œresolution of problemsā€ on post Little help for new users OH2

items:

Number Scena  "Scena" <scena>
Number Giardino  "Giardino" <Giardino>
String VoiceCommand
Switch squeezeboxOn { channel="squeezebox:squeezeboxplayer:D758D8B6-0D7F-490E-BCCF-8BB89A4E9938:000420296210:power" }
String squeezeboxStream { channel="squeezebox:squeezeboxplayer:D758D8B6-0D7F-490E-BCCF-8BB89A4E9938:000420296210:stream" }
String cucinaMotion { channel="161955dc:node28:alarm_motion" }
String Luce1Sala { channel="hue:0210:00178828f4ed:1:color" }
String Luce2Sala { channel="hue:0210:00178828f4ed:2:color" }
String LuceDivano { channel="hue:0210:00178828f4ed:3:color" }
String LuceCucina { channel="hue:0210:00178828f4ed:4:color" } 
String LuceGiardino { channel="hue:0210:00178828f4ed:5:color" }
Switch alarm_Keypad { channel="zwave:device:161955dc:node14:alarm_access"}
Switch alarm_Voice
Number allarme_Fired
Switch contatto_cucina { channel="zwave:device:161955dc:node28:sensor_door" }
Switch contatto_sala { channel="zwave:device:161955dc:node8:sensor_door" }
Switch contatto_bagno { channel="zwave:device:161955dc:node11:sensor_door" }

rules

rule testVoice
when
Item VoiceCommand received command
then
var String command = VoiceCommand.state.toString.toLowerCase

var HSBType lucegiardino = new HSBType(new DecimalType(68),new PercentType(88),new PercentType(30))
var HSBType lucerelax = new HSBType(new DecimalType(74),new PercentType(78),new PercentType(36))
var HSBType luceoff = new HSBType(new DecimalType(0),new PercentType(0),new PercentType(0))
var HSBType luce = new HSBType(new DecimalType(181),new PercentType(20),new PercentType(100))
var HSBType lucelettura = new HSBType(new DecimalType(84),new PercentType(47),new PercentType(100))

if (command.contains("relax")) {
	Luce1Sala.sendCommand(lucerelax)
	Luce2Sala.sendCommand(lucerelax)
	LuceDivano.sendCommand(lucerelax)
	LuceCucina.sendCommand(lucerelax)
	Scena.sendCommand(1)
}
if (command.contains("lettura")) {
	Luce1Sala.sendCommand(lucelettura)
	Luce2Sala.sendCommand(lucelettura)
	LuceDivano.sendCommand(lucelettura)
	LuceCucina.sendCommand(lucelettura)
	Scena.sendCommand(2)
}

if (command.contains("luce")) {
	if ((Scena.state == 4)) {
		Luce1Sala.sendCommand(luce)
		Luce2Sala.sendCommand(luce)
		LuceDivano.sendCommand(luce)
		LuceCucina.sendCommand(luce)
		Scena.sendCommand(0)
		squeezeboxStream.sendCommand("http://www.voicerss.org/controls/speech.ashx?hl=it-it&src=allarme%20attivo&c=mp3")
	}else{
		Luce1Sala.sendCommand(luceoff)
		Luce2Sala.sendCommand(luceoff)
		LuceDivano.sendCommand(luceoff)
		LuceCucina.sendCommand(luceoff)
		Scena.sendCommand(4)
	}
}

if (command.contains("giardino")) {
	if ((Giardino.state == 1)) {
		LuceGiardino.sendCommand(luceoff)
		Giardino.sendCommand(0)
	}else{
		LuceGiardino.sendCommand(lucegiardino)
		Giardino.sendCommand(1)
	}
}


if (command.contains("radio")) {
	if(squeezeboxOn.state == ON){
		squeezeboxOn.sendCommand(OFF)
	}else{
		squeezeboxOn.sendCommand(ON)
		squeezeboxStream.sendCommand("http://onair18.xdevel.com:8014/")
	}
}

if (command.contains("allarme")) {
	if(alarm_Voice.state == ON){
		alarm_Voice.sendCommand(OFF)
	}else{
		alarm_Voice.sendCommand(ON)
	}
}
end


rule "door_contact"
when
    Item contatto_cucina changed
    or Item contatto_sala changed
	or Item contatto_bagno changed
	or Item alarm_voice changed
	or alarm_keypad changed
then
	if (contatto_cucina.state = ON or contatto_cucina.state = ON or contatto_cucina.state = ON ){
		if (alarm_voice = ON or alarm_keypad = ON){
			allarme_Fired.sendCommand(1)
		}else{
			allarme_Fired.sendCommand(0)
		}
	}
end

rule "Alarm"
when
     Item allarme_Fired changed
then
	if (allarme_Fired.state = 0){
		LuceGiardino.sendCommand(luceoff)
	}else{
		LuceGiardino.sendCommand(lucelettura)
	
	}
end


and sitemap

sitemap demo label="Casa" {
    Frame label="Scene" {
		Switch item=Scena label="Scene casa" mappings=[0="Luce", 1="Relax", 2="Lettura", 4="Spegni"]
	}	
	Frame label="Allarme" {
		Switch item=zwave_device_161955dc_node14_alarm_access label="Allarme keypad" mappings=["OFF"="OFF", "ON"="ON"] icon="alarm"
		Switch item=alarm_Voice label="Allarme voce" mappings=["OFF"="OFF", "ON"="ON"] icon="alarm"
	}
	
    Frame label="Temperature" {
        Text item=VoiceCommand label="Voice"
		Text item=zwave_device_161955dc_node28_sensor_temperature label="Temperatura cucina [%.1f Ā°C]" icon="temperature"
     	Text item=zwave_device_161955dc_node26_sensor_temperature label="Temperatura esterna [%.1f Ā°C]" icon="temperature"
    	Text item=zwave_device_161955dc_node8_sensor_temperature label="Temperatura sala [%.1f Ā°C]" icon="temperature"
    	Text item=zwave_device_161955dc_node11_sensor_temperature label="Temperatura bagno [%.1f Ā°C]" icon="temperature"
    }
    
    Frame label="Sicurezza" {
    	Switch item=zwave_device_161955dc_node28_alarm_motion label="Movimento cucina" mappings=["OFF"="OFF", "ON"="ON"] icon="motion"
    	Switch item=zwave_device_161955dc_node8_alarm_motion label="Movimento sala" mappings=["OFF"="OFF", "ON"="ON"] icon="motion"
    	Switch item=zwave_device_161955dc_node11_alarm_motion label="Movimento bagno" mappings=["OFF"="OFF", "ON"="ON"] icon="motion"
		Switch item=zwave_device_161955dc_node26_sensor_binary label="Movimento esterno" mappings=["OFF"="OFF", "ON"="ON"] icon="motion"
		Switch item=zwave_device_161955dc_node28_sensor_door label="Finestra cucina" mappings=["CLOSED"="OFF", "OPEN"="ON"] icon="window"
    	Switch item=zwave_device_161955dc_node8_sensor_door label="Finestrone sala"  mappings=["CLOSED"="OFF", "OPEN"="ON"] icon="window"
    	Switch item=zwave_device_161955dc_node11_sensor_door label="Finestra bagno"  mappings=["CLOSED"="OFF", "OPEN"="ON"] icon="window"
        }    
		
		
    
    Frame {
		Chart item=zwave_device_161955dc_node26_sensor_temperature period=W refresh=86400 label="Temperatura esterna"
	}
}