Tasmota device - Not showing a Tasmota switch (no relay) in the integration

This device is not showing a switch I configured on the device. I would like it to show as a sensor.
I have created it in HA via MQTT template but feel I should not have to?

  - platform: mqtt
    name: "Coffeemaker"
    unique_id: kitchenaid_coffee_brewing
    icon: mdi:coffeemaker-outline
    state_topic: "tele/coffeemaker/SENSOR"
    value_template: '{{ "Idle" if value_json.Switch1 == "OFF" else "Brewing" }}'
    availability_topic: "tele/coffeemaker/LWT"
    payload_available: "Online"
    payload_not_available: "Offline"
    qos: 1

My goal is to have a switch associated with a relay pin to trigger brewing, and this currently seems to work. But I want another “sensor” pin that is driven high/low by the brewing LED. Currently, if I pull D2/GPIO4 low, the MQTT sensor shows idle, and brewing when not pulled low, but I am not seeing this entity in the HA Tasmota integration. What am I doing wrong?

Additional info:
image
Template:
{"NAME":"KitchenAid","GPIO":[1,1,1,1,160,225,1,1,1,1,161,1,1,1],"FLAG":0,"BASE":18}

Do you get your sensor value if you set values for tele/coffeemaker/SENSOR in developers tool Template and try your

value_template: '{{ "Idle" if value_json.Switch1 == "OFF" else "Brewing" }}'

I have to congratulate you on providing so much info in your initial query. :+1:

1 Like

Yes, the MQTT sensor is working but I believe I should not have to that. I was under the impression that it would create the sensor, like it does for this device…

Thanks! I believe it’s better to give as much info initially than to keep feeding it piece-meal as others beg and plead for it!

1 Like

Have you tried it this way in yaml. platform: mqtt is depracated under the senor:.

mqtt:
  sensor:
    - name: "Coffeemaker"
      unique_id: kitchenaid_coffee_brewing
      icon: mdi:coffeemaker-outline
      state_topic: "tele/coffeemaker/SENSOR"
      value_template: '{{ "Idle" if value_json.Switch1 == "OFF" else "Brewing" }}'
      availability_topic: "tele/coffeemaker/LWT"
      payload_available: "Online"
      payload_not_available: "Offline"
      qos: 1

The templated sensor I have is working…

Some people have been running foul of setoption 19 ommunity.home-assistant.io/t/tasmota-devices-using-mqtt-or-tasmota-integration-setoption19-devices-migrate-between-platforms/440404

1 Like

image
image

I converted MQTT sensors from legacy to modern but no change in what I see in the Tasmota integration for this device. If I add a relay to that switch then the switch shows up in the integration with on/off controls but that is not what I want. I just want a sensor to display the state of the switch, which MQTT gives me. Is this not possible?

It does not appear possible to achieve what I want without adding a relay to ESP8266 Tasmota to match the switch. This would require then adding a sensor to HA based on the state of the switch to achieve what I want. 60/40 as to which is easier…

I think you are right that mqtt wont allow the complicated stuff. Set the simple sensor in Mqtt
value_template: ‘{{ value_json.Switch1 }}’

and do the more complicated value_template to the sensor you made under mqtt “coffeemaker” under the platform: template

	--------
- platform: template
    sensors:
      usefulcoffeemaker:
        friendly_name: usefulcoffee maker
        value_template: >
            {{ states('sensor.coffeemaker')more complicated stuff that mqtt sensor can't use }}

I had to use platform: template yesterday for one temp sensor in tasmota that needed value offset without affecting the other temp sensors

Thank you for your feedback but I’m afraid you’re still not getting it. The MQTT sensor I have is fine!


image

Rather than having to manually create a MQTT sensor though, I am trying to get it to show under the Tasmota auto discovered device as a sensor, not a switch. I can get a switch if I add a relay to the switch in the Tasmota configuration on the device, but I don’t want that. I just want a sensor…

Like this…

Again, I’m not sure it’s possible using Generic template in tasmota…

Sorry for the misunderstanding. I don’t think you can create the sensor in Tasmota even with rules. Have you considered ESPHOME. You can setup the pin as a binary sensor. Good Luck.

1 Like

I would try try that except Tasmota integration is now showing it at all…


I’ll check out ESPHome. I’ve dabbled a little with it…

Time to start researching how ESPHome works I guess. This is the only clue I have to work from:

This helps…
image

Well that wasn’t as hard as I thought it would be!

Ungrounding D5 turns on the sensor…

image

esphome:
  name: coffeemaker

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "<redacted>"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Coffeemaker Fallback Hotspot"
    password: "<redacted>"

captive_portal:
    
binary_sensor:
  - platform: gpio
    pin: 
      number: GPIO14    #D5
      mode: INPUT_PULLUP
#      inverted: True
    name: "Coffeemaker Status"
#    entity_category: config
    id: coffeemaker_status
    
# Example configuration entry
output:
  - platform: gpio
    pin: GPIO12   #D6
    id: output1

button:
  - platform: output
    name: "Make Coffee"
    output: output1
    duration: 1s

#switch:
#  - platform: gpio
#    pin: 
#      number: GPIO12   #D6
#    id: relay
#    inverted: true
#    name: "Coffeemaker On/Off"
#    icon: mdi:coffee-maker
#    on_turn_on:
#    - delay: 500ms
#    - switch.turn_off: relay

*** Update

Now I just have to disassemble my KitchenAid Coffeemaker, remove the Sonoff inching relay w/120V:5V transformer and install this ESP8266 module with an additional connection to the power/brewing status LED.

Question: can I power the module via the 5V/GND pins instead of the USB connector???

1 Like

Thanks, I found answer here.

Thanks! I had done it this way but your way makes better sense as the icon is everywhere then!

I added it, deleted the integration & re-added it and the icon says mdi-coffee-maker but the UI is not showing it…

binary_sensor:
  - platform: gpio
    pin: 
      number: GPIO14    #D5
      mode: INPUT_PULLUP
    name: "Coffeemaker Status"
    id: coffeemaker_status
    icon: mdi:coffee-maker

Shift-reloading the browser doesn’t help…

image

image

image