Tasmota (Sonoff Pow R2) with autodiscovery create not all channels for sensors

I have a problem with Tasmota for the device Sonoff Pow R2. I use openHAB 2.5
If I want to use the homeassistant autodiscovery function many sensors will be displayed but after adding it only two channels are visible and I get many of this Warnings:

2020-01-09 10:33:28.068 [WARN ] [mqtt.homeassistant.internal.CFactory] - Not supported

java.lang.UnsupportedOperationException: Component:Sensor does not support forced updates

	at org.openhab.binding.mqtt.homeassistant.internal.ComponentSensor.<init>(ComponentSensor.java:48) ~[?:?]

	at org.openhab.binding.mqtt.homeassistant.internal.CFactory.createComponent(CFactory.java:70) ~[?:?]

	at org.openhab.binding.mqtt.homeassistant.internal.DiscoverComponents.processMessage(DiscoverComponents.java:96) ~[?:?]

	at org.eclipse.smarthome.io.transport.mqtt.internal.ClientCallback.lambda$3(ClientCallback.java:96) ~[?:?]

	at java.util.ArrayList.forEach(ArrayList.java:1257) ~[?:1.8.0_152]

	at org.eclipse.smarthome.io.transport.mqtt.internal.ClientCallback.messageArrived(ClientCallback.java:96) ~[?:?]

	at org.eclipse.smarthome.io.transport.mqtt.internal.ClientCallback.messageArrived(ClientCallback.java:71) ~[?:?]

	at com.hivemq.client.internal.mqtt.mqtt3.Mqtt3AsyncClientView.lambda$callbackView$1(Mqtt3AsyncClientView.java:73) ~[bundleFile:?]

	at com.hivemq.client.internal.mqtt.MqttAsyncClient$CallbackSubscriber.onNext(MqttAsyncClient.java:227) [bundleFile:?]

	at com.hivemq.client.internal.mqtt.MqttAsyncClient$CallbackSubscriber.onNext(MqttAsyncClient.java:212) [bundleFile:?]

	at com.hivemq.client.rx.FlowableWithSingle$SingleFutureSubscriber.onNext(FlowableWithSingle.java:377) [bundleFile:?]

	at com.hivemq.client.internal.rx.operators.FlowableWithSingleCombine$SplitSubscriber$Default.tryOnNextActual(FlowableWithSingleCombine.java:206) [bundleFile:?]

	at com.hivemq.client.internal.rx.operators.FlowableWithSingleCombine$SplitSubscriber.tryOnNext(FlowableWithSingleCombine.java:171) [bundleFile:?]

	at io.reactivex.internal.operators.flowable.FlowableObserveOn$ObserveOnConditionalSubscriber.runAsync(FlowableObserveOn.java:649) [bundleFile:?]

	at io.reactivex.internal.operators.flowable.FlowableObserveOn$BaseObserveOnSubscriber.run(FlowableObserveOn.java:176) [bundleFile:?]

	at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66) [bundleFile:?]

	at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57) [bundleFile:?]

	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_152]

	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_152]

	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:1.8.0_152]

	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_152]

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_152]

	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_152]

I can Power on and power off the device. The second channel has the name Button1 and is a switch but a sensor.

Try stopping OH, cleaning the cache and rebooting.

sudo systemctl stop openhab2

sudo openhab-cli clean-cache

sudo systemctl start openhab2 or sudo reboot

Also, please show your item configuration.

Unfortunately this does not help:

I have no item configuration because I used the autodiscovery feature via PaperUI to find the Tasmota Device but there are missing channels. So I can not create an item for this channel to get the current usage of power

But I fetched via curl the thing configuration (I anonymized the MAC-Address):

