Beginner, guidance needed for mqtt.home assistant binding

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

'ColorValue': {"state": "OFF"} is not a valid string syntax

the code expects three elements ( split.length !=3 ):
extract from file openhab-addons/bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/values/ColorValue.java


    public void update(Command command) throws IllegalArgumentException {
        HSBType oldvalue = (state == UnDefType.UNDEF) ? new HSBType() : (HSBType) state;
        if (command instanceof HSBType) {
            state = (HSBType) command;
        } else if (command instanceof OnOffType) {
            OnOffType boolValue = ((OnOffType) command);
            PercentType minOn = new PercentType(Math.max(oldvalue.getBrightness().intValue(), onBrightness));
            state = new HSBType(oldvalue.getHue(), oldvalue.getSaturation(),
                    boolValue == OnOffType.ON ? minOn : new PercentType(0));
        } else if (command instanceof PercentType) {
            state = new HSBType(oldvalue.getHue(), oldvalue.getSaturation(), (PercentType) command);
        } else {
            final String updatedValue = command.toString();
            if (onValue.equals(updatedValue)) {
                PercentType minOn = new PercentType(Math.max(oldvalue.getBrightness().intValue(), onBrightness));
                state = new HSBType(oldvalue.getHue(), oldvalue.getSaturation(), minOn);
            } else if (offValue.equals(updatedValue)) {
                state = new HSBType(oldvalue.getHue(), oldvalue.getSaturation(), new PercentType(0));
            } else {
                String[] split = updatedValue.split(",");
                if (split.length != 3) {
                    throw new IllegalArgumentException(updatedValue + " is not a valid string syntax");
                }
                switch (this.colorMode) {
                    case HSB:
                        state = new HSBType(updatedValue);
                        break;
                    case RGB:
                        state = HSBType.fromRGB(Integer.parseInt(split[0]), Integer.parseInt(split[1]),
                                Integer.parseInt(split[2]));
                        break;
                    case XYY:
                        HSBType tempState = HSBType.fromXY(Float.parseFloat(split[0]), Float.parseFloat(split[1]));
                        state = new HSBType(tempState.getHue(), tempState.getSaturation(), new PercentType(split[2]));
                        break;
                    default:
                        logger.warn("Non supported color mode");
                }
            }
        }
    }

I don’t use/own HA so I can’t do any experiments … I would assume that there must be a solution otherwise I would expect to see more of such reports here.

Is your bulb one that uses/supports different colors ?
If not does setting

"color_mode": true,

to

"color_mode": false,

at HA end helps ?

Could you use MQTT-explorer to capture the MQTT messages that are sent by HA ?

ah, thats interesting info indeed, my lights dont have color_mode anyway, i can just turn them on/off
Whit mqtt explorer i see indeed:


{
  "uniq_id": "mqtt_light.wasplaats",
  "name": "Wasplaats",
  "stat_t": "homeassistant/light/wasplaats/state",
  "avty_t": "homeassistant/light/wasplaats/availability",
  "cmd_t": "homeassistant/light/wasplaats/set_light",
  "schema": "json",
  "color_mode": true,
  "supported_color_modes": [
    "onoff"
  ]

Now need to find a a way to set it to false, because i dont have defined that anywhere in HA :slight_smile:
thnx for tip

ok, removed in mqtt everything about color, restarted Openhab, wasplaats was again discovered


{
  "uniq_id": "mqtt_light.wasplaats",
  "name": "Wasplaats",
  "stat_t": "homeassistant/light/wasplaats/state",
  "avty_t": "homeassistant/light/wasplaats/availability",
  "cmd_t": "homeassistant/light/wasplaats/set_light",
  "schema": "json"
}

2022-07-28 08:25:27.496 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'mqtt:homeassistant_mqtt_5Flight_2Ewasplaats:e94f1500bd:mqtt_5Flight_2Ewasplaats' to inbox.
2022-07-28 08:27:13.245 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '{"state": "ON"}' from channel 'mqtt:homeassistant_mqtt_5Flight_2Ewasplaats:e94f1500bd:mqtt_5Flight_2Ewasplaats:mqtt_5Flight_2Ewasplaats#light' not supported by type 'ColorValue': {"state": "ON"} is not a valid string syntax

But seems OpenHab is still expecting ColorValue , i dont understand why

Openhab is expecting 3 values here, but seems i only have 2

Below is being send by HA, but its not compatible with OpenHab, i need to make it compatible…
{"state": "ON", "color_mode": "onoff"}

any idea how the state should look like for OpenHab ?

EDIT: disregard that 3 , i also now tried adding an actual dimmer that has 3 values, bt still the same error:

2022-07-28 09:48:48.155 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '{"state": "ON", "brightness": 255, "color_mode": "brightness"}' from channel 'mqtt:homeassistant_mqtt_5Flight_2Edimmer1:e94f1500bd:mqtt_5Flight_2Edimmer1:mqtt_5Flight_2Edimmer1#light' not supported by type 'ColorValue': For input string: "{"state": "ON""

Not sure what Openhab is expecting in the lights domain