Custom component: openHAB Integration

If you like my work please consider supporting:

Open your Home Assistant instance and start setting up a new integration.

I’ve been working on a custom integration for openHAB home automation platform.
This component allows you to add almost all Items (Items | openHAB) to your Home Assistant instance with no hassle.

ha-oh1
ha-oh

Why?

To bridge the gap between these platforms, help migrate from one to another or simply control remote OH instance (in similar way remote openhab binding does it).
The integration may work on a distributed system on entirely in your local network.

Installation

Simply add the following repository to HACS:

For manual installation, read here.

The integration is still missing a couple of features (like controling the Color or Player Items) and possibly contains some bugs. But I thought it may be helpful to someone already.

Contributions to the repo are always welcome!

3 Likes

As somebody who was quite active over there & just completed my move to HA I think other than possibly easing migration there is no need for HA users to want the pain of openHAB. The developers here listed to & respond appropriately to the users. (Wait 3 months because we broke your Z-Wave system is not considered an answer.)

I’m on a same boat basically. My once extensive openHAB config is now limited to some complex rules I haven’t migrated yet.
As someone who also contributed a little bit to HABPanel (long time ago), I wish Lovelace had as easy visual grid layout editor as the one HABPanel has.
So there are strengths and weaknesses among both of these platforms I’d say.

I chose HA to be my primary platform when I started struggling to integrate my LG SmartThinQ air conditioner.
Well, wasn’t easy with openHAB’s Exec binding, gotta admit.

Since then I haven’t looked back.
But after gaining some experience in both worlds I decided to write this integration.
There is one for Hubitat, one for Fibaro, so why not openHAB?

Cheers

1 Like

I guess.

I just posted over there trying to see if there is any interest from Z-Wave users who use Docker of getting zwavejs working for openHAB through HABApp & the REST API Thst would move the Z-Wave threads & database completely separate from the OH development & its “surprise breages”.

Wow, this is awesome. I’ll definitely give it a try as I’ve just spun up my first instance of HomeAssistant. Thanks!

EDIT: Based on the login screen for the connector, I assume it only works for OpenHAB 3? I’m on OH2.5, so I’ll have to see what I can do to get it working.

1 Like

You can spin up OH3 and use remoteopenhab to access & control OH 2.5 I do not know why you would want to do that though…

Thanks for this integration !

I’m running openHAB as my home is on Nikobus (lights and shutters).
As Nikobus integration does not exist elsewhere then in openhab, I’m publishing the items from openHAB Nikobus as Homekit items and controls them from Home Assistant using the HomeKit Controller.

Both solution seems similar, I will try your integration and revert with findings.

hey, is there also a possibility to push HA entities to openhab?
I use HA for everything, but i have purchased some indoor panels for intercom, they run android 5 , HA doesnt work on it, or is verry slow
i tried to install openhab on it, and that runs, so i just want to push some lights/switches/… to openhab, so i can control them on those 2 tablets

thnx

Thanks for the integration. I like the idea as I have since 2 years a massive OH 2.5 installation running. Also since a year an additional OH3, which uses already the remotebinding to access the older more complex rules from OH 2.5

I’m currently in the process of migrating to HA, but again simply can’t recreate all complex rules at once and would like to simply mirror some item state from the old OH instances. Unfortunately, my OH3 instance is running on a self-signed certificate, after entering the token in the integration I just get an error in the config regarding this.

2022-11-15 09:38:18.482 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 414, in connect
    self.sock = ssl_wrap_socket(
  File "/usr/local/lib/python3.10/site-packages/urllib3/util/ssl_.py", line 453, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
  File "/usr/local/lib/python3.10/site-packages/urllib3/util/ssl_.py", line 495, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock)
  File "/usr/local/lib/python3.10/ssl.py", line 513, in wrap_socket
    return self.sslsocket_class._create(
  File "/usr/local/lib/python3.10/ssl.py", line 1071, in _create
    self.do_handshake()
  File "/usr/local/lib/python3.10/ssl.py", line 1342, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:997)