{
  "statusInfo": {
    "status": "ONLINE",
    "statusDetail": "NONE"
  },
  "editable": true,
  "label": "Sonoff Pow R2 1 (Sensor, Sensor, Sensor, Sensor, Sensor, Sensor, Sensor, Switch, Sensor, Sensor, Sensor, Sensor, Sensor)",
  "bridgeUID": "mqtt:systemBroker:Broker1",
  "configuration": {
    "topics": [
      "sensor/B81E92_ENERGY_TotalStartTime",
      "sensor/B81E92_ENERGY_ApparentPower",
      "sensor/B81E92_ENERGY_Yesterday",
      "binary_sensor/B81E92_BTN_1",
      "sensor/B81E92_ENERGY_Factor",
      "sensor/B81E92_ENERGY_Today",
      "sensor/B81E92_ENERGY_Power",
      "sensor/B81E92_ENERGY_Current",
      "sensor/B81E92_ENERGY_Voltage",
      "switch/B81E92_RL_1",
      "sensor/B81E92_status",
      "sensor/B81E92_ENERGY_Total",
      "sensor/B81E92_ENERGY_ReactivePower"
    ],
    "basetopic": "homeassistant"
  },
  "properties": {
    "firmwareVersion": "8.1.0(tasmota)",
    "modelId": "Sonoff Pow R2",
    "vendor": "Tasmota"
  },
  "UID": "mqtt:homeassistant_B81E92:Broker1:B81E92",
  "thingTypeUID": "mqtt:homeassistant_B81E92",
  "channels": [
    {
      "linkedItems": [
        "SonoffPowR21_B81E92_5FBTN_5F1_SonoffPowR21Button1"
      ],
      "uid": "mqtt:homeassistant_B81E92:Broker1:B81E92:B81E92_5FBTN_5F1#sensor",
      "id": "B81E92_5FBTN_5F1#sensor",
      "channelTypeUID": "mqtt:B81E92_5FBTN_5F1_sensor",
      "itemType": "Switch",
      "kind": "STATE",
      "label": "Sonoff Pow R2 1 Button1",
      "defaultTags": [],
      "properties": {},
      "configuration": {
        "component": "binary_sensor",
        "config": "{\"name\":\"Sonoff Pow R2 1 Button1\",\"stat_t\":\"~stat/BUTTON1\",\"avty_t\":\"~tele/LWT\",\"pl_avail\":\"Online\",\"pl_not_avail\":\"Offline\",\"uniq_id\":\"B81E92_BTN_1\",\"device\":{\"identifiers\":[\"B81E92\"],\"connections\":[[\"mac\",\"AB:CD:12:34:56:78\"]]},\"~\":\"sonoff_pow_r2_1/\",\"value_template\":\"{{value_json.STATE}}\",\"pl_on\":\"TOGGLE\",\"off_delay\":1}",
        "nodeid": "",
        "objectid": "B81E92_BTN_1"
      }
    },
    {
      "linkedItems": [
        "SonoffPowR21_B81E92_5FRL_5F1_SonoffPowR21"
      ],
      "uid": "mqtt:homeassistant_B81E92:Broker1:B81E92:B81E92_5FRL_5F1#switch",
      "id": "B81E92_5FRL_5F1#switch",
      "channelTypeUID": "mqtt:B81E92_5FRL_5F1_switch",
      "itemType": "Switch",
      "kind": "STATE",
      "label": "Sonoff Pow R2 1",
      "defaultTags": [],
      "properties": {},
      "configuration": {
        "component": "switch",
        "config": "{\"name\":\"Sonoff Pow R2 1\",\"cmd_t\":\"~cmnd/POWER\",\"stat_t\":\"~tele/STATE\",\"val_tpl\":\"{{value_json.POWER}}\",\"pl_off\":\"OFF\",\"pl_on\":\"ON\",\"avty_t\":\"~tele/LWT\",\"pl_avail\":\"Online\",\"pl_not_avail\":\"Offline\",\"uniq_id\":\"B81E92_RL_1\",\"device\":{\"identifiers\":[\"B81E92\"],\"connections\":[[\"mac\",\"AB:CD:12:34:56:78\"]]},\"~\":\"sonoff_pow_r2_1/\"}",
        "nodeid": "",
        "objectid": "B81E92_RL_1"
      }
    }
  ]
}

I get the same java error when adding my sensor from Inbox as item (and afterwards have no channels and it immediatly goes to “offline gone”).

In case it helps and someone know what “forced updates” means, here the output from the tasmota:

12:05:37 MQT: homeassistant/switch/0BDDEE_RL_1/config = (retained)
12:05:37 MQT: homeassistant/light/0BDDEE_LI_1/config = (retained)
12:05:37 MQT: homeassistant/switch/0BDDEE_RL_2/config = (retained)
12:05:37 MQT: homeassistant/light/0BDDEE_LI_2/config = (retained)
12:05:37 MQT: homeassistant/switch/0BDDEE_RL_3/config = (retained)
12:05:37 MQT: homeassistant/light/0BDDEE_LI_3/config = (retained)
12:05:37 MQT: homeassistant/switch/0BDDEE_RL_4/config = (retained)
12:05:37 MQT: homeassistant/light/0BDDEE_LI_4/config = (retained)
12:05:37 MQT: homeassistant/switch/0BDDEE_RL_5/config = (retained)
12:05:37 MQT: homeassistant/light/0BDDEE_LI_5/config = (retained)
12:05:37 MQT: homeassistant/switch/0BDDEE_RL_6/config = (retained)
12:05:37 MQT: homeassistant/light/0BDDEE_LI_6/config = (retained)
12:05:37 MQT: homeassistant/switch/0BDDEE_RL_7/config = (retained)
12:05:37 MQT: homeassistant/light/0BDDEE_LI_7/config = (retained)
12:05:37 MQT: homeassistant/switch/0BDDEE_RL_8/config = (retained)
12:05:37 MQT: homeassistant/light/0BDDEE_LI_8/config = (retained)
12:05:37 MQT: homeassistant/binary_sensor/0BDDEE_BTN_1/config = (retained)
12:05:37 MQT: homeassistant/binary_sensor/0BDDEE_BTN_2/config = (retained)
12:05:37 MQT: homeassistant/binary_sensor/0BDDEE_BTN_3/config = (retained)
12:05:37 MQT: homeassistant/binary_sensor/0BDDEE_BTN_4/config = (retained)
12:05:37 MQT: homeassistant/binary_sensor/0BDDEE_SW_1/config = (retained)
12:05:37 MQT: homeassistant/binary_sensor/0BDDEE_SW_2/config = (retained)
12:05:37 MQT: homeassistant/binary_sensor/0BDDEE_SW_3/config = (retained)
12:05:37 MQT: homeassistant/binary_sensor/0BDDEE_SW_4/config = (retained)
12:05:37 MQT: homeassistant/binary_sensor/0BDDEE_SW_5/config = (retained)
12:05:37 MQT: homeassistant/binary_sensor/0BDDEE_SW_6/config = (retained)
12:05:37 MQT: homeassistant/binary_sensor/0BDDEE_SW_7/config = (retained)
12:05:37 MQT: homeassistant/binary_sensor/0BDDEE_SW_8/config = (retained)
12:05:37 MQT: homeassistant/sensor/0BDDEE_BME280_Temperature/config = {“name”:“Tasmota BME280 Temperature”,“stat_t”:“~SENSOR”,“avty_t”:“~LWT”,“frc_upd”:true,“pl_avail”:“Online”,“pl_not_avail”:“Offline”,“uniq_id”:“0BDDEE_BME280_Temperature”,“device”:{“identifiers”:[“0BDDEE”],“connections”:[[“mac”,“60:01:94:0B:DD:EE”]]},“~”:“tasmota/tele/”,“unit_of_meas”:“°C”,“val_tpl”:“{{value_json[‘BME280’].Temperature}}”,“dev_cla”:“temperature”} (retained)
12:05:37 MQT: homeassistant/sensor/0BDDEE_BME280_Humidity/config = {“name”:“Tasmota BME280 Humidity”,“stat_t”:“~SENSOR”,“avty_t”:“~LWT”,“frc_upd”:true,“pl_avail”:“Online”,“pl_not_avail”:“Offline”,“uniq_id”:“0BDDEE_BME280_Humidity”,“device”:{“identifiers”:[“0BDDEE”],“connections”:[[“mac”,“60:01:94:0B:DD:EE”]]},“~”:“tasmota/tele/”,“unit_of_meas”:“%”,“val_tpl”:“{{value_json[‘BME280’].Humidity}}”,“dev_cla”:“humidity”} (retained)
12:05:37 MQT: homeassistant/sensor/0BDDEE_BME280_Pressure/config = {“name”:“Tasmota BME280 Pressure”,“stat_t”:“~SENSOR”,“avty_t”:“~LWT”,“frc_upd”:true,“pl_avail”:“Online”,“pl_not_avail”:“Offline”,“uniq_id”:“0BDDEE_BME280_Pressure”,“device”:{“identifiers”:[“0BDDEE”],“connections”:[[“mac”,“60:01:94:0B:DD:EE”]]},“~”:“tasmota/tele/”,“unit_of_meas”:“hPa”,“val_tpl”:“{{value_json[‘BME280’].Pressure}}”,“dev_cla”:“pressure”} (retained)
12:05:37 MQT: homeassistant/sensor/0BDDEE_status/config = {“name”:“Tasmota status”,“stat_t”:“~HASS_STATE”,“avty_t”:“~LWT”,“frc_upd”:true,“pl_avail”:“Online”,“pl_not_avail”:“Offline”,“json_attributes_topic”:“~HASS_STATE”,“unit_of_meas”:" “,“val_tpl”:”{{value_json[‘RSSI’]}}“,“ic”:“mdi:information-outline”,“uniq_id”:“0BDDEE_status”,“device”:{“identifiers”:[“0BDDEE”],“connections”:[[“mac”,“60:01:94:0B:DD:EE”]],“name”:“Tasmota”,“model”:“Generic”,“sw_version”:“8.1.0(tasmota)”,“manufacturer”:“Tasmota”},”~":“tasmota/tele/”} (retained)
12:05:43 MQT: tasmota/tele/STATE = {“Time”:“2020-01-12T12:05:43”,“Uptime”:“0T01:26:12”,“UptimeSec”:5172,“Heap”:27,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:19,“MqttCount”:1,“Wifi”:{“AP”:1,“SSId”:“ZIWA”,“BSSId”:“B0:4E:26:F6:7D:4C”,“Channel”:10,“RSSI”:30,“Signal”:-85,“LinkCount”:1,“Downtime”:“0T00:00:06”}}
12:05:43 MQT: tasmota/tele/SENSOR = {“Time”:“2020-01-12T12:05:43”,“BME280”:{“Temperature”:28.8,“Humidity”:56.0,“Pressure”:853.2},“PressureUnit”:“hPa”,“TempUnit”:“C”}
12:06:04 MQT: tasmota/tele/HASS_STATE = {“Version”:“8.1.0(tasmota)”,“BuildDateTime”:“2019-12-25T12:33:25”,“Core”:“2_6_1”,“SDK”:“2.2.2-dev(38a443e)”,“Module”:“Generic”,“RestartReason”:“External System”,“Uptime”:“0T01:26:33”,“WiFi LinkCount”:1,“WiFi Downtime”:“0T00:00:06”,“MqttCount”:1,“BootCount”:30,“SaveCount”:52,“IPAddress”:“192.168.100.127”,“RSSI”:“30”,“LoadAvg”:19}
12:06:13 MQT: tasmota/tele/STATE = {“Time”:“2020-01-12T12:06:13”,“Uptime”:“0T01:26:42”,“UptimeSec”:5202,“Heap”:27,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:19,“MqttCount”:1,“Wifi”:{“AP”:1,“SSId”:“ZIWA”,“BSSId”:“B0:4E:26:F6:7D:4C”,“Channel”:10,“RSSI”:30,“Signal”:-85,“LinkCount”:1,“Downtime”:“0T00:00:06”}}
12:06:13 MQT: tasmota/tele/SENSOR = {“Time”:“2020-01-12T12:06:13”,“BME280”:{“Temperature”:28.8,“Humidity”:55.7,“Pressure”:853.1},“PressureUnit”:“hPa”,“TempUnit”:“C”}

