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 a new (unsupported?) switch board #2541

Closed
GitJa21 opened this issue Oct 4, 2022 · 7 comments
Closed

Firmware for a new (unsupported?) switch board #2541

GitJa21 opened this issue Oct 4, 2022 · 7 comments
Labels

Comments

@GitJa21
Copy link

GitJa21 commented Oct 4, 2022

Device

Unnamed, seems like Geekcreit

Version

No response

Question

Hello!
There is such a board. (PSF-B85/PSF-B04, RFE274DM and one unknown chip, apparently related to the RF part)
It has two separate relay control buttons, a two-color LED indicating the operation of the board and two single-color LEDs indicating the operation of the relay.
Using the buttons, we can switch wifi to hotspot and to pairing of 433MHz remotes.
I don’t want to try e-Welink (especially register on their website)
I really want to flash ESPurna into it. Since I like it and it is already flashed on different ESP switches in my network.
Ofcourse, I want to be able to control both relays using the RF remote control. (I can't even imagine if this is possible on this board)
Tell me what firmware can be used in finished form. Maybe someone has already tried...
Is there a generic version where I can configure the GPIO and RCs scan-codes via the Web interface?
Or adapt some of the existing firmware.
IMG_20221004_230925
IMG_20221004_231025

@mcspr
Copy link
Collaborator

mcspr commented Oct 5, 2022

PSF-B04 is a ESP8285, so at least that works :)

Quick search through the device db for tasmota, here what looks like it

I'd expect RF works the same as other ITEAD / SONOFF devices (4CH RF, BASIC RF, wall mounted switch T1, etc.) - RF chip handles all the learning and emulates a button press when it receives a matching signal. Just a matter of finding out what it needs to 'learn' a signal

Flashing it is another question. Manual approach obviously works, see the db entry above to find GPIO0 and TX & RX pins. I wonder if ITEAD firmware still allows direct connections to devices' access point to initiate DIY mode and upgrade that way. Could be only for SONOFF devices, though

While we already have DUAL_R2 hardware that has matching pins

#elif defined(ITEAD_SONOFF_DUAL_R2)
#define MANUFACTURER "ITEAD"
#define DEVICE "SONOFF_DUAL_R2"
// Buttons
#define BUTTON1_PIN 0 // Button 0 on header
#define BUTTON1_CONFIG BUTTON_SWITCH | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
#define BUTTON1_PRESS BUTTON_ACTION_TOGGLE
#define BUTTON1_RELEASE BUTTON_ACTION_TOGGLE
#define BUTTON2_PIN 9 // Button 1 on header
#define BUTTON2_CONFIG BUTTON_SWITCH | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
#define BUTTON2_RELAY 2
#define BUTTON2_PRESS BUTTON_ACTION_TOGGLE
#define BUTTON2_RELEASE BUTTON_ACTION_TOGGLE
#define BUTTON3_PIN 10 // Physical button
#define BUTTON3_CONFIG BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON3_RELAY 1
// Relays
#define RELAY1_PIN 12
#define RELAY1_TYPE RELAY_TYPE_NORMAL
#define RELAY2_PIN 5
#define RELAY2_TYPE RELAY_TYPE_NORMAL
// LEDs
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1

espurna/code/platformio.ini

Lines 445 to 447 in 3565631

[env:itead-sonoff-dual-r2]
extends = env:esp8266-1m-base
build_src_flags = -DITEAD_SONOFF_DUAL_R2

I am a bit worried b/c tasmota db has these completely different pins; we might have a mislabeled device
https://templates.blakadder.com/sonoff_dual_R2.html

@GitJa21
Copy link
Author

GitJa21 commented Oct 5, 2022

Thanks a lot for the information.
I flashed the firmware from Sonoff Dual R2. Through WEB everything works perfectly. Relay and LED.
But for some reason, both the physical buttons and the radio began to work incorrectly. When the button is pressed, the state of the relay changes, and after releasing button, relay returns to the previous state.

@mcspr
Copy link
Collaborator

mcspr commented Oct 6, 2022

But for some reason, both the physical buttons and the radio began to work incorrectly. When the button is pressed, the state of the relay changes, and after releasing button, relay returns to the previous state.

Dual configuration specifies that these are 'switches', so 'press' and 'release' events toggle the relay. Could be remedied either by changing both and re-building, or adding a runtime setting that changes them from switch to pushbutton. In the terminal (DEBUG, telnet, serial connection)

set btnMode0 pushbutton
set btnMode1 pushbutton
reset

Reboot, and also check out what button 0 and button 1 say after that

@mcspr
Copy link
Collaborator

mcspr commented Oct 8, 2022

re. deleted message, were there any problems with the setup? I don't think pushbutton setup is wrong, but double-check the 'button 0' and 'button 1' output for the full config
edit: and I should stress it again - reboot. unlike actions, mode setup of either switch or pushbutton happens on boot

@GitJa21
Copy link
Author

GitJa21 commented Oct 11, 2022

Thanks for the quick and interesting replies!
Yes, I had to delete the message. I realized that I was playing with the old firmware (1.14) Then I reflashed and repeated the experiment (1.15)
But unfortunately, your advice did not work with a new firmware too (of course I reboot the device).
"btnMode0": "pushbutton",
"btnMode1": "pushbutton",

[488471] [BUTTON] Button #0 event 1 (pressed)
[488493] [RELAY] #0 set to ON
[488979] [BUTTON] Button #0 event 3 (click)
[489000] [RELAY] #0 set to OFF
[489851] [BUTTON] Button #1 event 1 (pressed)
[489872] [RELAY] #1 set to ON
[490352] [BUTTON] Button #1 event 3 (click)
[490373] [RELAY] #1 set to OFF
[491378] [RELAY] Relay mask: 0b0

"btnMode0": "switch",
"btnMode1": "switch",

[015009] [BUTTON] Button #0 event 1 (pressed)
[015031] [RELAY] #0 set to OFF
[015149] [BUTTON] Button #0 event 2 (released)
[015171] [RELAY] #0 set to ON
[016118] [BUTTON] Button #1 event 1 (pressed)
[016139] [RELAY] #1 set to OFF
[016269] [BUTTON] Button #1 event 2 (released)
[016290] [RELAY] #1 set to ON
[017296] [RELAY] Relay mask: 0b11

I tried other dual+ firmware and 4CH firmware worked as it should. True, 4 sliders are displayed (This is the lesser evil :) without rebuilding the firmware, of course)

Sorry, some commands from the wiki are not quite clear without examples. Is it possible to change the INPUT / OUTPUT direction of the GPIO and how to reassign it to the relay / button ...

By the way, RF works the same as other SonOff devices - RF chip handles all the learning and emulates a button press when it receives a matching signal. Indeed.

Here are some differences in settings. But I still can't figure out why it doesn't work correctly.
(I set the switch mode manually after pushbutton, so nothing change anyway)
изображение

@mcspr
Copy link
Collaborator

mcspr commented Oct 12, 2022

Ah, since dual declares pressed / btnPress in build config, we need to set it to none to accompany pushbutton mode change. 4ch doesn't have anything there, so it works like you expect.

Relay association is also a setting for button - btnRelay0, btnRelay1, and etc. numbered from 0
If action does something related to relays, it would use that relay index to relay-toggle or relay-on or relay-off

@GitJa21
Copy link
Author

GitJa21 commented Oct 12, 2022

Wow! I did not think that it is possible to reassign procedures on events.
So commands

set btnRlse0 none 
set btnRlse1 none 

did their job.
Everything works perfectly! Thanks a lot!

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

No branches or pull requests

2 participants