Beginner, guidance needed for mqtt.home assistant binding

ok, i had a look in log files

for the discover part, seems openhab is finding sensors and stuff, but they give invalid config

2022-07-04 13:19:46.566 [WARN ] [nal.discovery.HomeAssistantDiscovery] - HomeAssistant discover error: invalid configuration of thing 1 component binary_sensor: Cannot parse channel configuration JSON
2022-07-04 13:19:46.566 [WARN ] [nal.discovery.HomeAssistantDiscovery] - HomeAssistant discover error: invalid configuration of thing 1-bypass component switch: Cannot parse channel configuration JSON

for the light i entered manually in openhab, when i turn it on, seems i see it in the log
now how do i add that manually added mqtt light to the UI?

2022-07-04 17:02:27.657 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '{"state": "ON", "color_mode": "onoff"}' from channel 'mqtt:homeassistant:2693a81a59:mqtt_5Flight_2Ebadkamer#light' not supported by type 'ColorValue': {"state": "ON", "color_mode": "onoff"} is not a valid string syntax

It sounds like you have one broker, which is just as it should be.
The ‘broker Bridge Thing’ in openHAB is just a pointer to some external MQTT service, where openHAB can subscribe to MQTT topics.

Okay, so the link to broker is good.

Are these devices actually sending messages in HomeAssistant self-identifying format?

Yes, these entities are being discovered in HA without an issue…

If discovery doesn’t work I can live with that, how to proceed manually? I’m also stuck here… See my first post, not sure what I need to do with the channel/model part

Hi
I think you should study the concepts of Thing, channels and items first (this is a different concept than Home assistant uses as far as I know)

In brief. Example: You have a Philips Hue lamp.
To use these you need the Philips Hue binding to make Openhab and Hue speak the same language.

then you create a Thing (or it is automatically detected) this is a virtual representation of the physical lamp within Openhab
This lamp has an on and off function and a dimmer function, which we call Channels. So the Thing has a dimmer and an on-off (switch) channel.

To display a Channel on a UI you need to create an Item associated with Channel.

An item has a type, name, label, etc.
For example, a type can be a switch, color or player.

This might be confusing at first, but it’s all well documented

Configuration | openHAB

Ok need a look at the docs again indeed, channels is confusing indeed…
I try again next time

Hey @micware , i’m back from vacation, want to start working on it again, but still stuckj on channels
Openhab found a lot of mqtt lights and i see them all in inbox (44 items)
I added one as a test from inbox, looks like:


Next, added a model (groundfloor) , but now i’m stuck
when i “create equipment from thing” or "create points from thing’, i always get error…
What am i missing?

extra, if i click on the cofigure channel that was added by auto discovery, i see this
so all looks fine to me?

is there any error message in the openhab.log file ?

this error, was from wrong place, irrelevant
but i tested again, went to inbox and added the thing, see screens from the thing created:


image

UID: mqtt:homeassistant_mqtt_5Flight_2Ewasplaats:e94f1500bd:mqtt_5Flight_2Ewasplaats
label: Wasplaats (Light)
thingTypeUID: mqtt:homeassistant_mqtt_5Flight_2Ewasplaats
configuration:
  topics:
    - light/wasplaats
  basetopic: homeassistant
bridgeUID: mqtt:broker:e94f1500bd

Next, i go to add model =>


but i’m unable to select the channel it seems?

What i do see in log, when i goto model => create points from thing, i see this in log:

2022-07-26 17:44:47.491 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '{"state": "OFF"}' from channel 'mqtt:homeassistant_mqtt_5Flight_2Ewasplaats:e94f1500bd:mqtt_5Flight_2Ewasplaats:mqtt_5Flight_2Ewasplaats#light' not supported by type 'ColorValue': {"state": "OFF"} is not a valid string syntax
2022-07-26 17:47:02.634 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '{"state": "OFF"}' from channel 'mqtt:homeassistant_mqtt_5Flight_2Ewasplaats:e94f1500bd:mqtt_5Flight_2Ewasplaats:mqtt_5Flight_2Ewasplaats#light' not supported by type 'ColorValue': {"state": "OFF"} is not a valid string syntax
2022-07-26 17:50:24.625 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '{"state": "OFF"}' from channel 'mqtt:homeassistant_mqtt_5Flight_2Ewasplaats:e94f1500bd:mqtt_5Flight_2Ewasplaats:mqtt_5Flight_2Ewasplaats#light' not supported by type 'ColorValue': {"state": "OFF"} is not a valid string syntax

seems its indeed related to colorvalue, i now added a thing from inbox, like a switch instead of light, without colorvalue, that seems to work without an issue

so its related indeed to colorvalue, but how to fix?

Hi
I think you need to look at the channel configuration (YAML part) of the thing that is not working.

From the error message I conclude that he wants to send an on-off command but color is expected

below you see an example of one of my MQTT things (a lamp)

