Adding a new device type

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
rowan.bradley
Normal user
Posts: 22
Joined: 25 Mar 2018, 15:30

Adding a new device type

#1 Post by rowan.bradley » 02 May 2018, 10:41

What process do I have to go through to add a new device type to ESPeasy? Where is this documented? Is there a getting started guide or tutorial somewhere?

What I want to do is to use ESPeasy to make all the data from my solar PV inverter available via WiFi. It needs to be WiFi because the inverter is in my garage, and I really don't want to have to run a cable from the garage to the house. The inverter has an RS485 interface, and I'm reasonably confident that I can reverse engineer the protocol it uses to supply information about the power being generated by each section of the inverter, the cumulative total energy produced, maxima and minima etc. This will give me valuable information about how my solar panels are performing, whether they need attention or cleaning etc. So the concept is that I connect the RS485 output to a GPIO on the ESPeasy, and write some code to interpret the data being supplied and make it available in a form that Domoticz can access.

Is this a sensible approach, and a good solution to this requirement?

Any hints on how to get started with this would be welcome.

Thanks - Rowan

xury
Normal user
Posts: 44
Joined: 02 Apr 2018, 12:54

Re: Adding a new device type

#2 Post by xury » 02 May 2018, 11:42

Look at how other plugins are written.
In my opinion, you should connect the Uart-RS485 converter between inverter and the UART of esp8266 board.
Then after conversion, you can parse data like ser2net.

sentinel
Normal user
Posts: 55
Joined: 02 Dec 2017, 17:40

Re: Adding a new device type

#3 Post by sentinel » 02 May 2018, 21:48

you can take a look at the ESPEasyDevelopment page and also in the file "_Pxxx_PluginTemplate.ino" which is included in the source files and contains information on how plugins are implemented.

rowan.bradley
Normal user
Posts: 22
Joined: 25 Mar 2018, 15:30

Re: Adding a new device type

#4 Post by rowan.bradley » 04 May 2018, 19:01

Thank you, those are helpful resources.

My PV inverter has 12 separate values that I would like to be able to read:
1. Input 1 Voltage
2. Input 1 Current
3. Input 1 Power
4. Input 2 Voltage
5. Input 2 Current
6. Input 2 Power
7. Output Voltage
8. Output Current
9. Output Power
10. Inverter Temperature
11. Internal Temperature
12. Daily Energy

It doesn't sound as if this fits the ESP Easy architecture very well (it seems designed primarily to return a single sensor value). How do I deal with this? I suppose that I might be able to do without a few of these values. It is not clear whether I need the power as well as the voltage and current for each inverter input, or whether I can just assume that the power is the voltage times the current. This may not always be good enough if the power factor is not 1, and can vary between the two inputs, or from time to time. Also it may prove unnecessary to read the Daily Energy figure, if I read the power every 60 seconds or so, and add them all up within Domoticz to generate the total energy for the day. But for now I would like to assume that I need to read all 12 values. What is the best way to implement this within ESPeasy?

Thanks - Rowan

TD-er
Core team member
Posts: 3525
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Adding a new device type

#5 Post by TD-er » 05 May 2018, 00:17

You could split the outputs into groups and make such a group selectable.
For example these 3 groups all have the same sensor values:
  • Input 1
  • Input 2
  • Output
Per plugin up to 4 sensor values are supported.
You could then set 3 or 4 of these plugins active, but you may want to add a separate class to collect the data, from which these plugins collect their data.

rowan.bradley
Normal user
Posts: 22
Joined: 25 Mar 2018, 15:30

Re: Adding a new device type

#6 Post by rowan.bradley » 05 May 2018, 18:26

Thank you for this suggestion. I partly understand what you mean (i.e. I understand in principle - whether I can implement this in detail remains to be seen). I will start my design using this approach, and ask more questions if I need to later.

Thanks - Rowan

Post Reply

Who is online

Users browsing this forum: No registered users and 31 guests