Hi,
I finally managed to get your program running (I'm fairly new to this Raspberry / Linux etc stuff) due to a problem with getting the necessary key and id via tuyapi, but now I'm running into a problem with nodemon running / guarding your program.
I can start the program with:
sudo nodemon --ext rs tuya_api_mqtt.js
and I can browse to the webpage at port 8082, create a new device with the found key and id, but as soon as I save I'm getting the following error:
~/Virtual-Tasmota-for-Tuya-api-devices $ sudo nodemon --ext rs tuya_api_mqtt.js
[nodemon] 1.19.1
[nodemon] to restart at any time, enter rs
[nodemon] watching: .
[nodemon] starting node tuya_api_mqtt.js
Web Server Running on Port 8082
CDN Running on Port 2362
[nodemon] restarting due to changes...
[nodemon] starting node tuya_api_mqtt.js
Web Server Running on Port 8082
CDN Running on Port 2362
Connected to ACDEFA
Data from device: json obj data unvalid
called processData: for ACDEFA json obj data unvalid
/home/pi/Virtual-Tasmota-for-Tuya-api-devices/tuya_api_mqtt.js:252
if(!n$.isNullOrUndef(data.dps[dip.dimmerId]))
^
TypeError: Cannot read property '2' of undefined
at processData (/home/pi/Virtual-Tasmota-for-Tuya-api-devices/tuya_api_mqtt.js:252:31)
at TuyaDevice.device.on.data (/home/pi/Virtual-Tasmota-for-Tuya-api-devices/tuya_api_mqtt.js:352:4)
at TuyaDevice.emit (events.js:198:13)
at TuyaDevice._packetHandler (/home/pi/Virtual-Tasmota-for-Tuya-api-devices/node_modules/tuyapi/index.js:411:10)
at packets.forEach.packet (/home/pi/Virtual-Tasmota-for-Tuya-api-devices/node_modules/tuyapi/index.js:315:43)
at Array.forEach ()
at Socket.client.on.data (/home/pi/Virtual-Tasmota-for-Tuya-api-devices/node_modules/tuyapi/index.js:311:19)
at Socket.emit (events.js:198:13)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:269:11)
[nodemon] app crashed - waiting for file changes before starting...
I can help nodemon on its way by typing 'rs' but it crashes again right away.
The above is from my RPi 3B+, but the same thing happens on my Windows 10 laptop. I tried to create a dimmer device and a switch on both machines with the same outcome: crashes.
Let me know if I can help with more data and / or testing, I would like to get it working.
BR//Willem.
P.s.: a little friendly advice, please check the spelling of the text you're putting on the screen; there are some misspelled words and if that's also happening in the program itself...