Sensor plugin with more than 4 values

Moderators: Voyager, BertB, rtenklooster, Stuntteam, grovkillen, TD-er

Post Reply
Message
Author
BigJ466
Normal user
Posts: 4
Joined: 04 Feb 2019, 16:11
Location: Ruhrgebiet / Germany

Sensor plugin with more than 4 values

#1 Post by BigJ466 » 04 Feb 2019, 16:25

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

User avatar
grovkillen
Normal user
Posts: 2990
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Sensor plugin with more than 4 values

#2 Post by grovkillen » 04 Feb 2019, 19:54

You cannot have more than four values per task but you can use events or serial output to push more values.
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:

BigJ466
Normal user
Posts: 4
Joined: 04 Feb 2019, 16:11
Location: Ruhrgebiet / Germany

Re: Sensor plugin with more than 4 values

#3 Post by BigJ466 » 04 Feb 2019, 21:13

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....

User avatar
grovkillen
Normal user
Posts: 2990
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Sensor plugin with more than 4 values

#4 Post by grovkillen » 04 Feb 2019, 21:43

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...?
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:

BigJ466
Normal user
Posts: 4
Joined: 04 Feb 2019, 16:11
Location: Ruhrgebiet / Germany

Re: Sensor plugin with more than 4 values

#5 Post by BigJ466 » 05 Feb 2019, 09:17

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

TD-er
Normal user
Posts: 1201
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Sensor plugin with more than 4 values

#6 Post by TD-er » 05 Feb 2019, 12:57

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.

BigJ466
Normal user
Posts: 4
Joined: 04 Feb 2019, 16:11
Location: Ruhrgebiet / Germany

Re: Sensor plugin with more than 4 values

#7 Post by BigJ466 » 05 Feb 2019, 14:14

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest