On Paper UI, “Custom On/Open Value” field put this: { “dps”: “1”, “set”: “1” }
On “Off” field, this: { “dps”: “1”, “set”: “2” }
It worked for me during a while, now I simply can’t have MQTT communication and I don’t know why!
On Paper UI, “Custom On/Open Value” field put this: { “dps”: “1”, “set”: “1” }
On “Off” field, this: { “dps”: “1”, “set”: “2” }
It worked for me during a while, now I simply can’t have MQTT communication and I don’t know why!
I just opened a new thread for integrating tuya devices using tuya-mqtt (which has been completely rewritten by @tsightler within the last weeks). As he also modified parts of the underlaying tuyapi, I was able to get devices to work which didn’t work with tuyapi before…
I am trying this process with a bunch of door sensors I bought from Aliexpress. They have a XR809 chip instead of the ESP8466. Any chance it will work?
I was able to retrieve ID and KEY for the devices, and the tuya-mqtt.js script is running, but the item remains as NULL. Below are some snippets:
//Things
Bridge mqtt:broker:mosquitto [ host="localhost", secure=false, username="openhabian", password="XXXXXXXX" ]
{
Thing mqtt:topic:tuya "Tuya" {
Channels:
Type switch : GF_T_Hallway_Door "Hallway Door" [ stateTopic="tuya/lightbulb//<ID>/<KEY>/192.168.1.XXX/state", commandTopic="tuya/lightbulb/<ID>/<KEY>/192.168.1.XXX/command"]
Type switch : GF_T_Kitchen_Door "Kitchen Door" [ stateTopic="tuya/lightbulb/<ID>/<KEY>/192.168.1.XXX/state", commandTopic="tuya/lightbulb//<ID>/<KEY>/192.168.1.XXX/command"]
}
}
//Items
Switch GF_Hallway_Door "Hallway Door" (gSensor) {channel="mqtt:topic:tuya:GF_T_Hallway_Door" }
Did you try tuya/ver3.3/…?
Did you try tuya/ver3.3/…?
I tried today with both v3.3 and v3.1, but none worked. I am guessing I did something wrong in the tuya-mqtt
part.
When I use mosquitto_pub
to update the item it works perfectly, but apparently the device communication with Tuya cloud is not being intercepted.
No idea how to move on…
Well… the only thing I can recommend you is to try the new version of tuya-mqtt:
The author @tsightler rewrote almost everything and I was able to manage devices which I still can’t control with tuyapi… Especially as you already have the device id’s and keys, I think it’s worth a try…
If you need a small tutorial:
Nice tip, I will give it a try this weekend and let you guys know the outcome.
Thank you for the help.
Tuyaapi does not support sensors. At least not sensors which sleep the most time as door sensors.
Dear OH-community, i’m going to be crazy! couple of days on this problem:
I succeeded in integrating my Zemismart vertical shutter motor in openhab thanks to the AgentK binding, -I found my secret key etc …,
-I have configured my broker correctly,-configured my MQTT thing like this:
Dimmer Direction "Store sam" {channel="mqtt:topic:0f66ae51:direction"}
-and create a basic rule like this:
`rule “rule name”
when
Item Direction received command OFF
then
Direction.sendCommand(0)
end
rule “rule name”
when
Item Direction received command ON
then
Direction.sendCommand(100)
end`
-I noticed while running MQTT fix that the topics of my device were tuya / “name” / dps / 2 / state, this one returns a number value.
My problem is the following, when I activate my roller shutter via the tuya application, I see the change of values of my MQTT fix topic, on my sitemap I also see that the switch opens and closes, however I can’t send a shutter command from openhab to my roller shutter, what am I doing wrong with my rule?
i also tried this one reading the binding documentation
MQTT binding doc
`rule “Toggle Tuya light/switch on/off via MQTT”
when
Item Direction received command
then
val mqttActions = getActions(“mqtt”,“mqtt:systemBroker:embedded-mqtt-broker”)
switch(receivedCommand) {
case ON : mqttActions.publishMQTT("tuya/store_de_la_salle_a_manger/dps/2/state/","40",true)
case OFF : mqttActions.publishMQTT("tuya/store_de_la_salle_a_manger/dps/2/state/","100",true)
}
end`
Sorry for the layout firefox doesn’t help me
I did not understand how I run the test, can you explain?
to see if it installed it globally try out the command at the C:\ power shell prompt:
tuya-cli help
Solved like a dummy i check "is command " in the state status of the MQTT things, to trigger my roller shutter i use the “tuya/store_de_la_salle_a_manger/dps/2/command” set in like a dimmer
In the end I got it working. But it is terribly unreliable and requires several triggers on the sensor to result in a status update via MQTT. So I just gave up. As soon as I can I’ll replace the sensors with something that’s actually supported.
Is there any way to ping the device and check if it is online or not ? I have id and key, but can’t find topic which would trigger such action
EDIT:
Needed to restart tuya mqtt server and send command “get-states” to “tuya/< ID >/command” topic
Hey all,
Is this method still valid? cause I followed the step and installed Bluestack but Smarlife App keeps crashing when trying to enter any device inside the App in Bluestack. And I am not able to find the file where i can see the Keys of the devices noting that Bluestack is rooted properly.
Regards,
I have 2 smart sockets and 1 smart bulb added in Tuya app on my android phone, and this method still working great. I can control all of them in both Tuya app and openHAB-3.
You should try Tuya and get device’s ID from iot.tuya.com, then get key with tuya-cli wizard
try this tuya_mqtt : https://github.com/tsightler/tuya-mqtt
is this repository available somewhere?
Important…
If tuya-cli throws an error under the following condition (#1 - somethimes, #2 always):
- try shutting down you OpenHAB2 server before using the tuya-cli command
- Also, BE-AWARE that while you are using the tuya-cli command DON’T have the Smart Life App (or which ever Tuya Smart App you use) OPEN while you are running the tuya-cli command on your server (tuya-cli will definitely through an unhanded error). If you must you the APP, access it before running the tuya-cli then make sure you exit the APP (don’t leave it running in the background on your phone)
tuya-cli help or to find info on your plug: tuya-cli get --id <Virtual-id> --key <localkey> --<ip-address> --all
I have a problem with the tuya-cli get command.
It returns: “undefined”
tuya-cli get --ip 192.168.1.193 --id bf5dda5b30a1xxxxxxxxxx --key 69c46byyyyyyyyyyy
undefined
Any hints? run under win10. I will add that during the polling, the openhab server and tuya app from my mobile were turned off
Sorry, i no longer use OpenHAB.
Okay, I was able to start the floodlight lamp (by LSC) working with all possible settings (on/off, brightness, white temp, mode: sensor/manual, all settings of sensor)
The problem is that it only works in ONENHAB when I have the script running manually
(putty session on my raspberry)
cd /etc/openhab2/scripts/tuya-mqtt
DEBUG=* node tuya-mqtt.js
I added script as a service to systemd (as well as in tutorial)
HELP !!!
which direction? HA?