How could I read any object data from my iobroker with ESPEasy

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
bastler11
Normal user
Posts: 101
Joined: 11 Jan 2021, 21:58
Location: Luebeck

How could I read any object data from my iobroker with ESPEasy

#1 Post by bastler11 » 14 Nov 2022, 18:23

Hello,

I want to present the actual excess energy datapoint from my iobroker on a display. So I prepared an ESP8266 with ESPEasy and connected an OLED display. This work fine now (thanks to Ath). But how could I read any data from the iobroker? If I want to send from the ESP8266 any data to iobroker, I have to setup the MQTT controller in ESPEasy and I must start the MQTT Adapter in iobroker. But now it is the different direction. How could I send any data from iobroker and how could I receive this data with ESPEasy?

Thanks and best regards.

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

Re: How could I read any object data from my iobroker with ESPEasy

#2 Post by TD-er » 14 Nov 2022, 22:48

You can use the MQTT import plugin.
To receive commands via MQTT, you can use C005: https://espeasy.readthedocs.io/en/lates ... #c005-page

bastler11
Normal user
Posts: 101
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: How could I read any object data from my iobroker with ESPEasy

#3 Post by bastler11 » 15 Nov 2022, 12:52

Thanks, I will try to use it. :)

bastler11
Normal user
Posts: 101
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: How could I read any object data from my iobroker with ESPEasy

#4 Post by bastler11 » 17 Nov 2022, 20:49

Hello TD-er,

I´m not able to realise it. My first step to find out how to work with the display, I tried to show the temperature of the connected DS18B20 temperature sensor. It worked with [Name#Temp]. But how could I take the value of the currentFeedIn which I have in the objects of my ioBroker? The MQTT adapter is working and receive the value of the DS18B20. But how could I subscribe the value of currentFeedIn and what have I to write in the line of the display [xxxxx#yyyyy]? something like this? And how have I to use the /cmd command?
Attachments
Screenshot-15-18-2022_05.18.16.jpg
Screenshot-15-18-2022_05.18.16.jpg (286.21 KiB) Viewed 2778 times

User avatar
Ath
Normal user
Posts: 3418
Joined: 10 Jun 2018, 12:06
Location: NL

Re: How could I read any object data from my iobroker with ESPEasy

#5 Post by Ath » 17 Nov 2022, 21:09

You can use the MQTT Import plugin, and subscribe that to the MQTT topic(s) you want to monitor.
Then you can use the [<taskname>#<valuename>] notation in the display Lines, similar to the DS18b20 sensor, to display those values.
/Ton (PayPal.me)

bastler11
Normal user
Posts: 101
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: How could I read any object data from my iobroker with ESPEasy

#6 Post by bastler11 » 18 Nov 2022, 21:29

Hello Ath, I tried to realise it, but it does not works? All values are shown with 0, but that is not correct. The values currentPower is 450W.
So could you tell me were is my mistake?

Here some screenshots: objects in ioBroker, MQTT import, devices overview, setting
Attachments
Screenshot-18-18-2022_09.18.55.jpg
Screenshot-18-18-2022_09.18.55.jpg (216.42 KiB) Viewed 2756 times
Screenshot-18-09-2022_09.09.14.jpg
Screenshot-18-09-2022_09.09.14.jpg (207.36 KiB) Viewed 2756 times
Screenshot-18-11-2022_09.11.50.jpg
Screenshot-18-11-2022_09.11.50.jpg (78.36 KiB) Viewed 2756 times
Screenshot-18-11-2022_09.11.08.jpg
Screenshot-18-11-2022_09.11.08.jpg (137.4 KiB) Viewed 2756 times

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

Re: How could I read any object data from my iobroker with ESPEasy

#7 Post by TD-er » 18 Nov 2022, 21:51

You didn't enter the topic prefix. (the same beginning for all topics you need)
According to the screenshot you posted, it should be something like this:
powerfox2/0/devices/240ac415c74c

I don't know if the messages are just numerical values, or maybe also include the stuff like "kWh".
Not sure what the import plugin will make of those, but perhaps it will filter out the numerical stuff just fine :)

bastler11
Normal user
Posts: 101
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: How could I read any object data from my iobroker with ESPEasy

#8 Post by bastler11 » 19 Nov 2022, 07:52

Thanks, I added the prefix, but no change. But after typing slash before the topics it worked. :) As you write I had to add "W" vor the value.

Thanks all for your help and patience :)

bastler11
Normal user
Posts: 101
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: How could I read any object data from my iobroker with ESPEasy

#9 Post by bastler11 » 19 Nov 2022, 08:16

