Coder Social home page Coder Social logo

thirug010 / virtual-tasmota-for-tuya-api-devices Goto Github PK

View Code? Open in Web Editor NEW
16.0 1.0 0.0 2.91 MB

New Tuya firmware (1.0.7, 2.0, 3.3..) updates disable the OTA Flashing options at the moment, This feature allows you to use the non flashed Tuya devices as tasmota device along with tasmota flashed devices, most of the tasmota features is virtually available and it can be expanded.

License: MIT License

JavaScript 51.15% HTML 47.79% CSS 1.07%
tuya-convert-failing tuya-api tasmota-features tuya-firmware tuya-vt tuya-api-mqtt mqtt tasmota-device tuya-devices sonoff-diy-firmare-update

virtual-tasmota-for-tuya-api-devices's People

Contributors

thirug010 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

virtual-tasmota-for-tuya-api-devices's Issues

TypeError: Cannot read property '2' of undefined

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...
 

MQTT commands must be lower case

Worked through a problem I had and found that the commands passed to Virtual Tasmota via MQTT must be lower case.

cmnd/bedroomlight/power1 ON (works)
cmnd/bedroomlight/POWER1 ON (Doesn't)

It also appears that currently power1 ON toggles the light, just ad power1 OFF does. This means you can turn off the light (if it is on) using power1 ON.

This applies to dimmer and teleperiod, however RESULT and STATE are maintained as capitals.

Images not loading

Great work on this. Its been working for me for the past couple of months without any issue!

My only issue at the moment is that some images dont load:

http://ha.home:8082/undefined/image/PopOut_002.png

I'm guessing it must be my settings or something about me having this running from the very start of the project, but I'd like to try and figure out how to get the image working.

Complete Noob, need help!

Hi, trying to do this on a Ubuntu box, very limited experience.

I clone the git to my top level directory and followed the steps, I'm just unable to start the script. The usual response is node can't find it. Any chance for an in-depth walk-thru?

Thanks!

MQTT publishing

Hello,

To confirm do these devices output LWT?

Also when i've tried the default "cmnd/device/POWER1" on command its not worked, do you have another way of this being done?

The instructions I've been using in Home Assistant are:

switch:

  • platform: mqtt
    name: "Bedroom Light"
    state_topic: "stat/bedroomlight/RESULT"
    value_template: "{{ value_json.POWER }}"
    command_topic: "cmnd/bedroomlight/POWER1"
    #availability_topic: "tele/sonoff/LWT"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    retain: false

rs file missing?

Sorry I'm new to this. I followed your setup instructions but it's not working. I notice a reference to "Tuya-Api-Tasmota.rs" and "tuya-api-template.js" but I don't actually see either of those. Was there something additional I was supposed to install? Thanks.

SetOption

Is there anyway to pass SetOption19 1 to the devices? This would allow them to be discoverable via MQTT in Home Assistant.

using an existing MQTT server

Hi,

I would like to use my existing MQTT server (mosquitto) with your program. Is this possible and if yes, how do I accomplish that? I'm not really Raspberry/Linux savvy so I need some guidance in this.

I already tried to put the IP number of my server in Utility.js, but then I get the following error:

~/Virtual-Tasmota-for-Tuya-api-devices $ 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
events.js:174
throw er; // Unhandled 'error' event
^

Error: Connection refused: Not authorized
at MqttClient._handleConnack (/home/pi/Virtual-Tasmota-for-Tuya-api-devices/node_modules/mqtt/lib/client.js:1076:15)
at MqttClient._handlePacket (/home/pi/Virtual-Tasmota-for-Tuya-api-devices/node_modules/mqtt/lib/client.js:365:12)
at work (/home/pi/Virtual-Tasmota-for-Tuya-api-devices/node_modules/mqtt/lib/client.js:283:12)
at Writable.writable._write (/home/pi/Virtual-Tasmota-for-Tuya-api-devices/node_modules/mqtt/lib/client.js:294:5)
at doWrite (/home/pi/Virtual-Tasmota-for-Tuya-api-devices/node_modules/readable-stream/lib/_stream_writable.js:428:64)
at writeOrBuffer (/home/pi/Virtual-Tasmota-for-Tuya-api-devices/node_modules/readable-stream/lib/_stream_writable.js:417:5)
at Writable.write (/home/pi/Virtual-Tasmota-for-Tuya-api-devices/node_modules/readable-stream/lib/_stream_writable.js:334:11)
at Socket.ondata (_stream_readable.js:709:20)
at Socket.emit (events.js:198:13)
at addChunk (_stream_readable.js:288:12)
Emitted 'error' event at:
at MqttClient._handleConnack (/home/pi/Virtual-Tasmota-for-Tuya-api-devices/node_modules/mqtt/lib/client.js:1078:10)
at MqttClient._handlePacket (/home/pi/Virtual-Tasmota-for-Tuya-api-devices/node_modules/mqtt/lib/client.js:365:12)
[... lines matching original stack trace ...]
at addChunk (_stream_readable.js:288:12)
[nodemon] app crashed - waiting for file changes before starting...

I would like to use my existing MQTT server as there are other devices and programs using it.

Thanks for a reply.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.