Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firmware for Tuya curtain switch #1855

Closed
yankoxz opened this issue Aug 14, 2019 · 8 comments
Closed

Firmware for Tuya curtain switch #1855

yankoxz opened this issue Aug 14, 2019 · 8 comments

Comments

@yankoxz
Copy link

yankoxz commented Aug 14, 2019

Request for ESPurna :

Hi, first of all sorry for my realy bad english but i realy need help ! there it is :
i'm trying to make a custom version of ESPurna for a device that i bought :

image

With TYWE3S Module : https://docs.tuya.com/en/hardware/WiFi-module/wifi-e3s-module.html
I have tried to make a custom version of ESPurna with ArduinoIDE, I follow the wiki tutorial install all libraries and just modifiying the GPIO controlled in hardware.h with different test of button_mode and relay but even with the datasheet of TYWE3S I never found a GPIO that work and respond I flash the module I connect to it change the password connected it to the wifi but if I push the button it doesn’t appear on ESPurna webpage and the reverse if I push button on the web interface I have no action on the device. Nothing happens I have tried every GPIO number , nothing. I have read this issue : #1729 but i don't found what i need.
If someone could help me it will be awesome thanks !

@mcspr
Copy link
Collaborator

mcspr commented Aug 16, 2019

ref #1729 discussion, it could be that the way switch works is through the secondary MCU that actually has GPIO control. Only thing we can do is to send it some specific commands, but we can only guess for now which ones.

There is a dev...mcspr:experimental/tuya branch that was successfully used with the dimmer hardware, I assume it should also work for this.
It is not yet in the main tree though, pending some other changes

@HeavyM3
Copy link

HeavyM3 commented Aug 18, 2019

I use this switch : Jinvoo WiFi Curtain - this looks very similar to your device.

My settings:

//

#elif defined(JINVOO_CURTAIN)
     #define MANUFACTURER        "Jinvoo"
     #define DEVICE              "Curtain"

 // Buttons


     #define BUTTON1_PIN         12
     #define BUTTON2_PIN         3
     #define BUTTON3_PIN         5

     #define RELAY_SYNC          RELAY_SYNC_NONE_OR_ONE
     #define BUTTON1_MODE        BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
     #define BUTTON1_PRESS       BUTTON_MODE_TOGGLE
     #define BUTTON1_CLICK       BUTTON_MODE_NONE
     #define BUTTON1_DBLCLICK    BUTTON_MODE_NONE
     #define BUTTON1_LNGCLICK    BUTTON_MODE_NONE
     #define BUTTON1_LNGLNGCLICK BUTTON_MODE_NONE


     #define BUTTON2_MODE        BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
     #define BUTTON2_PRESS       BUTTON_MODE_ON
     #define BUTTON2_CLICK       BUTTON_MODE_NONE
     #define BUTTON2_DBLCLICK    BUTTON_MODE_NONE
     #define BUTTON2_LNGCLICK    BUTTON_MODE_NONE
     #define BUTTON2_LNGLNGCLICK BUTTON_MODE_NONE

     #define BUTTON3_MODE        BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
     #define BUTTON3_PRESS       BUTTON_MODE_TOGGLE
     #define BUTTON3_CLICK       BUTTON_MODE_NONE
     #define BUTTON3_DBLCLICK    BUTTON_MODE_NONE
     #define BUTTON3_LNGCLICK    BUTTON_MODE_NONE
     #define BUTTON3_LNGLNGCLICK BUTTON_MODE_NONE

     #define BUTTON1_RELAY       1
     #define BUTTON3_RELAY       2

// Relays
     #define RELAY1_PIN          13
     #define RELAY2_PIN          15

     #define RELAY1_TYPE         RELAY_TYPE_NORMAL
     #define RELAY2_TYPE         RELAY_TYPE_NORMAL
     #define LED1_PIN            0
     #define LED1_PIN_INVERSE    0
     #define LED1_MODE           LED_MODE_FINDME_WIFI

Switch 0 & 2 :
Boot mode alsways OFF
Pulse mode normaly OFF
Pulse time 50 seconds (depends how long it takes to open or close)

Switch 1:
Boot mode alsways ON
Pulse mode: Dont't Pulse

Works prefectly for me with blinds and window shades

@yankoxz
Copy link
Author

yankoxz commented Aug 18, 2019

thanks a lot i'm gonna try this settings on my device.

@yankoxz
Copy link
Author

yankoxz commented Aug 18, 2019

hey i've tried this it works ! i don't now what i have done before but i erease all the project download it and just add your code HeavyM3 and it work verry well i just have to find for the middle button pause your button 2 how to stop the enable relay beacause :
#define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON2_PRESS BUTTON_MODE_ON
#define BUTTON2_CLICK BUTTON_MODE_NONE
#define BUTTON2_DBLCLICK BUTTON_MODE_NONE
#define BUTTON2_LNGCLICK BUTTON_MODE_NONE
#define BUTTON2_LNGLNGCLICK BUTTON_MODE_NONE
don't work as off all relay, i don't now if it's just the pin to change.
but i don't see in this code how it gonna have interaction with the relay or command the switch. if you have an idea ^^.

whatever thanks a lot for your help HeavyM3 and mcspr.

@stale
Copy link

stale bot commented Oct 17, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 17, 2019
@stale
Copy link

stale bot commented Oct 24, 2019

This issue will be auto-closed because there hasn't been any activity for two months. Feel free to open a new one if you still experience this problem.

@stale stale bot closed this as completed Oct 24, 2019
@luis-sanmiguel
Copy link

For future reference:

BUTTON1 -> GPIO12
BUTTON2 -> RXD0/GPIO3
BUTTON3 -> GPIO5

NOT USED -> GPIO4

LED1-3 TOGGLE -> TXD0/GPIO1
LED1 -> GPIO16
LED2 -> GPIO14
LED3 GPIO2
LED6 -> GPIO0

RELAY1 -> GPIO15
RELAY2 -> GPIO13

Brands Maxcio, Etersky, ...

@luis-sanmiguel
Copy link

luis-sanmiguel commented Feb 6, 2020

hey i've tried this it works ! i don't now what i have done before but i erease all the project download it and just add your code HeavyM3 and it work verry well i just have to find for the middle button pause your button 2 how to stop the enable relay beacause :
#define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON2_PRESS BUTTON_MODE_ON
#define BUTTON2_CLICK BUTTON_MODE_NONE
#define BUTTON2_DBLCLICK BUTTON_MODE_NONE
#define BUTTON2_LNGCLICK BUTTON_MODE_NONE
#define BUTTON2_LNGLNGCLICK BUTTON_MODE_NONE
don't work as off all relay, i don't now if it's just the pin to change.
but i don't see in this code how it gonna have interaction with the relay or command the switch. if you have an idea ^^.

whatever thanks a lot for your help HeavyM3 and mcspr.

EXACTLY as original firmware (including BUTTON2/CENTRAL BUTTON)

// Buttons
#define BUTTON1_PIN 12
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_PRESS BUTTON_MODE_TOGGLE
#define BUTTON1_CLICK BUTTON_MODE_NONE
#define BUTTON1_DBLCLICK BUTTON_MODE_NONE
#define BUTTON1_LNGCLICK BUTTON_MODE_NONE
#define BUTTON1_LNGLNGCLICK BUTTON_MODE_NONE
#define BUTTON1_RELAY 1

#define BUTTON2_PIN 3
#define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON2_PRESS BUTTON_MODE_ON
#define BUTTON2_CLICK BUTTON_MODE_NONE
#define BUTTON2_DBLCLICK BUTTON_MODE_NONE
#define BUTTON2_LNGCLICK BUTTON_MODE_NONE
#define BUTTON2_LNGLNGCLICK BUTTON_MODE_NONE
#define BUTTON2_RELAY 3

#define BUTTON3_PIN 5
#define BUTTON3_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON3_PRESS BUTTON_MODE_TOGGLE
#define BUTTON3_CLICK BUTTON_MODE_NONE
#define BUTTON3_DBLCLICK BUTTON_MODE_NONE
#define BUTTON3_LNGCLICK BUTTON_MODE_NONE
#define BUTTON3_LNGLNGCLICK BUTTON_MODE_NONE
#define BUTTON3_RELAY 2

// Relays
#define RELAY_SYNC RELAY_SYNC_NONE_OR_ONE
#define RELAY1_PIN 13
#define RELAY1_TYPE RELAY_TYPE_LATCHED_INVERSE
#define RELAY1_RESET_PIN 4
#define RELAY2_PIN 15
#define RELAY2_TYPE RELAY_TYPE_LATCHED_INVERSE
#define RELAY2_RESET_PIN 4
#define RELAY3_PIN 4
#define RELAY3_TYPE RELAY_TYPE_INVERSE

// LED
#define LED1_PIN 16
#define LED1_PIN_INVERSE 0
#define LED2_PIN 14
#define LED2_PIN_INVERSE 0
#define LED3_PIN 2
#define LED3_PIN_INVERSE 0
#define LED4_PIN 0
#define LED4_PIN_INVERSE 0
#define LED5_PIN 1
#define LED5_PIN_INVERSE 0

Switch #0 (GPIO13)
Boot mode Always OFF
Pulse mode Normally OFF
Pulse time (s) 30 (or whatever you need)
Restore last schedule NO

Switch #1 (GPIO15)
Boot mode Always OFF
Pulse mode Normally OFF
Pulse time (s) 30 (or whatever you need)
Restore last schedule NO

Switch #2 (GPIO4)
Boot mode Always OFF
Pulse mode Normally OFF (it does not matter but to maintain some congruence with its operation)
Pulse time (s) 1
Restore last schedule NO

LED #0 mode Follow switch# 0
LED #1 mode Always ON
LED #2 mode Follow switch# 1
LED #3 mode Always ON
LED #4 mode Always ON

Buttons and leds are numbered from top upper white arrow to botton. Personally I to set led2 as Wifi Status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants