Shell1PM, Shelly Duo Bulb and MQTT

  • Platform information:

    • Hardware: RaspberryPI 4 4GB
    • OS: OpenHABian
      • openHAB version: 2.5.9
  • Issue of the topic: MTTQ config error with Shelly1PM and Duo Bulb have Tasmota switches set up the same way and working however the Shellies have the error below and will not work

    • Items configuration related to the issue
      //DuoBulb Entryway

Switch ShellyDuoBulb_EntrywayLight_Power “Entryway Light” {alexa=“Switchable”, channel=“mqtt:topic:Nomads_MQTT_Broker:Entryway-Light:power”}

String ShellyDuoBulb_EntrywayLight_Reachable “EntrywayLight_Reachable” {channel=“mqtt:topic:Nomads_MQTT_Broker:Entryway-Light:online”}

Things:
Thing topic ShellyDuoBulb_EntrywayLight “ShellyDuoBulb_EntrywayLight” @ “Nomads Rest” {

Channels:

Type string   : reachable  "Reachable" [stateTopic="shellies/Entryway-Light/online" ]

Type switch   : power "Power" [ stateTopic="shellies/Entryway-Light/light/0", on="on", off="off", commandTopic="shellies/Entryway-Light/light/0/command", on="ON", OFF="OFF" ]

}

  • If logs where generated please post these here using code fences:

    2020-09-24 12:07:26.867 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command ‘on’ not supported by type ‘OnOffValue’: No enum constant org.eclipse.smarthome.core.library.types.OnOffType.on

ON not on

Tried Both ways either has an error with on or and error with off

Cureent Thing:

Thing topic ShellyDuoBulb_EntrywayLight “ShellyDuoBulb_EntrywayLight” @ “Nomads Rest” {

Channels:

Type string   : reachable  "Reachable" [stateTopic="shellies/Entryway-Light/online" ]

Type switch   : power "Power" [ stateTopic="shellies/Entryway-Light/light/0", ON="ON", OFF="OFF", commandTopic="shellies/Entryway-Light/light/0/command", ON="ON", OFF="OFF" ]

}

Error is:
020-09-24 15:10:25.032 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command ‘off’ not supported by type ‘OnOffValue’: No enum constant org.eclipse.smarthome.core.library.types.OnOffType.off

You can’t define your on= and off= twice. One of them will be overridden. From your first example, change your channel to:

Type switch   : power "Power" [ stateTopic="shellies/Entryway-Light/light/0", on="on", off="off", commandTopic="shellies/Entryway-Light/light/0/command"]
2 Likes

Still get the same error

2020-09-25 12:35:10.320 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command ‘off’ not supported by type ‘OnOffValue’: No enum constant org.eclipse.smarthome.core.library.types.OnOffType.off

Your original configuration also has an error in your Item definitions. Your Thing is called

ShellyDuoBulb_EntrywayLight

But your Item calls out

Entryway-Light

Your other Item also has the same issue, and also calls out a Channel called online, whereas you’ve actually called your Channel reachable.

Are you sure you’re showing us the appropriate configurations? Can you show us more of the logs (events and openHAB) so we can see it’s actually this switch Item which is causing the issue?

Can you also show us the exact MQTT message that the device expects or sends (use code fences so that none of the punctuation marks (if any) are lost)? Have you used something like mqtt.fx or MQTT Explorer to verify what actually needs to be sent?

Hi,

Entryway-Light is what it is called in the MTTQ Broker

If I comment out the switch line for ShellyDuoBulb_EntrywayLight I don’t get the WARN error

020-09-25 16:20:19.580 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command ‘off’ not supported by type ‘OnOffValue’: No enum constant org.eclipse.smarthome.core.library.types.OnOffType.off

==> /var/log/openhab2/events.log <==

2020-09-25 16:20:37.822 [ome.event.ItemCommandEvent] - Item ‘ShellyDuoBulb_EntrywayLight_Power’ received command ON

2020-09-25 16:20:37.825 [nt.ItemStatePredictedEvent] - ShellyDuoBulb_EntrywayLight_Power predicted to become ON

