Checkout GitHub - zdar/elan2mqtt: MQTT client (gateway) for eLan
The project lists that it would be compatible to openHAB.
Checkout GitHub - zdar/elan2mqtt: MQTT client (gateway) for eLan
mosquitto is up and running now. It looks like it is also properly connected to the elan-rf-003.
also I could add binding to mqtt in openhab, but I think it is not correct (although the devices were detected)
It looks like I need home assistant mqtt binding, but I can’t find that.
sorry, that I do not know as I do not use elan-rf-003.
What does not work if you use the MQTT binding in openhab ?
the detected devices are ok, but all of them (the things) are in unknown state. And I have no any idea what should I do now.
This is what I see, just I don’t really understand…
- MQTT Broker
You need a configured Broker first. This Thing represents a device, that follows the “HomeAssistant MQTT Component” specification.
modelId RFDEL-71B deviceId eLan_2Ddimmer_2D150344 vendor Elko EP
- MQTT Config Topic
Required List of HomeAssistant configuration topics (e.g. /homeassistant/switch/4711/config)
- MQTT Base Prefix
Required MQTT base prefix
Mosquitto is your MQTT broker.
You need to define a MQTT bridge thing first ( ThingType: MQTT Broker ). OH then is able to connect to Mosquitto.
See MQTT - Bindings | openHAB .
Do you have one ?
Once you have a MQTT bridge the MQTT things ( e.g. Generic MQTT Thing ) can be defined / discovered related to the defined bridge.
Yes, MQTT broker is up and running (as far as I see).
MQTT bridge is defined and able to connect to mosquitto, at least the status is green, online (in openhab).
And now I don’t know how should I continue.
What would you like to do ?
Description of elan2mqtt on github says:
- Status messages are using topic /eLan/device_mac_address/status
Command messages are using topic /eLan/device_mac_address/command
this should help to setup the MQTT things ( see also MQTT Things and Channels - Bindings | openHAB ).
I would use a tool like MQTT explorer to check the communication of related devices.
Now I start to understand (probably). The github link you posted contains a tool which collected the things and put into openhab, so actually mosquitto is working. But that elan host is still unreachable from openhab. I need to configure that bridging somehow I think.
One way communication from elan to openhab via mosquitto works ?
The way back ( openhab via mosquitto to elan ) does not work yet ?
According to the github project documentation there are two python scripts that are to be executed ( main_worker.py and socket_listener.py ) do you run both scripts ?
mosquitto works, but no bridge defined (yet), therefore openhab can reach the broker, but cannot communicate with elan.
The python scripts are configured properly, so they can communicate with the broker and also can reach elan (and find the devices). Also the python scrips can upload the collected devices into openhab (somehow), but those devices are currently useless in openhab, because the bridge is not working (so openhab cannot communicate with them). There is a run.sh which calls both python scripts.
That’s what I understand at this moment.
No, it looks like the real connection chain is:
openhab <=> mosquitto <=> python scripts <=> elan <=> devices
the python scripts (at least one of them) should run continuously to make it work, because that makes the conversion between mqtt and elan. This elan box does not handle mqtt at all, it has only a http interface.
That is why it is called elan2mqtt…
I did not look into the scripts but based on their names I thought one is for reading and one for writing
one thing I have just realized:
here you can see the home assistant MQTT component, which cannot be added if MQTT broker is already set. So first I have to delete the broker, add that component, create the broker and configure home assistant component to use that broker. Probably it is a bug in openhab, or probably it is intentionally designed that way, but it took me more than 2 weeks to catch it.
I don’t think it will ever work. Lot of meaningless exceptions in the logs, unknown status everywhere but actually I have no any idea where should I start or continue.
For HA it does according to feedback in this thread.
unfortunately I do not own such a device so what I can help with is limited …
I would first try to use the python scripts standalone - is that possible ? First just try to debug the MQTT bus to see if messages are published there.
With regard to error messages you may contact the author of the tool either via github or via above mentioned thread. According to github it looks like zdar is active there. Last change was two weeks ago.
Yes, I guess my last chance is to contact the author and ask for a more detailed guide.
The errors I got a lot (hundreds of) exceptions in the logs (like this: java.lang.reflect.InvocationTargetException: null
Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 8 column 1 path $
handleException /scrape/ org.eclipse.jetty.http.BadMessageException: 400: Bad query encoding)
Those are simply useless (for me).
By the way, it is not about the device (at least I think) but how should I set up OH to communicate with it. Actually the things are there, just in an unknown state. Anyway, I will contact the author.
Thank you for your patience
The messages that you posted seem to be part of OH logs.
You start the shell script run.sh that is contained in the elan2mqtt project, correct ?
Does this script create any errors, warnings or infos when it is running ?
I don’t think it is related to that run.sh
I just can’t connect OH to MQTT.
the MQTT Broker is online, at least it looks it is configured properly (online). OH also received messages from that run.sh, the devices are listed in the inbox.
But I have a thing called “HomeAssistant MQTT Component” which is still in state unknown. It is connected to the broker. And I have no any idea what is wrong.
And a lot of completely useless and meaningless messages in the log:
2023-02-25 08:21:32.747 [INFO ] [core.karaf.internal.FeatureInstaller] - Some .kar files are not installed yet. Delaying add-on installation by 15s. 2023-02-25 08:21:46.669 [ERROR] [place.internal.json.JsonAddonService] - bundle org.openhab.core.addon.marketplace:3.4.2 (150)[org.openhab.core.addon.marketplace.internal.json.JsonAddonService(47)] : Error during instantiation of the implementation object java.lang.reflect.InvocationTargetException: null
What I told you already I think I found a bug (or what is it) in OH, so it cannot be configured properly.
- start from the very beginning, and try to add HomeAssistant MQTT Component. It cannot be properly configured without a working MQTT broker.
- add first MQTT broker, configure it, now there is no way to add HomeAssistant MQTT Component, it is unavailable (no such item any more).
At the end there is no way to make it work, at least I could not solve it.
I can see similar errors here: [mqtt.homeassistant] HomeAssistant discover error openhab 3.4 · Issue #14022 · openhab/openhab-addons · GitHub
and also here: openHAB 3.4 Release discussion - #218 by J-N-K