arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
22.21k stars 4.81k forks source link

Feature Request: Add device config via loadable template specific file #5177

Closed Jason2866 closed 5 years ago

Jason2866 commented 5 years ago

Have you look for this feature in other issues and in the wiki? Yes Is your feature request related to a problem? Please describe.

Since the growing amount of devices not all devices can be added to Tasmota code Describe the solution you'd like

Possibility to load a config file (template) which can be loaded via webfrontend to config Tasmota. So everyone could share working device config templates for easy setting up his device

blakadder commented 5 years ago

As the voice of the average user I wholeheartedly support this feature and it would relieve a lot of stress on the support team (github and discord) as well as making wiki entries a simple image of the device and a link to the config file

arendst commented 5 years ago

Considering.

arendst commented 5 years ago

How about a command like this:

Template {"Name":"Sonoff Basic","Gpio":[17,255,255,255,255,0,0,0,21,56,255,0,0],"Flag":0x00}

With a name up to 14 characters, GPIO numbers as presented by the GPIO command and an optional flag as currently available in sonoff_template.h. The number 255 represents a user selectable configurable GPIO just as in sonoff_template.h.

No fancy upload process needed. Just a command.

Jason2866 commented 5 years ago

Nice, for advanced users! We have in Discord Chat many users with beginner skill. So we have to explain how to handle this command. What do you think about implementing this now and let us make some experience with. If this isnt end user friendly enough, doing it additional/alternative via file upload?

arendst commented 5 years ago

Working on it. Might be ready by tomorrow.

digiblur commented 5 years ago

Awesome! It will definitely help with the flood of the new devices from Tuya convert. This is a great combination with the recent addition power monitoring pin selection via the GUI ! Easy to cover most of these plugs with Generic now and a simple Wiki page.

arendst commented 5 years ago

Takes some more time for testing as there are major changes needed to satisfy future user requests (I had a vision...).

Anyway I have it functional and am testing the final changes.

arendst commented 5 years ago

Give it a chance.

Command Template usage:

Template - Show current user template Template 0 - Copy current module to user template Template <module number> - Copy module to user template Template {"NAME":"GenericTheo","GPIO":[17,243,29,244,7,201,255,255,138,255,139,255,255],"FLAG":0,"BASE":18} - Set a template. Any JSON field is optional.

Choose user template using command module 0 or use web GUI and select top module name

Usage:

Open for any minor changes suggestion.

andrethomas commented 5 years ago

Looks good @arendst :)

@jziolkowski feature request for Tasmota Device Manager - drop downs to push the JSON? :)

netpok commented 5 years ago

Looks great, but if I get it correctly you use this template with template jsonstring, but after you set a pin you cannot change it, because it wont be a user settable pin (USER_GPIO) anymore.

arendst commented 5 years ago

Did you try it?

Jason2866 commented 5 years ago

@arendst Hope i will find time tomorrow to try!

netpok commented 5 years ago

@arendst Yes, I tried it, but now I found out the problem was on my side, I used Blitzwolf SHP as a base, because that was the only device in reach, with Generic device as base it can be changed.

andrethomas commented 5 years ago

I did a quick test setting a POW to generic and then template 6 - Should it behave like a POW after that?

Either that or I missed some step because its not showing the pin configs in the web ui...

andrethomas commented 5 years ago

Ah no I did something wrong... so false alarm :)

image

andrethomas commented 5 years ago

{"NAME":"Sonoff Pow","GPIO":[17,0,0,0,0,130,0,0,21,132,133,52,0],"FLAG":0,"BASE":6}

image

Jason2866 commented 5 years ago

Works as designed. :-) Big Thx Real cool new feature! If i had a wish ;-). Could you add Template loading and activating via "Upgrade by file upload" ? Would be easiest way to share and activate ready made Templates (from the big Tasmota community) for users with all skill levels. -> Hosting ready made Templates on a "central place" (Community will do!) Once again thank you for this great "next big thing"

09:22:40 CMD: Template
09:22:40 MQT: stat/sonoff-D4533B3B/RESULT = {"NAME":"BlitzWolf SHP","GPIO":[57,255,56,255,0,134,0,0,131,17,132,21,0],"FLAG":0,"BASE":45}

image image

arendst commented 5 years ago

Will add GUI upload too as suggested by @Jason2866

arendst commented 5 years ago

See https://github.com/arendst/Sonoff-Tasmota/blob/development/TEMPLATE.md for background information. Ready to be wikified by someone...

jziolkowski commented 5 years ago

@andrethomas

@jziolkowski feature request for Tasmota Device Manager - drop downs to push the JSON? :)

Definitely. I'm polling the firmware for available modules and gpios, so JSON Template output is easy-peasy.

Jason2866 commented 5 years ago

@arendst Thx! @jziolkowski @andrethomas @blakadder @digiblur Let us discuss in Discord how we can collect, provide templates and get the info to the users.

meingraham commented 5 years ago

I am following the addition of this new feature with great interest. I saw the TEMPLATE.md page... but I did not find what links to this page.

In the meantime, I added a page to outline a procedure for determining the GPIO configuration for a "new" device. I tried to put @digiblur's video tutorial into a step-by-step procedure. Please review/edit and let me know if it should link to the TEMPLATE instructions or vice versa. Right now I link to the procedure from the Initial Configuration page.

Regards.

Mike

andrethomas commented 5 years ago

@meingraham TEMPLATE.md outlines the implementation of https://github.com/arendst/Sonoff-Tasmota/issues/5177#issuecomment-462439713

meingraham commented 5 years ago

@andrethomas,

Yes, I am aware - this topic.

But as templates are related to configurations, it is also likely that this TEMPLATE feature will be used in conjunction with retrieving or loading the configuration of Generic modules. I thought that perhaps it would make sense for the configuration procedure page I added ought make note of this TEMPLATE feature.

Will Template be just another Command and thus a link to TEMPLATE.md needs to be added to the Commands wiki? Give the word and I am happy to make the update to the Commands page. I just did not know where this new feature should be surfaced.

Regards.

Mike

andrethomas commented 5 years ago

Ah I understand your question better now.

I think the best approach would be to add the template command to the commands page but reference it to a new entry in the wiki at https://github.com/arendst/Sonoff-Tasmota/wiki/Templates and add it to the bottom like we have links to Commands and Rules in the footer like

image

Just a suggestion as its likely to become more complex in the not so distant future.

meingraham commented 5 years ago

OK. Let's let others weigh in as well.

I definitely see that a repository of templates will be a handy addition - a page with manufacturer, device name, photo (link), model, rev level, ESP8266/8285,Tuya module etc. along with it's template. I was thinking of a table... but that formatting could get messy.

I'm making this up - just for example...

Sonoff | [Basic](photo URL) | R1 | ESP8266 | \