Xiaomi Open/ Close sensors will not get visible / working in the paper UI and Visual Studio Code

  • Platform information:
    • Hardware: Pi 4 4GB
    • Java Runtime Environment: openHAB version: 2.5
  • Issue of the topic: I am using at my Raspberry a Zigbee USB stick CC2531.
    The installation of other functions and devices went well without any big problems.

The installation on the pi and paring of two Xiaomi windows sensors went fine and the are working.

But l am not able to get them working in the paper UI or Visual Studio Code.

I installed a generic binding and added the sensors there.
In the openhab log file I see the devices with the following warning message:
2020-02-16 22:25:01.353 [WARN ] [t.generic.ChannelStateTransformation] - Executing the JSONPATH-transformation failed: Invalid path ‘$.Sensor_Kueche.contact’{“battery”:100,“voltage”:3045,“linkquality”:136,“contact”:false}’
In the sitemap I only see a “–“ and in Visual Studio code only “NULL” if I move over the description in the item file.

Would me great if s.o. can help me.

BR

Schoppi

That’s pretty clear.

Hallo Maintainer,

was ist falsch und muss geändert werden?

what is wrong and must be changed / adjusted?

As @namraccr mentionned, there is your error.
Your JSONPATH is incorrect

See: http://jsonpath.com/

Hello Vincent,

I am not so familiar with the jsonpath syntax and in that case without any idea how to solve it.
Do you need further details to be more precise how it should look like?

As I wrote I am using Visual Studio Code. But I am not sure if the failure is there or in the Generice binding:
There are some screen shots:
generic Binding

This is the problem. You must understand the syntax or you can’t do this.
Go and study up.

In the Sensor_Kueche configure channel
In Custom On/Open value put true
In Custom Off/Closed Value put false
For the Incoming value transformation: JSONPATH:$.contact

You need to familirise yourself with jsonpath

Hello Vincent,

Many Thanks, it works !! J

BR

Lothar

Please tick the solution, thanks

Hello Maintrainer,

thanks for your reply but this comment was not very helpful and did not solve my problem.
It’s fine if you know my weaknesses!
With the information from Vincent I solved it and understood what was missing. Here Openhab is different from the iobroker where is no need to specify the basic i/O values.
I am not an IT specialist and do my personal development in programming by reading and analyze of examples. But in some cases, it is difficult to find the right examples that fit to my personal environmental.

Friendly spoken:
So if you want to help others give clear hints e.g. step by step descriptions, examples of useful links.
This will also help others in the community.

BR

Schoppi

@Schoppi,
Your comment is unnecessary
@namraccr comment was valid. I made the same one just after him.
I gave you the link to jsonpath.com for you to go there and learn. If you figure it out by yourself you actually learn something.
If we give you the answer on a plate, you are none the wiser.

You really need to get familiar with JSONPATH if you are going to be serious with openHAB. It’s an important syntax/format.

We know you are not programmers. I am not either. But I learned jsonpath myself and most of openHAB by reading and trying and reading again.

So you need to help yourself first before asking the forum.
Did you read How to ask a good question / Help Us Help You?

1 Like

Hello Vincent, I have not found the opportunity to send PNs
If you are interested in a personal note and further details, please let me know.

BR

Lothar