Mqtt binding in items file for mqtt with neohub2 requires a colon which conflict with mqtt syntax in items

Hello guys an girls.

No solution at hand to complete persistence for my neohub, one week quest in all forums and all tutorials and guides. Several rounds without luck. New at this openhab and neohub2 seems not to be the most common topic around.

Problem description:
The binding for neobub2 is defined including a colon within the 1.x binding. 2.x does not exist yet. As for instance neohub=“Bathroom:CurrentTemperature”. This is to be stated as the topic in the mqtt binding. From examples i see that most (non observed) other devices does not have this syntax.

mqtt definition in items file:
Item itemName { mqtt=“direction[broker:topic:type:trigger:transformation]” }

The extraneous colon in the topic that result from neohub device partcular binding makes all go to hell…
gives error messages like…
(2018-06-09 22:47:43.527 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model ‘thermostats.items’ has errors, therefore ignoring it: [7,103]: missing ‘}’ at ‘Bathroom’
[7,111]: extraneous input ‘:’ expecting RULE_ID
[7,157]: extraneous input ‘}’ expecting EOF)

Counter measures tried:

  1. Adding 'xxx 'or “xxx” to make a comprehensive string does not help. The colon is still a colon.

  2. Transformations for binding responses, states etcetera, is the closest and are well described but does not apply for stating a binding.

  3. Tried Rules but in contrast to some tutorials the items file does not see inside the rules as I can deduct.

the rules file tried

rule “VariablesDeclare”
when_
_ System started_
then
_ var String NHBRCST = “Bathroom:CurrentSetTemperature”_
end

gives warnings like this
2018-06-11 17:51:27.894 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model ‘neohubRules.rules’, using it anyway:
The value of the local variable NHBRCST is not used
`(Using VAL i s o VAR does not help either)

my items file content
//… This part works for basic UI and so forth…
Switch FrostModeOnOff_Bathroom “Frost Bathroom” {neohub=“Bathroom:Standby”}
Switch HeatingActive_Bathroom “Heating Bathroom” {neohub=“Bathroom:Heating”}
Switch Que_Bathroom “Que Bathroom” {neohub=“Bathroom:Away”}
Number TempActual_Bathroom “Temperature [%.1f °C]” {neohub=“Bathroom:CurrentTemperature”}
Number TempSet_Bathroom “Temperature [%.1f °C]” {neohub=“Bathroom:CurrentSetTemperature”}
//…

However for the mqtt to work, mosquitto, (Generally working except persistence part) i need this to work with this code, or corrected for typos possibly.

Number TempSet_Bathroom “Temperature [%.1f °C]” { mqtt=">[mosquitto:neohub=“Bathroom:CurrentSetTemperature”:Number:*:Set temp]"}

Also the basic UI stops working also when messing with this so it is not only the mqtt that fail.

Otherwise all runs with mosquitto and so on it is the persistence that does not wok. Opennab publishes on broker, not from the actual measurements but othe static stuff.

I also gave up on the mysql and jdbc persistence after two frustrating weeks. Will maybe make a post on that later on.

Any ideas on the colon problem?

/Stefan

Have you tried the mqtt action?

Correct me if wrong, as far as I understand you are trying to persist data using the mqtt-persistence and you are NOT trying to establish a communication between devices via the mqtt-binding.

If that is the case, I would suggest another persistence Service. However you seem to have hit a wall there. Why don’t you post what your finall Goal is (persisting temperatures?), we can help on that.

Reading the docs about mqtt persistence, you would get: “This persistence service supports only writing information, and so features such as restoreOnStartup and sitemap Chart widgets cannot be used with this service.”

1 Like

Yes I am trying to store data from the system only. Heating active / Set temp / Actual Temp / FrostMode. No ambition to control the devices. I have as mentioned tried persisting with mysql-jdbc and then I am not able to connect to the db. I am satisfied with generating a text file with data but Since the binding is only1.x the openhab2 simplified paperUI interface is no help to me.

I have generated an “eventlog” file similar to the openhab.log so my backup plan is to retrieve data from that text file and put into some other in a seqond step, Maybe with VBA in excel where I am more familiar or into mysql.

I am not a genuine programmer but I have been able to do a lot of stuff anyway through the years also professionally. So I am used to move slowly forwards through google research, but this time I am out of leads:-)

I think that you should retry the JDBC Persistence service and store your data in a MySQL DB. Open up a new thread with logs to debug the setup if you want. For sure you can make it work.

The MQTT persistence service is not so robust (compared to MySQL and/or InfluxDB).

Anyway, even if you use MQTT persistence you don’t need to define your item like that:

Number TempSet_Bathroom "Temperature [%.1f °C]" { mqtt=">[mosquitto:neohub="Bathroom:CurrentSetTemperature":Number:*:Set temp]"}

(this doesn’t work anyway due to the :)

You would have your item linked to the neohub binding and then configure the mqtt-persistence.cfg & mqtt.persist files.
Ref: https://www.openhab.org/addons/persistence/mqtt/#configuration

I do agree with all said above by @Dim, personally I would use/suggest RRD4J for persisting.
However, none of the services do write text files, but all use a database doing backups is not a real problem.

1 Like