One more thing, the value I could see will not be updated? It shows only 476.00W? To start the ESP new didn't help.
Attachments
Screenshot-19-15-2022_08.15.42.jpg
Screenshot-19-15-2022_08.15.42.jpg (233 KiB) Viewed 2742 times
Screenshot-19-09-2022_08.09.25.jpg
Screenshot-19-09-2022_08.09.25.jpg (73.58 KiB) Viewed 2742 times
Screenshot-19-14-2022_08.14.34.jpg
Screenshot-19-14-2022_08.14.34.jpg (427.64 KiB) Viewed 2742 times

bastler11
Normal user
Posts: 101
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: How could I read any object data from my iobroker with ESPEasy

#10 Post by bastler11 » 19 Nov 2022, 11:38

Where does the value 476 come from? Also when I create a new Generic - MQTT Import, it shows 476.It seems that after the first reading the value is fix stored? Reboot the ESP didn't help.

User avatar
Ath
Normal user
Posts: 3418
Joined: 10 Jun 2018, 12:06
Location: NL

Re: How could I read any object data from my iobroker with ESPEasy

#11 Post by Ath » 19 Nov 2022, 12:12

The value on the display will be updated every 'Interval' seconds, as configured on the display task.
The values on the MQTT Import task should update every time a new, recognized, MQTT message is received, that plugin doesn't have (or need) the 'Interval' setting.

If you want to update the display immediately when a new value is received via MQTT, you can add rules for that:

Code: Select all

on MQTTin do // Will trigger for every MQTTin received value, change to MQTTin#Value1 to only respond to Value1 changes
  TaskRun,SSD1306 // Use the Name, or number, of the Display task here
endon
/Ton (PayPal.me)

bastler11
Normal user
Posts: 101
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: How could I read any object data from my iobroker with ESPEasy

#12 Post by bastler11 » 19 Nov 2022, 12:44

I tried to take other objects.I took it from my photovoltaic system. First the value of the total energy is not correct, instead of 4548Wh it shows only 2814Wh, and the value didn't change. Also when I try to write under formula %value%*2 nothing happens? It will be shown 2814. Did I make any thing wrong or is there a bug?
Last edited by bastler11 on 19 Nov 2022, 12:54, edited 1 time in total.

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

Re: How could I read any object data from my iobroker with ESPEasy

#13 Post by TD-er » 19 Nov 2022, 12:52

bastler11 wrote: 19 Nov 2022, 11:38 Where does the value 476 come from? Also when I create a new Generic - MQTT Import, it shows 476.It seems that after the first reading the value is fix stored? Reboot the ESP didn't help.
For your information, the taskvalues for every task are stored in "RTC" memory.
This is kept as long as the ESP is powered. On a reboot, these values (when the checksum matches) are restored.
Seeing an old value can thus be cunfusing when trying to figure out why things are not working.

Another thing to keep in mind.
The values on the "Devices" tab are being refreshed using some JavaScript.
This script does periodically fetch JSON from the ESP containing the latest values.
However the interval used to fetch this JSON is based on the lowest set "Interval" value of all tasks.
Thus when all (enabled) tasks have a relatively long interval, it may take a while for the values on the Devices tab to update.
It may then appear nothing is happening.
So you can also add some task to use the "system info" plugin and set that task to an interval of 1sec.
This way the values on de Devices tab will update every second.

bastler11
Normal user
Posts: 101
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: How could I read any object data from my iobroker with ESPEasy

#14 Post by bastler11 » 20 Nov 2022, 18:13

Hello, I tried to realise it, it didn´t work. I changed the topics from row 1 to 2 and from row 2 to 1. and the values I could see in the overview will also change. But, all values I want to show, appears but will not be updated. Now I startet a MQTT Explorer and I could see, that the values I want to show didn't change? But in the object list from the iobroker it changes. You see it in the attached screenshot. The big picture shows in the blue marked line the value 256W and in the small window (grey marked line) you see in the MQTT Explorer still the old value 176, it does not change. It seems that the first read value will store in the memory of the ESP and instead of taking a new one value it take only the stored value. I rebooted the iobroker. Than I could see in the MQTT Explorer new values and this will also shown in the MQTT plugin and in the display. But again nor updates? So the system seems working. Do you have any idea were is the problem and how could I solve it?
Attachments
Screenshot-20-59-2022_01.59.09.jpg
Screenshot-20-59-2022_01.59.09.jpg (464.3 KiB) Viewed 2697 times

bastler11
Normal user
Posts: 101
Joined: 11 Jan 2021, 21:58
Location: Luebeck

Re: How could I read any object data from my iobroker with ESPEasy

#15 Post by bastler11 » 05 Dec 2022, 08:57

Hello,

I found a very easy solution for my problem. I had do mark in the setting from the MQTT adapter the function "Send states also". Now I could see all datapionts I want on my display.

Best regards

Ingo
Attachments
Screenshot-04-27-2022_03.27.02.jpg
Screenshot-04-27-2022_03.27.02.jpg (257.3 KiB) Viewed 2485 times

Post Reply

Who is online

Users browsing this forum: No registered users and 23 guests