There was a related thread about this issue that I’ve since seen more persistently with my own install of Sonoff (Tasmota flashed) units.

EDIT: just saw you posted in that thread as well.

I’ve been digging into it a bit more tonight and it looks like it’s to do with how the homeassistant binding handles the forced update value.

If you have a look at the MQTT home assistant config data using MQTT explorer or similar, it looks like Tasmota flags frc_upd as true for the switch state sensor - which the openhab home assistant binding doesn’t support.

ie: MQTT /homeassistant/sensor/_status/config
{
“name”:“Dining Room Light status”,
“stat_t”:“~HASS_STATE”,
“avty_t”:“~LWT”,
“frc_upd”:true,
“pl_avail”:“Online”,
“pl_not_avail”:“Offline”,
“json_attributes_topic”:“~HASS_STATE”,
“unit_of_meas”:" “,
“val_tpl”:”{{value_json[‘RSSI’]}}“,
“ic”:“mdi:information-outline”,
“uniq_id”:”_status",
“device”:{“identifiers”:[“”],
“connections”:[[“mac”,]],
“name”:“Dining Room Light”,
“model”:“Sonoff Mini”,
“sw_version”:“8.1.0(tasmota)”,
“manufacturer”:“Tasmota”},
“~”:“tasmota-/tele/”
}

