Page 1 of 1

Sensor plugin with more than 4 values

Posted: 04 Feb 2019, 16:25
by BigJ466
hi,

I plan to build a smartmeter plugin for the Landis & Gyr UH550 smartmeter for district heating. It is somewhat like IEC62056-21 protocol, but only somewhat ...
Anyway the smartmeter provides many values in its readout. Is there a way to build a plugin to publish more than 4 Uservars? I thought of splitting the device and provide blocks of values, but I don't want to readout the smartmeter several times in cycle as this would increase battery consumption of the smartmeter.
Any ideas?

Thanks and cheers
BigJ

Re: Sensor plugin with more than 4 values

Posted: 04 Feb 2019, 19:54
by grovkillen
You cannot have more than four values per task but you can use events or serial output to push more values.

Re: Sensor plugin with more than 4 values

Posted: 04 Feb 2019, 21:13
by BigJ466
Thanks for your quick reply. Is there a tutorial or an example in the playground for events or serial output?
I want to transmit values via mqtt controller. Is there a solution?
Did I understand right that with an ESP32 there will be more values per task?

Best thanks, I really like ESPeasy....

Re: Sensor plugin with more than 4 values

Posted: 04 Feb 2019, 21:43
by grovkillen
We'll have more tasks, 32 instead of 12 but currently we'll settle with 4 values per task even for the ESP32. In regards of plugin creation you need to look into other plugins and how they are made. We haven't come to the stage where we have time to document that type of development. Sorry!

PS you can have a plugin that have multiple choices for what 4 values should be used. Then you can have one or more instances of that plugin (i.e multiple tasks) to have more that 4 values. Downside: you cannot be sure these are sampled at the same run. But most likely good enough...?

Re: Sensor plugin with more than 4 values

Posted: 05 Feb 2019, 09:17
by BigJ466
Thanks alot for your time.
My plugin in general is already working. I tried to setup more than four values which failed and caused exceptions and reboots.
As I still don't know to much about the architecture of ESP Easy I'm looking for best practice to gain more than four values. The module for reading smartmeter values sits with an IR rxtx head near the smartmeter and all values should be transmitted via MQTT. With only four values everything is fine. I see all values in my broker.
So what I'm looking for is a little more detail in my very special case.

Best thanks for any help.
BigJ

Re: Sensor plugin with more than 4 values

Posted: 05 Feb 2019, 12:57
by TD-er
I suggest you also take a look at how the settings struct (see ESPEasy-Globals.h) is being organized.
There you'll see how all data is arranged and thus also what happens when you try to add more than 4 output values per plugin. (data corruption)
This struct is dumped directly from memory to the SPIFFS filesystem, so if you change the order of members in the struct, it will corrupt other data in the struct.

That's also the reason why it is so hard to overcome these limits.

You can get some inspiration from the SDM energy monitor plugin to get an idea to overcome this limit.
That one has a shared object among all instances of the plugin which does the actual communication and data gathering.
So you can add multiple instances of the plugin and select different output values per instance to overcome this limit.

Such behavior cannot be done with all plugin types and it may break support with some controllers like Domoticz for that plugin.

Re: Sensor plugin with more than 4 values

Posted: 05 Feb 2019, 14:14
by BigJ466
Thanks alot for your reply.
That's what I'm looking for.
I have some restrictions: as the smartmeter should only be read once an hour due to battery consumption, I will build the plugin the way that all read data is stored in a global structure and the different module instances will only publish the according values. As smartmeter readout is already stored in a structure of OBIS/value/unit I only have to make it global. The rest is pretty simple I think :) .

Many thanks for your support.