I found this item from @Elch2000 with a temporary solution for using a Sonof T1 as rollershutter. Problems MQTT2 Sonoff T1 with Tasmota Fork
I try to use his solution but i am not able to get it working.
I created a new openhabian install on a RPi2 with Mosquitto and tested this with one of my Sonoff S20 devices and this is working OK.
(I know the current MQTT Binding has a bug with the STOP command. We are all waiting for the solution for that.) But there seems to be a solution using a Dimmer item for this…
I have 2 Teepao and 2 Sonoff TX (T1) 2-gang switches for my screens.
The Teepao switches i flashed with Stefan Bodes fork of Tasmota. The Sonoff TX switches still have to be flashed.
From the Tasmota Console as well as from the command prompt on the RPi i am able to switch the switches UP, Down and STOP.
$ mosquitto_pub -d -h 192.168.178.241 -t cmnd/Screen_2/POWER1 -u openhab -P ******* -m ON
$ mosquitto_pub -d -h 192.168.178.241 -t cmnd/Screen_2/POWER1 -u openhab -P ******* -m STOP
$ mosquitto_pub -d -h 192.168.178.241 -t cmnd/Screen_2/POWER1 -u openhab -P ******* -m OFF
$ mosquitto_pub -d -h 192.168.178.241 -t cmnd/Screen_2/POWER1 -u openhab -P ******* -m STOP
$ mosquitto_pub -d -h 192.168.178.241 -t cmnd/Screen_2/POWER2 -u openhab -P ******* -m ON
$ mosquitto_pub -d -h 192.168.178.241 -t cmnd/Screen_2/POWER2 -u openhab -P ******* -m OFF
$ mosquitto_pub -d -h 192.168.178.241 -t cmnd/Screen_2/POWER2 -u openhab -P ******* -m STOP
This works perfectly.
But I am having problems translating these commands to the correct Things and Item files. (I am using text-file configuration for openHAB, not the PaperUI.)
my mqtt-broker.things
// MQTT Broker Bridge en things definitions
//
Bridge mqtt:broker:mosquitto "Mosquitto MQTT Broker" @ "MQTT" [
host="192.168.178.241",
secure=false,
port=1883,
qos=0,
retain=false,
clientID="openHAB2",
//certificate="",
//certificatepin=false,
//publickey="",
//publickeypin=false,
keep_alive_time=30000,
reconnect_time=60000,
//lastwill_message="",
//lastwill_qos=1,
//lastwill_topic="",
username="openhab",
password="********"
]
{
//
Thing topic Sonoff_4S20 "Sonoff 4S20" (mqtt:broker:mosquitto) @ "Sonoff Tasmota" {
Channels:
Type switch : switch "Sonoff_4S20 WCD" [ stateTopic="Sonoff_4S20/POWER", commandTopic="cmnd/Sonoff_4S20/POWER", on="ON", off="OFF" ]
Type number : rssi "WiFi Signal Strength" [ stateTopic="tele/Sonoff_4S20/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
//
Type string : state01 "Sonoff_4S20 State" [ stateTopic="tele/Sonoff_4S20/STATE", transformationPattern="JSONPATH:$.POWER", on="ON", off="OFF" ]
//
Type string : devicestate "Device State" [ stateTopic="Sonoff_4S20/LWT" ]
}
// MQTT Binding heeft een fout voor de Rollershutter. Een work-around is gebruit een dimmer item:
// https://community.openhab.org/t/solved-problem-with-mqtt2-and-sonoff-t1-tasmota-forked/68984/3
// Teepao Testschakelaar 2 met Stefan Bode Fork
Thing topic Teepao-Screen_2 "Teepao Screen Switch 2" {
Type rollershutter : blinds "Screen_2" [ stateTopic="stat/Screen_2/SHUTTER1", commandTopic="cmnd/Screen_2/shutterposition" ]
}
}
My mqtt-screens.items file:
//Rollershutter Screen_2 "Teepao Screen 2" { channel="mqtt:topic:broker:Teepao-Screen_2:blinds" }
Dimmer Screen_2 "Teepao Screen 2" { channel="mqtt:topic:broker:Screen_2:blinds" }
Switch Screen_2_UP "Teepao Screen 2 Omhoog" { channel="mqtt:topic:mosquitto:Screen_2:state",
channel="mqtt:topic:mosquitto:Screen_2:switch" }
My mqtt-sonoff-s20.items file for the working Sonoff S20:
// Sonoff devices items file voor MQTT versie 2; 2019-04-22.
//
/*
<Functie WCD>. Sonoff_4S20 (Tasmota fw)
*/
Switch Sonoff_4S20_Switch "Sonoff_4S20 WCD" (SonoffPowerSwitches_S20, ChristmasNightLights) { channel="mqtt:topic:mosquitto:Sonoff_4S20:switch" }
String Sonoff_4S20_State "Sonoff_4S20 State" (SonoffPowerSwitches_S20) { channel="mqtt:topic:mosquitto:Sonoff_4S20:state01",
channel="mqtt:topic:mosquitto:Sonoff_4S20:state02",
channel="mqtt:topic:mosquitto:Sonoff_4S20:state03",
channel="mqtt:topic:mosquitto:Sonoff_4S20:switch" }
Number Sonoff_4S20_RSSI "WiFi Signal Strength [%d %%]" <wifi> (Sonoff_S20) { channel="mqtt:topic:mosquitto:Sonoff_4S20:rssi" }
//*
My test sitemap file:
sitemap testhome label="Mijn OH testomgeving"
{
Frame label="Test Sonoff en Teepao switches" {
Text item=CurrentDate
Switch item=Sonoff_4S20_Switch label="Sonoff 4 S20 WCD aan/uit" icon="light"
//Switch item=Sonoff_4S20 labelcolor=[S20_1_Reachable == "ON" = "green",S20_1_Reachable == "OFF" = "red"]
//
//Text item=Sonoff_4Uptime label="Sonoff 4 Uptime" icon="clock"
Text item=Sonoff_4S20_RSSI label="Wifi Signaal sterkte"
}
Frame label="Test met Teepao Switch" {
Switch item=Screen_2
Switch item=Screen_2_UP
}
}
Hopefully someone can help me to solve my issue…
Kind regards, Bert