i wish to know if there is a way to set some default feed items every time a user register himself, so that every user has inside his feed the same ID items, Names and so on
i need to add that i need a default process list too, so every new user will have the same feed and process list.
i have seen API and it seems easy to create what i need, but i ended with adding just one feed at time.
i need a way to add more or less 200 feed and create a process list for every one. creating it by my hands for every single user is very time-consuming
There’s not much (any?) documentation but the discussion gives enough to be able to experiment and figure it out. It was designed for adding devices of a similar type each with a unique devicekey instead of using the emoncms account apikey and can be installed like any other Module, clone into emoncms/Modules and run admin => update db.
I have been successfully using it to auto-create inputs with complex processlists and numerous feeds for a while now and I find it not only speeds up the process but it also eliminates minor errors that always crop up when doing mundane repetitive tasks.
Basically you will need prepare a template for each node type in json with a complete processlist for each input and a full list of feeds used. that template can be used several times to create similar inputs for each account, the templates are global not per account.
for example I am doing a lot of 3 phase installs with an emonTx’s per phase reporting to an emonBase, I use a single template to configure everything for each phase by creating 3 devices.
I then have another template to deal with some system stats I send from each emonBase (cpu_temp, wifi signal etc).and in that device template I also have some 3phase calculations and sub-totalling of the other nodes.
Overall it saves me hours and hours per account, but it isn’t perfect, for instance the totalling of the other nodes is not straight forward as the device Module cannot identify existing feeds, it just creates the new feeds you specify and before it creates the inputs it checks all the required feeds exist, I have tried 2 methods and the jury’s still out.
Method one is the easiest to setup as it is a single template where I just use a dummy feedid anywhere a pre-configured feed should be eg instead of
L1-power + L2-power + L3-power log to feed total_power I have
dummy + dummy + dummy = total-power which I can then edit afterwards using the edit processlist dropdown boxes to select the correct feed.
Method 2 is still work in progress as it is quite complex and it involves a bash script that I run to fetch the feedids I need and generate a bespoke template from a generic template, which I then use just for that one account. There is an api for the device creation too which is useful for a fuller automation.
Once all the nodes/devices are created for an account I delete the devices from the device page to prevent accidentally rerunning the device template and doubling up the feeds etc, there is no safety switch to prevent this so as I do not use the device keys I use once and delete.(this doesn’t delete the inputs or feeds etc just the “device” details)
It will get you much closer to what you desire but probably not all the way, I would certainly be totally lost without it now it has saved me many days of mundane repetitive work. (thank you so much @nchaveiro )
There is also the “emoncms device Wizard” which appears to be more user friendly but not so flexible or manageable. There was a mention of these joining forces but there has been no further news to my knowledge
I hope this helps, admittedly it will not work as each user registers but you could pre-build a batch of user accounts, delete those “users” from the user db table and set back the auto-incrementer so that each new user acquires a pre-built set of inputs when they are re-issued a pre-configured userid.
thanks a lot Paul
it is very interesting, but i have a problem installing the module.
I copied the folder “device-master” inside “Modules” folder, and in the menu Setup->Administration->Update database if I click Updare & check I only see “Database is up to date - Nothing to do”
am I missing something?
not sure but rename the directory to “device” and see if it comes up this way
now it is installed and i can see it inside Setup menu
now i will start playing with it and i hope to reach my goal.