Giter VIP home page Giter VIP logo

esphome-tuya-curtain's Introduction

Phong Vũ

CTO and TechLead at BraveBits/PageFly

  • Software Engineer
  • Hardware Engineer
  • Graphic Designer

esphome-tuya-curtain's People

Contributors

iphong avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esphome-tuya-curtain's Issues

New homekit BCM500DS-TYW Tuya motor codes

Hi,

I have the newest version with homekit option. There is no ESP anymore inside, but what looks like a custom Tuya chip. I did not try to flash this onboard chip, but I doubt wether that would work.

So I got a ESP8266 of the shelf and programmed it with this ESPHome code. Sadly it not work, I cut the power to the Tuya onboard Wifi chip and used the TX en RX pin of that wifi chip (note, dont use the pin header with Tx Rx writing, it is a different interface) to connect the UART of the ESP to.

In the end I ended up sniffing al the traffic on that interface when te motor was connected to the Tuya app and came up with these codes below (decimal, not hex).

Surely everthing can be more clean coded, but these are the working values I would like to share to others as a start to get the motor working. Works for days now and looks very stable.

              if (call.get_stop()) { //stop
			crc = 0;
			writeByte(85);
			writeByte(170);
			writeByte(0);
			writeByte(6);
			writeByte(0);
			writeByte(5);
			writeByte(1);
			writeByte(4);
			writeByte(0);
			writeByte(1);
			writeByte(1);
			writeByte(17);
		}
```
if (call.get_position().has_value()) {
		crc = 0;
		uint8_t pos = *call.get_position() * 100.0f;
		if (pos == 100) { //close
			writeByte(85);
			writeByte(170);
			writeByte(0);
			writeByte(6);
			writeByte(0);
			writeByte(5);
			writeByte(1);
			writeByte(4);
			writeByte(0);
			writeByte(1);
			writeByte(0);
			writeByte(16);
			
		} else if (pos == 0) {  //open
			writeByte(85);
			writeByte(170);
			writeByte(0);
			writeByte(6);
			writeByte(0);
			writeByte(5);
			writeByte(1);
			writeByte(4);
			writeByte(0);
			writeByte(1);
			writeByte(2);
			writeByte(18);
		} else { //position
			writeByte(85);
			writeByte(170);
			writeByte(0);
			writeByte(6);
			writeByte(0);
			writeByte(8);
			writeByte(2);
			writeByte(2);
			writeByte(0);
			writeByte(4);
			writeByte(0);
			writeByte(0);
			writeByte(0);
			writeByte(pos);
			writeByte(crc);
		}
	}
}
`	void setMotorNormal() {
		writeByte(85);
		writeByte(170);
		writeByte(0);
		writeByte(6);
		writeByte(0);
		writeByte(5);
		writeByte(5);
		writeByte(4);
		writeByte(0);
		writeByte(1);
		writeByte(1);
		writeByte(21);
	}

	void setMotorReversed() {
		writeByte(85);
		writeByte(170);
		writeByte(0);
		writeByte(6);
		writeByte(0);
		writeByte(5);
		writeByte(5);
		writeByte(4);
		writeByte(0);
		writeByte(1);
		writeByte(1);
		writeByte(20);
	}`

//And the position I read from (only basic info at the start and the end of a run by filtering on buffer[10]==67 only as the rest required me too much time to find out and I never need the position during motor running.

if (sum == crc and buffer[10] == 67 ) { 
 position =  buffer[17] / 100.0f;

GPIO numbering for BCM500DS-TYW

Hello there, @iphong !

The following issues were encountered:

  1. The TYWE1S onboard is connected via GPIO13 and GPIO15 (connected to U1TX / U1RX, not U0TX / U0RX as stated in YAML).
  2. Datapoint ID for cover state (not position) looked like 0x66, not 0x65.
  3. COVER_OPERATION_IDLE and COVER_OPERATION_OPENING felt swapped.
  4. Datapoint ID 0x68 was never encountered during operation.

Unfortunately, it is not yet possible for me to contribute with code update as the device is no longer in my posession.
The device was purchased in February 2022.

Following is the log for several actions (output injected before appending new byte to the buffer array, with numbers in square brackets indicating indices of the buffer array):

[19:20:10][D][custom_curtain:059]: read[0]: 55
[19:20:10][D][custom_curtain:059]: read[1]: AA
[19:20:10][D][custom_curtain:059]: read[2]: 00
[19:20:10][D][custom_curtain:059]: read[3]: 07
[19:20:10][D][custom_curtain:059]: read[4]: 00
[19:20:10][D][custom_curtain:059]: read[5]: 08
[19:20:10][D][custom_curtain:059]: read[6]: 65
[19:20:10][D][custom_curtain:059]: read[7]: 02
[19:20:10][D][custom_curtain:059]: read[8]: 00
[19:20:10][D][custom_curtain:059]: read[9]: 04
[19:20:10][D][custom_curtain:059]: read[10]: 00
[19:20:10][D][custom_curtain:059]: read[11]: 00
[19:20:10][D][custom_curtain:059]: read[12]: 00
[19:20:10][D][custom_curtain:059]: read[13]: 48
[19:20:10][D][custom_curtain:059]: read[14]: C1
[19:20:10][D][custom_curtain:059]: read[0]: 55
[19:20:10][D][custom_curtain:059]: read[1]: AA
[19:20:10][D][custom_curtain:059]: read[2]: 00
[19:20:10][D][custom_curtain:059]: read[3]: 07
[19:20:10][D][custom_curtain:059]: read[4]: 00
[19:20:10][D][custom_curtain:059]: read[5]: 05
[19:20:10][D][custom_curtain:059]: read[6]: 66
[19:20:10][D][custom_curtain:059]: read[7]: 04
[19:20:10][D][custom_curtain:059]: read[8]: 00
[19:20:10][D][custom_curtain:059]: read[9]: 01
[19:20:10][D][custom_curtain:059]: read[10]: 01
[19:20:10][D][custom_curtain:059]: read[11]: 77
[19:20:12][D][custom_curtain:059]: read[0]: 55
[19:20:12][D][custom_curtain:059]: read[1]: AA
[19:20:12][D][custom_curtain:059]: read[2]: 00
[19:20:12][D][custom_curtain:059]: read[3]: 07
[19:20:12][D][custom_curtain:059]: read[4]: 00
[19:20:12][D][custom_curtain:059]: read[5]: 08
[19:20:12][D][custom_curtain:059]: read[6]: 65
[19:20:12][D][custom_curtain:059]: read[7]: 02
[19:20:12][D][custom_curtain:059]: read[8]: 00
[19:20:12][D][custom_curtain:059]: read[9]: 04
[19:20:12][D][custom_curtain:059]: read[10]: 00
[19:20:12][D][custom_curtain:059]: read[11]: 00
[19:20:12][D][custom_curtain:059]: read[12]: 00
[19:20:12][D][custom_curtain:059]: read[13]: 3A
[19:20:12][D][custom_curtain:059]: read[14]: B3
[19:20:12][D][custom_curtain:059]: read[0]: 55
[19:20:12][D][custom_curtain:059]: read[1]: AA
[19:20:12][D][custom_curtain:059]: read[2]: 00
[19:20:12][D][custom_curtain:059]: read[3]: 07
[19:20:12][D][custom_curtain:059]: read[4]: 00
[19:20:12][D][custom_curtain:059]: read[5]: 05
[19:20:12][D][custom_curtain:059]: read[6]: 66
[19:20:12][D][custom_curtain:059]: read[7]: 04
[19:20:12][D][custom_curtain:059]: read[8]: 00
[19:20:12][D][custom_curtain:059]: read[9]: 01
[19:20:12][D][custom_curtain:059]: read[10]: 02
[19:20:12][D][custom_curtain:059]: read[11]: 78

Unfortunately, I cannot fully recite the order of operations presented within the log.
It, however, looks like either:

  • Open, Stop, Close, Stop
  • Close, Stop, Open, Stop

Operations were triggered using bundled remote.

problem when i install

hey,

i try install and i have this problem
image

how to fix it?
i need to do reset for motor?
or when its work with application tuya try work with esp card?

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.