2020-09-25 16:20:37.842 [vent.ItemStateChangedEvent] - ShellyDuoBulb_EntrywayLight_Power changed from OFF to ON

2020-09-25 16:20:38.928 [ome.event.ItemCommandEvent] - Item ‘ShellyDuoBulb_EntrywayLight_Power’ received command OFF

2020-09-25 16:20:38.933 [nt.ItemStatePredictedEvent] - ShellyDuoBulb_EntrywayLight_Power predicted to become OFF

2020-09-25 16:20:38.948 [vent.ItemStateChangedEvent] - ShellyDuoBulb_EntrywayLight_Power changed from ON to OFF

==> /var/log/openhab2/openhab.log <==

2020-09-25 16:20:49.591 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command ‘off’ not supported by type ‘OnOffValue’: No enum constant org.eclipse.smarthome.core.library.types.OnOffType.off

…and that’s what you’ve defined in your Channel stateTopic and commandTopic, which is correct.

However, your openHAB Thing is called

ShellyDuoBulb_EntrywayLight

and your openHAB Item should only call on openHAB Things. Your Item should be:

Switch ShellyDuoBulb_EntrywayLight_Power "Entryway Light" {channel="mqtt:topic:Nomads_MQTT_Broker:ShellyDuoBulb_EntrywayLight:power"}

I think the problem you are having is that sometimes small edits to Things files are not being stored properly by openHAB - I’ve just tried to re-create your issue, and I get the same problem (I’m on OH 2.5.9). To fix this, you can either just restart openHAB, or corrupt your Things file and save it so that all your Things are unloaded, then un-corrupt your things file and re-save it. By ‘corrupt’, I meant take out a { or an important word such as Thing.

I have got it all working with the following setup (adjusted to your original OP):

things

Thing topic ShellyDuoBulb_EntrywayLight "ShellyDuoBulb_EntrywayLight"  {

Channels:
    Type string:reachable  "Reachable" [
        stateTopic="shellies/Entryway-Light/online"
        ]

    Type switch:power "Power" [ 
        stateTopic="shellies/Entryway-Light/light/0", 
        commandTopic="shellies/Entryway-Light/light/0/command",
        on="on",
        off="off"
        ]
}

items

Switch ShellyDuoBulb_EntrywayLight_Power "Entryway Light" {alexa="Switchable", channel="mqtt:topic:Nomads_MQTT_Broker:ShellyDuoBulb_EntrywayLight:power"}
String ShellyDuoBulb_EntrywayLight_Reachable "EntrywayLight_Reachable" {channel="mqtt:topic:Nomads_MQTT_Broker:ShellyDuoBulb_EntrywayLight:reachable"}

Sending

on

or

off

to

shellies/Entryway-Light/light/0

Now causes the Item ShellyDuoBulb_EntrywayLight_Power to switch on or off.


For completeness, my test setup is slightly different, because I use a separate Things file for my MQTT broker definition. I also don’t have Alexa. Here is what I actually used.

bridge.things

Bridge mqtt:broker:MosquittoMqttBroker "Mosquitto MQTT Broker" [
	host="192.168.1.92",
	secure=false,
	port=1883,
	clientID="OpenHAB2",
	username="",
	password=""
]

test.things

Thing mqtt:topic:ShellyDuoBulb_EntrywayLight "ShellyDuoBulb_EntrywayLight" (mqtt:broker:MosquittoMqttBroker) {
    Channels:
        Type string:reachable  "Reachable" [
            stateTopic="shellies/Entryway-Light/online"
            ]

        Type switch:power "Power" [ 
            stateTopic="shellies/Entryway-Light/light/0", 
            commandTopic="shellies/Entryway-Light/light/0/command",
            on="on",
            off="off"
            ]
}

test.items

Switch ShellyDuoBulb_EntrywayLight_Power "Entryway Light" {channel="mqtt:topic:ShellyDuoBulb_EntrywayLight:power"}
String ShellyDuoBulb_EntrywayLight_Reachable "EntrywayLight_Reachable" {channel="mqtt:topic:ShellyDuoBulb_EntrywayLight:reachable"}

Excellent

That Works

Many Thanks for your assistance