Tasmota source is setting it to true - lines 45 & 67.

OpenHAB HomeAssistant Binding - ComponentSensor class:

Line 50
if (channelConfiguration.force_update) {
throw new UnsupportedOperationException(“Component:Sensor does not support forced updates”);
}

I believe I’ve seen some comments that the old v6 something release of tasmota didn’t have the issue and it was probably prior to them changing it to forced_update = true, but I suspect the OH homeassistant binding probably needs updating.

I thought I read somewhere this was fixed with 2.5.5 but i still get the same error.

    7:45:18.165 [WARN ] [.mqtt.homeassistant.internal.CFactory] - Not supported
java.lang.UnsupportedOperationException: Component:Sensor does not support forced updates

And channels are nor created.

Anyone know anything ?

force_upade vs frc_upd

I could not find anything where it comes from and i dont know if that is a change in homeassistant convention or in tasmota (i dont use homeassistant but openhab)

What i can say is that in tasmota this flag in 8.3.1 is send as frc_upd and it seems the openhab implementation of homeassistant expects force_update.

I was able to get channels autodetected when changing manuallz the config statement on mqtt:

my example:

Topic: homeassistant/sensor/0BDDEE_BME280_Temperature/config
Original Tasmota (channel not autodiscovered by OH):
{"name":"MyS1 BME280 Temperature","stat_t":"tele/tasmota2_0BDDEE/SENSOR","avty_t":"tele/tasmota2_0BDDEE/LWT","pl_avail":"Online","pl_not_avail":"Offline","uniq_id":"0BDDEE_BME280_Temperature","dev":{"ids":["0BDDEE"]},"unit_of_meas":"°C","dev_cla":"temperature","frc_upd":true,"val_tpl":"{{value_json['BME280']['Temperature']}}"}

Manually changed frc_upd to force_update (OH autodetects correctly):
{"name":"MyS1 BME280 Temperature","stat_t":"tele/tasmota2_0BDDEE/SENSOR","avty_t":"tele/tasmota2_0BDDEE/LWT","pl_avail":"Online","pl_not_avail":"Offline","uniq_id":"0BDDEE_BME280_Temperature","dev":{"ids":["0BDDEE"]},"unit_of_meas":"°C","dev_cla":"temperature","force_upade":true,"val_tpl":"{{value_json['BME280']['Temperature']}}"}

I opened a ticket for it here