Would be great if this would also work with a self-signed certificate.

Hi. Thanks for the Binding, I mean, Integration :slight_smile: !
May I ask… I have the smartmeter connected to an openhab running on a raspberry Pi . my HomeAssistant Server is somewhere else. I can easily connect both systems thanks to your integration… but HomeAssistant does not regonize the smart meter item correctly, meaning, I cannot select it as a statistical Value for the energy usage here:

What would I have to change so that the item is set up correctly? It is found, I can use it, just not here where I want it :smiley:
This info should help the developer (that what it says :smiley: )

Thanks!
PhiL

I’d assume that this is not an integration issue, but “your linux” doesn’t trust that ssl call.
You might be able to convince “your linux” to trust that ssl call.
I’m not the pro here, but I would try:

or
Adding the self-signed certificate as trusted to a browser (Linux) (which has browser in the title, but the command I have had success with in the past in the tutorial)

Anyone else using this integration? I’ve grade tested it, all items are found, and apart from the status not being updated, I can’t toggle anything either. I get the following error in the log

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/openhab/light.py:49
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 9. Januar 2023 um 23:49:42 (18 occurrences)
Last logged: 08:43:51

[548073017392] 'NoneType' object is not subscriptable
[548019760544] 'NoneType' object is not subscriptable
[547484495648] 'NoneType' object is not subscriptable
[547799638720] 'NoneType' object is not subscriptable
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 200, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1755, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1792, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 678, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 958, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 715, in _handle_entity_call
    await result
  File "/config/custom_components/openhab/switch.py", line 38, in async_turn_on
    await self.coordinator.async_request_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 175, in async_request_refresh
    await self._debounced_refresh.async_call()
  File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 82, in async_call
    await task
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 201, in async_refresh
    await self._async_refresh(log_failures=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 316, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 121, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 556, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 597, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 562, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 997, in state
    if (is_on := self.is_on) is None:
  File "/config/custom_components/openhab/light.py", line 49, in is_on
    return self.item._state[2] > 0
TypeError: 'NoneType' object is not subscriptable

Anyone an idea?

Hello,
would it be possible to implement reduction of measured value by other sensor?
I mean situation when I have several devices connected to single outlet. I measure power of outlet and few selected devices connected to it. I would like to get the rest energy (result = outlet - measured devices)

Does it make any sense?

@kubawolanin love the idea of your integration but I cannot get it to install.

Attempting to install the openHAB Integration produces the following error:

This integration does not support configuration via the UI. If you followed this link from the Home Assistant website, make sure you run the latest version of Home Assistant.

Running Home Assistant in Docker. Home Assistant 2023.1.2 Frontend 20230104.0 - latest

Was able to install your openHAB integration via the manual method.

Great to have access to the devices that are using HUE Emulation via openHAB. Emulated HUE via Home Assistant is giving me difficulties and your integration is allowing me to consolidate everything into the Home Assistant UI. So big thanks to you.

Any chance you will have the “DIMMER” control implemented in the near future?

Just installed the openHAB integration today.

I am able to turn LIGHT SWITCHES on / off, within the integration card, that are controlled by openHAB.

What method did you use to install the openHAB integration?

What version of Home Assistant and Phthon?

What type of devices are you trying to turn on and off?

Switching the devices (switches, lights, shutters) works , but the error message appears every time. If I switch the devices via openhab or directly, the status is not updated either.

I installed it via HACS.
Using latest version of Home Assistant (2023.1.5) and python version 3.9.2

Unfortunately, as @kubawolanin stated, it is a “work in progress”.

At this point I am looking at using MQTT to communicate with openHAB.

The “work in progress” is not ready for prime time. Let’s hope the @kubawolanin focuses a little of his free time on this as it would be great to get the kinks worked out.

2 Likes

I thank the developer of this component. It should be very useful but is this still an active component or abandoned?
I am asking since I see reports of errors in the log and would like to check if there is some future to fixing it and enhance it.

1 Like