Plugins - how to upload to Playground?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
AndrewJ
Normal user
Posts: 229
Joined: 14 Feb 2017, 12:38

Plugins - how to upload to Playground?

#1 Post by AndrewJ » 02 Apr 2017, 22:22

Hi everyone, Can anyone point me to a step by step guide how to upload a new plugin to the Playground on Github, please? I have one in development which I'd like to share and ask for help from forum members. It's for an Analogue AC current sensor TA12-100.
TIA.
Andrew

krikk
Normal user
Posts: 118
Joined: 28 Feb 2017, 07:57
Location: Austria
Contact:

Re: Plugins - how to upload to Playground?

#2 Post by krikk » 02 Apr 2017, 22:33

it's nice that you want to give something back, but this sensor you are using is only a derivation of the ADC Plugin we already have... you read an analog value, this can be done with:

https://www.letscontrolit.com/wiki/index.php/Analog

and due to limited resources on the esp8266 is is not really a good idea to create a plugin for every new analog sensor, especially is they only differ in the calculation they are doing...

i had a quick look at you sensor (http://henrysbench.capnfatz.com/henrys- ... -tutorial/ and to me it seems like you could simply solve this with using the existing ADC Plugin with using a formula to do the calculations...

...if you still think we need a new plugin for it, best way would be to submit a pull request...

AndrewJ
Normal user
Posts: 229
Joined: 14 Feb 2017, 12:38

Re: Plugins - how to upload to Playground?

#3 Post by AndrewJ » 03 Apr 2017, 20:54

Hello @krikk, and thanks for the fast reply.
My plugin is indeed based on the Henrys Bench code for the Arduino, and on the Analog Plugin you referred to. The reason I felt it would be desirable to construct a new plugin was as follows.
As I'm wanting to measure mains alternating current at 50Hz, there is a need to identify the highest and lowest instantaneous current (which is measured as an analog voltage output from the sensor module) to provide the peak-to-peak current reading. The Henrys code (for Arduino) uses an interrrupt routine to sample the voltage many times in each 1/50th-second cycle of the AC, for a period of 5 seconds, and stores the highest (and lowest in some versions). The main loop then does the calculations to convert to AC current, just once every cycle of the main loop (5 secs). I could see this last part could be done in a formula in the existing Analog plugin, but would this provide a way of doing the interrupt code, which needs to run many times in a 50th of a second? It's that part which made me feel that a specific plugin was needed, which starts with the Analog Plugin and adds the interrupt code. Does my logic make sense, or is there a better way?

krikk
Normal user
Posts: 118
Joined: 28 Feb 2017, 07:57
Location: Austria
Contact:

Re: Plugins - how to upload to Playground?

#4 Post by krikk » 04 Apr 2017, 10:12

i also wanted to monitor current with espeasy, but i discarded the idea after reading all the info on https://learn.openenergymonitor.org/ele ... troduction about it, to sum it up, you need a faster sampling than the esp8266 can provide it, as far as i have read...

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Plugins - how to upload to Playground?

#5 Post by grovkillen » 04 Apr 2017, 12:45

I very much like the Analog Sensor plugin but wish there was a way to add information about formulas and setup within the wiki. I have a analog light sensor (BH1750) and have made a formula to present the value in a more relevant manner but I had to make the calculations myself. It would be great to have a place to post the setup (preferably the wiki).

Also the Analog Sensor plugin might be possible to update to have more outputs than it has today? I.e. high low values between outputs etc. etc.?

I don't think a separate plugin for each new type of device is a good approach, it will be very divergent in the long run.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

krikk
Normal user
Posts: 118
Joined: 28 Feb 2017, 07:57
Location: Austria
Contact:

Re: Plugins - how to upload to Playground?

#6 Post by krikk » 04 Apr 2017, 18:27

the BH1750 (i2c, not analog) sensor gives direct lux readings! ? ...what formula do you need there?

AndrewJ
Normal user
Posts: 229
Joined: 14 Feb 2017, 12:38

Re: Plugins - how to upload to Playground?

#7 Post by AndrewJ » 04 Apr 2017, 19:33

I'm pleased to say that I have had my Plugin for AC mains current working in its present (rather rough and ready) form for over a month, so it appears that the ESP8266 can handle it. In fact, the same module (NodeMCU with 4096 flash memory) is also measuring three temperatures (DS18B20's) and has a dummy variable and a rule to calculate the temperature difference between two of them. The interrupt routine to get the peak current is at the end of the plugin, which I based on other plugins which use interrupts. And it is sending data (AC RMS current, estimated power) as well as the temperatures reliably via MQTT to my openHAB system.

The issues I have are in a sense cosmetic. The AC current and power values being measured are not being displayed in the Devices page. I'll start another thread and attach my code in its present form together with screen shots, in the hope that people with more experience of writing plugins than me willkindly give me some advice. ;)

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Plugins - how to upload to Playground?

#8 Post by grovkillen » 05 Apr 2017, 06:02

krikk wrote: 04 Apr 2017, 18:27 the BH1750 (i2c, not analog) sensor gives direct lux readings! ? ...what formula do you need there?
First of all, I use a analog light resistor (not a BH1750, my mistake sorry). But anyways, I like the analog approach regarding light. LUX is a scientific unit more than practical. The analog value is converted to %, 0% is a dark room (1V), 100% is direct daylight/lamplight (3.3V).

Much easier to understand.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

AndrewJ
Normal user
Posts: 229
Joined: 14 Feb 2017, 12:38

Re: Plugins - how to upload to Playground?

#9 Post by AndrewJ » 05 Apr 2017, 21:22

Hi all, Thanks for the responses. There is obviously a lot of interest in Plugins and information to make them easier to use!

Just repeating my original question, can anyone point me to a short guide to help me upload a plugin to the Plugin Playground, please?

(I already have a Github account, which I've used to clone the ESPEasy dev7, - it's going the other way and submitting a new file to the playground which is not clear to me.)

Regards, AndrewJ.

krikk
Normal user
Posts: 118
Joined: 28 Feb 2017, 07:57
Location: Austria
Contact:

Re: Plugins - how to upload to Playground?

#10 Post by krikk » 05 Apr 2017, 21:26

if you want to add something to a repository you do not have write access to you do a pull request from your fork:

see here how to do this:
https://www.letscontrolit.com/wiki/inde ... evelopment

especially: https://www.letscontrolit.com/wiki/inde ... To_ESPEasy

...it is all on the wiki... :)

AndrewJ
Normal user
Posts: 229
Joined: 14 Feb 2017, 12:38

Re: Plugins - how to upload to Playground?

#11 Post by AndrewJ » 05 Apr 2017, 21:29

Thanks, krikk, just the thing. :D

Post Reply

Who is online

Users browsing this forum: No registered users and 45 guests