Sonoff Tasmota MQTT problem

I check this forum and read but not find solution. If i turn on switch in hass , after some sec it turned off. This is Sonoff SV with 2 relays and ds18b20. Temperature working ok.
From console : 08:53:27 MQT: sonoff/tele/STATE = {“Time”:“2019-09-03T08:53:27”,“Uptime”:“0T10:05:15”,“Heap”:14,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:19,“POWER1”:“OFF”,“POWER2”:“OFF”,…
and for temperature : 09:08:28 MQT: sonoff/tele/SENSOR = {“Time”:“2019-09-03T09:08:28”,“DS18B20”:{“Temperature”:21.1},“TempUnit”:“C”}
Hass.io MQTT server working.
configuration.yaml
https://pastebin.com/qy312gEg

He is one of my MQTT switches

#=======================================================================
#
#=======================================================================    
  - platform: mqtt
    name: "Lava Lamp"
    state_topic: "stat/Tv-Lava/POWER"
    command_topic: "cmnd/Tv-Lava/POWER"
    payload_on: "ON"
    payload_off: "OFF"
    optimistic: false
    qos: 0
#=======================================================================

the console

image

now something with temperature

image

its consloe

#=======================================================================
#
#=======================================================================
  - platform: mqtt
    name: "Garage Temperature"
    state_topic: "tele/GarageDoor/SENSOR"
    value_template: "{{value_json['DHT11'].Temperature }}"
    unit_of_measurement: "°C"
#=======================================================================
#
#=======================================================================
  - platform: mqtt
    name: "Garage Humidity"
    state_topic: "tele/GarageDoor/SENSOR"
    value_template: "{{value_json['DHT11'].Humidity }}"
    unit_of_measurement: "%"
#=======================================================================
#
#=======================================================================

hope this helps
see clear as mud

1 Like

Mqtt working perfect. If i turn switch in lovelace hass.io on, sonoff turns on. After some seconds switch in lovelace turned off but in sonoff swich stays on.
Sorry my english.

switch:

  • platform: mqtt
    name: “Kurkla uks”
    state_topic: “sonoff/tele/RESULT”
    command_topic: “cmnd/sonoff/POWER1”
    payload_on: “ON”
    payload_off: “OFF”
    state_on: “ON”
    state_off: “OFF”
    optimistic: false
    qos: 0
  • platform: mqtt
    name: “Kurkla kastmine”
    state_topic: “sonoff/tele/RESULT”
    command_topic: “cmnd/sonoff/POWER2”
    payload_on: “ON”
    payload_off: “OFF”
    state_on: “ON”
    state_off: “OFF”
    optimistic: false
    qos: 0

Should be

state_topic: “stat/sonoff/POWER1”

This is not possible but working. :slight_smile: Many thanks. Some beers from me.
Question 2. How to turn off POWER2 after 120 seconds if i turn it on. This switch for greenhouse watering valve. Watering cucumbers. Some time i forget turn it off.
Entity : switch.kurkla_kastmine

The easiest way to do this is to set a pulsetime in the Tasmota console.

You also create an automation in home assistant to turn off the switch after a certain time.

OK.
I check how to do this.

Try typing ‘pulsetime2 220’ in the Tasmota console window

I need this delay 120sec for POWER2 only.

I don’t have a dual switch but according to the documentation, pulsetime2 should be for power2

You need to type the following in the console for 120 seconds

Pulsetime2 220

1 Like

This may be useful if you want to try to do this in home assistant.

I try this and test. Thanks. This working.
Then second question. :slight_smile:
First relay in greenhouse open door. Today this working from Fibaro. Open door by time. This is not good choice. For temp i connect ds18b20 to Sonoff SV… Relay turn on and door open. If relay turn off door close. I need open door by temeperature. If in greenhouse temperature +24, relay turn on and door open. If temperature +22 relay turned off and door closed. Something like thermostat.

You can configure a generic thermostat in home assistant. It’s fairly simple. You just need to configure a switch and temp sensor in the config.

climate:

  • platform: generic_thermostat
    name: Kurkla
    cooler: switch.kurkla_uks # relay what open door. Not need switch off when open. If switch this relay off then door closes.
    target_sensor: sensor.kurkla_temp
    target_temp: 23

I need : if temp >23 : sensor.kurkla_temp
switch on : switch.kurkla_uks
and
if temp <22
switch off : switch.kurkla_uks

There is an option to set the generic thermostat as a cooler, used for air conditioning, etc. It should then work the way you want.

1 Like

please format your code make it easyer to read

platform: generic_thermostat
name: Kurkla
cooler: switch.kurkla_uks # relay what open door. Not need switch off when open. If switch this relay off then door closes.
target_sensor: sensor.kurkla_temp
target_temp: 23

see that look beater a

now here is mine Office Temperature Climate control

  - platform: generic_thermostat
    name: "Office Temperature"
    heater: switch.office_fan
    target_sensor: sensor.office_temperature
    min_temp: 15
    max_temp: 30
    ac_mode: true
    target_temp: 24
    cold_tolerance: 1.5
    hot_tolerance: 1.5
    initial_hvac_mode: "off"
    away_temp: 16

the tick is with the

    cold_tolerance: 1.5
    hot_tolerance: 1.5

and the

initial_hvac_mode: "off"

Thank you. I try. How this working. Outdoor temp is only +13 today. Greenhouse is empty. Next year again.

  • platform: generic_thermostat
    name: “Kurkla”
    cooler: switch.kurkla_uks
    target_sensor: sensor.kurkla_temp
    target_temp: 23

This opens door but not close. I set target temp 13 degrees. At the moment outdoor temp is +10.