There is a switch channel (for on/off)
There is a Dimmer channel
There is a color temperature channel

for a switch channel you create a switch item that you can display and control via a UI and for the dimmer channel and dimmer item

in my example you see channelTypeUID: mqtt:switch because it points to a commandTopic (MQTT) that accepts an on or off command. If I make this a channelTypeUID of “Color” you probably get an error.

UID: mqtt:topic:xxxxxxx:huiskamer_kabinet_lamp_links
label: Huiskamer kabinet lamp links
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:xxxxxxx
location: "Huiskamer "
channels:
  - id: state
    channelTypeUID: mqtt:switch
    label: bedlamp aan/uit
    description: null
    configuration:
      commandTopic: zigbee/huiskamer_kabinet_links/set/state
      stateTopic: zigbee/huiskamer_kabinet_links/state
      off: OFF
      on: ON
  - id: dimmer
    channelTypeUID: mqtt:dimmer
    label: Dimmer
    description: null
    configuration:
      commandTopic: zigbee/huiskamer_kabinet_links/set/brightness
      min: 0
      stateTopic: zigbee/huiskamer_kabinet_links/brightness
      max: 255
  - id: Color_temperature
    channelTypeUID: mqtt:dimmer
    label: Dimmer
    description: null
    configuration:
      commandTopic: zigbee/huiskamer_kabinet_links/set/color_temp
      min: 150
      stateTopic: zigbee/huiskamer_kabinet_links/color_temp
      max: 500
  - id: effect
    channelTypeUID: mqtt:string
    label: Dimmer
    description: null
    configuration:
      commandTopic: zigbee/huiskamer_kabinet_links/set/effect
      stateTopic: zigbee/huiskamer_kabinet_links/effect

I made all my mqtt things by hand.

I’m not an expert in this area, hopefully someone will correct me if I’m explaining it all wrong :wink:

I am now experimenting with Home assistant and running into the opposite. I don’t use MQTT topics according to the naming convention that home assistant automatically understands. So now I have to learn/find out how home assistant deals with this.

Oh yeah, it is always useful to use a program like MQTT-Explorer to see the MQTT command and state topics that are published on your MQTT broker.

That’s the issue, when I look at the yaml code, there is no channel section at all, looks it doesn’t get generated… I try again tomorrow

When i add the thing directly from inbox, the channel does look like:

With code below:

UID: mqtt:homeassistant_mqtt_5Flight_2Ezolder:e94f1500bd:mqtt_5Flight_2Ezolder
label: Zolder (Light)
thingTypeUID: mqtt:homeassistant_mqtt_5Flight_2Ezolder
configuration:
  topics:
    - light/zolder
  basetopic: homeassistant
bridgeUID: mqtt:broker:e94f1500bd

Then the issue begins, i cant add points

If i compare it with another mqtt , but a switch instead of lights, it looks like:


with yaml below

UID: mqtt:homeassistant_mqtt_5Fswitch_2Eeetkamer_5Fsc:e94f1500bd:mqtt_5Fswitch_2Eeetkamer_5Fsc
label: Eetkamer Sc (Switch)
thingTypeUID: mqtt:homeassistant_mqtt_5Fswitch_2Eeetkamer_5Fsc
configuration:
  topics:
    - switch/eetkamer_sc
  basetopic: homeassistant
bridgeUID: mqtt:broker:e94f1500bd

it seems the mqtt home assistant binding , doesnt need any yaml at all, its probably somekind of builtin, but it just doesnt work for lights…
i really hoped openHab was a stable system :frowning:

Whether it has the features that you want or not, has little to do with stability.

I think it would be fair to say that the Home Assistant discovery part of the MQTT binding has received less development from volunteer developers than say the Homie version. That would reflect the interest of the developers.
I wouldn’t be surprised if it does not include support for every combination, which is what you seem to be looking at.

You can contribute yourself, or persuade someone who can (there is a bounty scheme for enhancement requests)

Or, the MQTT binding is flexible and allows you to manually define all the Things and channels that you’d like. That’s more work than auto-discovery, of course.

sorry , but its a good start… i’m indeed new to OpenHab
But:
Seems homeassistant.mqtt component is broken? i dont see reports of it anywhere?
I started a few weeks ago, i have an older DSM 6.x , so followed docs:

They point to this page for SPK release package

but release package is just missing, there are open issues on it on github, but its not updated , last update was from like october 2021 ?

as a new user, its not a good start :slight_smile:

In your first post you wrote that your are on OH 3…3.0.
That is a release that just recently was released.

Did you install Jinja- and JSON transformation ? They are listed as requirements for auto discovery for HA binding.

How to read this limitation:

The HomeAssistant Light Component only supports RGB color changes

I check later what release…

Yes json and Jinja installed , switch is working. , Light isn’t… I don’t have rgb or colorvalue on my matt lights, so no idea where it’s coming from

I’m indeed on 3.3.0, installed last month