Hi
I’m running lubuntu on virutalbox
Java version openjdk 11.0.11
openhab version 3.1.0
tuya-mqtt version 3.0.4
I have this plugs
I have been trying for months now, but I’m still stuck. What have I done wrong?
I can’t get my smartlife/tuya WiFi to connect to mqtt/openhab
I think I understand the basics in mqtt. I’m able to test mosquitto_sub and mosquitto_pub and get my message through, for test use (hello_world), when I don´t need keys, IP etc
I have been looking at this.
but I installed mosquitto separate on my server.
so:
/etc/openhab/services
I added
mqtt.cfg file
broker.url=tcp://192.168.1.183:1883
broker.clientId=openhab
broker.user=openhab
Then this
I installed it in /etc/openhab/scrips and not /opt
In my case
/etc/openhab/scripts/tuya-mqtt
config.json file
{
“host”: “192.168.1.183”,
“port”: 1883,
“topic”: “tuya/”,
“mqtt_user”: “”,
“mqtt_pass”: “”
}
I got my tuya info from tuya-cli and iot.tuya.com
/etc/openhab/scripts/tuya-mqtt
devices.conf file
[ { name: 'Taklampan ',
id: ‘bfa6f7b5d701a3fxxxxxx’,
key: ‘4cb04f6c71xxxxxx’ },
{ name: ‘Hallen’,
id: ‘bf4c71b76e7c6bfxxxxxxx’,
key: ‘b9d6cc3c26dxxxxx’ },
{ name: 'Sovrumstv ',
id: ‘0377748668c63xxxxxxx’,
key: ‘426cdbcdexxxxxx’ },
{ name: ‘Sovrumslampan’,
id: ‘0226785468c63xxxxxxxx’,
key: ‘ccff77103cxxxxxxx’ },
{ name: 'extra kontakt ',
id: ‘60568156b4e6xxxxxxx’,
key: ‘337e320255xxxxxx’ },
{ name: ‘lampan lilla rummet’,
id: ‘0226785468c63xxxxxx’,
key: ‘f6ea4623751xxxxx’ } ]
run sudo node tuya-mqtt.js
To openhab
MQTT-broker is online
Generic MQTT Thing add channel
mark on/off switch
MQTT State Topic
tuya/hallen/bf4c71b76e7c6bfxxxxxxx/b9d6cc3c26dxxxxx/192.168.1.10/state # I have also tested without IP address
MQTT Command Topic
tuya/hallen/bf4c71b76e7c6bfxxxxxxx/b9d6cc3c26dxxxxx/192.168.1.10/command
restart openhab
I have also tested to set custom on/open value
{“dps” : 1, " set" : 1,} test true as well
and off
{“dps” : 1, " set" : 0,} test false as well
I have also tested gismocaster/tuyagateway but no luck
https://github.com/tradeface/tuyagateway/wiki
I don’t understand what I’m doing wrong.
Thank you for your help