Thanks,
I am still a littel confused about few things.
The swtch doesn’t update when changed externally. How do you get it to map back. It works to send from the gui but not when changed externally. I can see the change in the debug mode of tuya-mqtt
How do you configure in an items things/items file instead of Paper UI?
How do you send a value or receive from one of the dps values?
Any help or pointing me to somewhere that explains would be great.
Thanks for the tutorial, I’m having some trouble finding the .ssh folder to save my public/private key to. In V 2.4, is is named something like “org.apche.karaf.shell.ssh”?
Hi. I’ve installed the MQTT Binding (2.4.0) and the things that you said in the tutorial (MQTT Broker, Embedded MQTT and the Generic MQTT). Also, I’ve installed the tuyaaì_mqtt.js and it’s running.
In the other hand, I’ve installed a contact sensor in Tuya App and got the deviceId, the localKey and the local IP, and I’ve added the channel with the state and the command topic like that:
tuya/{deviceId}/{localKey}/{localIP}/
The problem is that OpenHAB doesn’t seem connect with my device.
On the other hand, I’ve installd tuya-cli. And when I execute DEBUG=* tuya-cli get --ip 192.168.100.120 --id YYYYYYYY --key ZZZZZZZZZ --all, I have something like that:
TuyAPI IP and ID are already both resolved. +0ms
TuyAPI Connecting to 192.168.100.120… +2ms
TuyAPI Error event from socket. 192.168.100.120 { Error: connect EHOSTUNREACH 192.168.100.120:6668
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1191:14)
errno: ‘EHOSTUNREACH’,
code: ‘EHOSTUNREACH’,
syscall: ‘connect’,
address: ‘192.168.100.120’,
port: 6668 } +3s
events.js:183
throw er; // Unhandled ‘error’ event
^
Error: Error from socket
at Socket.client.on.err (/root/.nvm/versions/node/v8.12.0/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:323:30)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at emitErrorNT (internal/streams/destroy.js:66:8)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickCallback (internal/process/next_tick.js:181:9)
Just a note for everyone in here still trying to include Tuya devices - at the moment the tuya-convert scripts seem to work for (most) all ESP 8266 based Tuya devices.
I can strongly recommend using this setup since after the flash you will have native MQTT devices (as in Tasmota) that you can then easily integrate into your openHAB setup without additional devices or servers despite your MQTT broker.
everything works fine
However, if you specify a dps equal to 2
That command works fine, but when I but when I switch the outlet from the Smart Life App, the state is not set in the Control panel
As described in a couple of posts, the local-key information is no longer held in preferences_global_key.xml. This is a change from version 3.8+. In my rooted Android I Installed 3.7.0 from an apk mirror. This version does show the keys as indicated in the tutorial
could you please explane how to do it more for a noob?
I never did & just cant find where and how to add to the openhabian ssh folder.
I did create the public key but thats where i got where do i insert?
But in the node, I have this issue when I activate the switch on or off in the control panel :
#/usr/bin/node /etc/openhab2/scripts/tuya-mqtt/tuya-mqtt.js
(node:18002) UnhandledPromiseRejectionWarning: Error: bind EADDRINUSE 0.0.0.0:6667
at state.handle.lookup (dgram.js:242:18)
at process._tickCallback (internal/process/next_tick.js:63:19)
(node:18002) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:18002) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:18002) UnhandledPromiseRejectionWarning: Error: No connection has been made to the device.
at TuyaDevice._send (/etc/openhab2/scripts/tuya-mqtt/node_modules/tuyapi/index.js:224:13)
at Promise (/etc/openhab2/scripts/tuya-mqtt/node_modules/tuyapi/index.js:204:14)
at new Promise (<anonymous>)
at TuyaDevice.set (/etc/openhab2/scripts/tuya-mqtt/node_modules/tuyapi/index.js:201:12)
at Promise (/etc/openhab2/scripts/tuya-mqtt/tuya-device.js:158:25)
at new Promise (<anonymous>)
at TuyaDevice.set (/etc/openhab2/scripts/tuya-mqtt/tuya-device.js:157:16)
at /etc/openhab2/scripts/tuya-mqtt/tuya-mqtt.js:346:33
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:18002) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:18002) UnhandledPromiseRejectionWarning: Error: No connection has been made to the device.
at TuyaDevice._send (/etc/openhab2/scripts/tuya-mqtt/node_modules/tuyapi/index.js:224:13)
at Promise (/etc/openhab2/scripts/tuya-mqtt/node_modules/tuyapi/index.js:204:14)
at new Promise (<anonymous>)
at TuyaDevice.set (/etc/openhab2/scripts/tuya-mqtt/node_modules/tuyapi/index.js:201:12)
at Promise (/etc/openhab2/scripts/tuya-mqtt/tuya-device.js:158:25)
at new Promise (<anonymous>)
at TuyaDevice.set (/etc/openhab2/scripts/tuya-mqtt/tuya-device.js:157:16)
at /etc/openhab2/scripts/tuya-mqtt/tuya-mqtt.js:346:33
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:18002) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 5)
Error: No connection has been made to the device
means the discover method doesn’t work ?
I’m on the same network ; on OH 2.4 with MQTT Binding + MQTT Embedded Broker
And or the error : “Error: bind EADDRINUSE 0.0.0.0:6667”
First : starting node ,no port 6667
After starting OH 2.4, the port is there :
Hi
first Thanks for your help !
I’ve already installed the 3.3 version and I use it.
LOG in openHAB :
2019-12-01 17:29:16.341 [nt.ItemStatePredictedEvent] - TuyaLampe_2 predicted to become OFF
2019-12-01 17:29:16.349 [vent.ItemStateChangedEvent] - TuyaLampe_2 changed from ON to OFF
2019-12-01 17:29:17.311 [ome.event.ItemCommandEvent] - Item ‘TuyaLampe_2’ received command ON
2019-12-01 17:29:17.318 [nt.ItemStatePredictedEvent] - TuyaLampe_2 predicted to become ON
2019-12-01 17:29:17.329 [vent.ItemStateChangedEvent] - TuyaLampe_2 changed from OFF to ON
2019-12-01 17:29:18.367 [ome.event.ItemCommandEvent] - Item ‘TuyaLampe_2’ received command OFF
Service in OS :
tuyaapi-mqtt.service loaded active running tuyaapi-mqtt
Result of my request just after OpenHAB started (without any action done on OH)
#tuya-cli set --set true --id xxxxxxxxxxxx --key yyyyyyyyyyyyy
{ Error: bind EADDRINUSE 0.0.0.0:6667
at state.handle.lookup (dgram.js:242:18)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
errno: 'EADDRINUSE',
code: 'EADDRINUSE',
syscall: 'bind',
address: '0.0.0.0',
port: 6667 }
your code goes here
Netstat :
udp6 0 0 :::6667 :::* 111 74221 -
111 user is openhab
And to identify the programm using it : #sudo netstat -putan |grep ‘6667’
udp6 0 0 :::6667 :::* 22915/java