-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
RF433 json usermod #4234
base: 0_15
Are you sure you want to change the base?
RF433 json usermod #4234
Conversation
Thank you. |
This looks like a great addition. Did you test it to work on all ESP variants? A few suggestions:
|
Tested on esp32, c3 and esp8266
How can that be done? Believe it's all of them anyway
No problem to just put one in the folder? |
not sure how to restrict pins but I think AR usermod does it, maybe look at others for examples but I have seen UMs where unusable pins are red. In the deep-sleep usermod I just create a list but there I do not use 'pin' because already used pins can be repurposed, so not going through pinmanager. yea, I would just put the example json in the usermod folder, easier to find than going through KB and download an IR remote file. |
FYI you cannot restrict GPIO in usermods. Not yet. |
I looked around and at least for ESP32, S3 and 8266 all pins can be used as interrupts so there should not be any restriction. |
Move doc to separate readme Add sample config Fix missing json handling
There, hopefully that's fine... I changed the default_env in |
sprintf_P(objKey, PSTR("\"%d\":"), button); | ||
|
||
// attempt to read command from remote.json | ||
readObjectFromFile(PSTR("/remote433.json"), objKey, pDoc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make more sense to read the JSON file during your setup function rather than for every button press?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is done the same as for wizmote, and for IR which wizmote was taken from. If it was loaded on setup only if you went to /edit and changed the file changes wouldn't be taken into account until a reboot? That wouldn't be user-friendly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, this (reading the file upon receive) is the way it is done in all other json remote code. Also there is no restriction on creating say 50 different commands: that would hog a lot of RAM permanently.
Inspired by https://github.com/athom-tech/Sound-Reactive-WLED/tree/master/usermods/RF433
Modified to handle similar cases as other remote methods through json
Usermod for controlling WLED using a generic 433 / 315MHz remote and simple 3-pin receiver
See https://github.com/sui77/rc-switch/ for details
Build:
- Enable by defining USERMOD_RF433 in my_config.h
- Uncomment "sui77/rc-switch @ 2.6.4" in platformio.ini default env lib_deps section
Usage:
- Connect receiver to an interrupt-capable pin
- Set pin in Config->Usermods
- Info pane will show the last received button code
- See https://kno.wled.ge/interfaces/json-ir/json_infrared/ as reference to create a "remote433.json" file
and upload it to the ESP in http://ip/edit, the key for the actions is the button number retrieved from above.