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

Save settings via web interface #146

Closed
cruunnerr opened this issue Apr 2, 2019 · 10 comments
Closed

Save settings via web interface #146

cruunnerr opened this issue Apr 2, 2019 · 10 comments

Comments

@cruunnerr
Copy link

Hi there,

first i want to say, that here i found the best way to power ws2812 stripes with ESP8266. Great software. Thank you for that :)

I wish to save the settings i made (like macros, default values etc.).
Is there a way to save my settings? When the ESP lost the configuration or crashes it would be nice to have a save file and i just need to upload on a fresh WLED-System :)

Thank you

Oh ehm.... and i want to ask, if it is possible, to publish the on/off state via Mqtt as boolean (true/false) and a separate brightness and effect value.

That would be great for the integration with iobroker.

Thank you again and sorry for my bad english :(

@Aircoookie
Copy link
Member

Hi!
Awesome that you like WLED!

Yes, I agree that it would be very useful to be able to backup and restore (parts of) the settings! I'll try and think of a way to achieve that :)

About MQTT, I can easily add setting on/off with a boolean value. Adding more topics to publish (like a separate topic for brightness, effect, effect speed, each color...) is something I'm still hesistant about, because it might impact performance too much. Every value is changable via the wled/devicetopic/api topic, but I realize that might not be the easiest solution for home automation platforms. We'll see!

Don't worry, your english is absolutely error free :)

@YeonV
Copy link
Contributor

YeonV commented Apr 15, 2019

@cruunnerr You know that you get the XML response as MQTT Message on device/v:

<?xml version="1.0" ?><vs><ac>255</ac><cl>0</cl><cl>255</cl><cl>0</cl><cs>0</cs><cs>0</cs><cs>0</cs><ns>0</ns><nr>1</nr><nl>0</nl><nf>1</nf><nd>60</nd><nt>0</nt><fx>0</fx><sx>220</sx><ix>128</ix><fp>0</fp><wv>-1</wv><ws>0</ws><md>1</md><cy>0</cy><ds>MyLight-1337A3</ds></vs>

I changed the arduino code to return a custom JSON-response on MQTT /v:

 {"ip":"192.168.1.172","leds":21,"topic":"blade/ledx/strip2","color":[0,0,255]}

Also there are the json http-API-urls with http://[ip]/json/info and more important for your task: http://[ip]/json/state

@Aircoookie If you find a sane and performant way of customizing the mqtt-answer published on /v
everyone could config it to fit their automation systems.

P.S.: Also while implementing my custom response, i found, your rgb to hex conversion:
sprintf(s, "#%X", col[3] * 16777216 + col[0] * 65536 + col[1] * 256 + col[2]);
seems to trim leading zeros, resulting in a "#FF" instead of a "#0000FF" on the /c-Topic

@Aircoookie
Copy link
Member

There is a way to back up everything, macros, presets and settings using esptool! See #479

Downloading them as .json files will be available in 0.10.0 :)

@jangrewe
Copy link

Hi @Aircoookie , i recently came across WLED when building my own Ambilight, and i LOVE it!
Along the process, a couple of ESP8266 got fried (one while "in production"), and i was wondering if that config backup/export (and preferably also import) via JSON is available by now? We're a bit past 0.10.0 ;-)

@JakeShirley
Copy link

Resurrecting old thread. Is it possible to back these settings up now via JSON? I'd love to do it daily just in case. I don't want to lose my dozens of presets!

@Aircoookie
Copy link
Member

@jangrewe @JakeShirley yes, this is now supported in 0.11.0 and up! Just go to the [WLED-IP]/edit page and download the cfg.json and presets.json files (right click on file name)! To restore, you just delete the existing ones, upload the ones you downloaded for the backup and reboot :)

@JakeShirley
Copy link

To expand after looking at the /edit page, here are the two files you can hit:

  • [WLED-IP]/edit?download=cfg.json
  • [WLED-IP]/edit?download=presets.json

@n0valis
Copy link

n0valis commented May 6, 2021

How do I restore from cfg/presets.json?

@Aircoookie
Copy link
Member

@n0valis hi, just go to the [WLED-IP]/edit page and use the "Choose file" and then "Upload" buttons for both presets.json and cfg.json. You might need to reboot WLED afterwards in order to apply the restored configuration.

@n0valis
Copy link

n0valis commented May 8, 2021

nice!

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

No branches or pull requests

6 participants