Display smart meter data on remote (ESP8266) OLED

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
Kranendijk
Posts: 60
Joined: Wednesday 29 May 2019 14:39
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Zwolle
Contact:

Display smart meter data on remote (ESP8266) OLED

Post by Kranendijk »

Hi all,

Just got my solar panels, planning to install a counter in the electricity cabinet using S0 contact+connection to Domoticz. Also there is a P1 smart meter hooked up to the Pi.

Now I think an app is nice (Dutch firm Zonneplan) but as I have some D1 mini's and Wemos D1R2's lying around, and as well a converted I2C OLED screen I'd like to fetch the basiscs on this little screen (Delivery, Usage, ...) using i.e. ESPEasy.

However I cannot think of a solution to get/request data to/from the Wemos.

Any hints are very welcome as I have spent 2 evenings searching the www. Meanwhile I feel like reaching the end of the web :D

So basically: info in Domoticz devices -> wifi -> info displayed on ESP8266+OLED.

Seems easy, isn't it?
Kranendijk
Posts: 60
Joined: Wednesday 29 May 2019 14:39
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Zwolle
Contact:

Re: Display smart meter data on remote (ESP8266) OLED

Post by Kranendijk »

Still thinking and thinking, haven’t found a clue to any solution till now unfortunately. Maybe my idea is sheer impossible?
JanJaap
Posts: 215
Joined: Thursday 12 October 2017 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: Dev
Location: the Netherlands
Contact:

Re: Display smart meter data on remote (ESP8266) OLED

Post by JanJaap »

Hi,

I have no experience with the ESP8266 but the Wikipedia shows some firmwares on which you could build an application to fetch the relevant data from Domotixz and use the local capabilities for displaying it. Domoticz data can be retreived in JSON output.
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
Kranendijk
Posts: 60
Joined: Wednesday 29 May 2019 14:39
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Zwolle
Contact:

Re: Display smart meter data on remote (ESP8266) OLED

Post by Kranendijk »

I’ll take a look on that, thanks!

Meanwhile I have been fiddling around with lua to push data to the esp.

Part works, a part does not. Have not found a way to incorporate the idx values in the http syntax. Also domoticz tells me I am doing something wrong, see below the script.
Lua script:
Spoiler: show
-- Codes ASCII URL : http://www.w3schools.com/tags/ref_urlencode.asp
-- Variables
baseurlESPEasy = "http://192.168.2.99/control?cmd="
--

commandArray = {}

print ("Update ESP Easy Oled Display")
commandArray[1]={['OpenURL'] = baseurlESPEasy..'oledcmd,clear' }
commandArray[2]={['OpenURL'] = baseurlESPEasy..'oled,1,1,LALALALALA' }
commandArray[3]={['OpenURL'] = baseurlESPEasy..'oled,2,1,Blablabla' }
commandArray[4]={['OpenURL'] = baseurlESPEasy..'oledcmd,on' }

return commandArray
Errors:
2020-02-02 18:02:03.580 Error: Error opening url: http://192.168.2.99/control?cmd=oledcmd,clear
2020-02-02 18:02:06.700 Error: Error opening url: http://192.168.2.99/control?cmd=oled,1,1,LALALALALA
2020-02-02 18:02:09.820 Error: Error opening url: http://192.168.2.99/control?cmd=oled,2,1,Blablabla
2020-02-02 18:02:12.940 Error: Error opening url: http://192.168.2.99/control?cmd=oledcmd,on
Kranendijk
Posts: 60
Joined: Wednesday 29 May 2019 14:39
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Zwolle
Contact:

Re: Display smart meter data on remote (ESP8266) OLED

Post by Kranendijk »

Running in circles, I just seem not to understand how it works :oops:
A big thanks to @waaren to help with getting the gas counter script in domoticz to do what I need it to do. So now I have got the devices in place in domoticz and a running esp8266 with an oled screen attached to it. I use the latest espeasy image to controlthe oled. Working. I can get data to it and also as described earlier I can send json from domoticz to the esp and display that on any given line on it. This part I understand, except for the errors in the log above.

I thought node-red might give me a hand to fetch device data from domoticz to the oled and I found the IoL billboard which more or less is a showcase for me to play with it. My simple understanding of the lot is: start node-red on my pi as it is allready there, connect the espeasy using mqtt domoticz controller, change the mqtt broker in the given example and (apart from errors due to missing local sensors) the example would give me some result. Nothing happens? Pi says in node-red that it is connected to my local mqtt broker, and that is all. Mqtt is losing me here :shock:

The example including the node-red flow can be found here:
http://www.internetoflego.com/billboard ... d-display/

Any help or other tips to another solution are highly appeciated!!
Kranendijk
Posts: 60
Joined: Wednesday 29 May 2019 14:39
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Zwolle
Contact:

Re: Display smart meter data on remote (ESP8266) OLED

Post by Kranendijk »

After some searching I found the httplink functionality in domoticz, have never checked this part of the system :D
I have seen the topic https://www.letscontrolit.com/forum/viewtopic.php?t=625 and will play with that for a while. See what it does. Hopeful!
Kranendijk
Posts: 60
Joined: Wednesday 29 May 2019 14:39
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Zwolle
Contact:

Re: Display smart meter data on remote (ESP8266) OLED

Post by Kranendijk »

Got it working! Using below script to update my oled connected to the esp8266, running espeasy :D
Working on details, formatting, retrieving values and so on.Happy so far.

Code: Select all

-- Codes ASCII URL : http://www.w3schools.com/tags/ref_urlencode.asp
punt="%2E"
spatie="%20"
dubbelepunt="%3A"

-- Variables
baseurlESPEasy = "http://192.168.2.52/control?cmd="
--

commandArray =  {}

print ("Update display")
commandArray[1]={['OpenURL'] = baseurlESPEasy..'oledcmd,clear' }
commandArray[2]={['OpenURL'] = baseurlESPEasy..'oled,1,1,**'..spatie..'Domoticz'..spatie..'**' }
commandArray[3]={['OpenURL'] = baseurlESPEasy..'oled,3,1,Temp'..spatie..dubbelepunt..otherdevices_svalues['Temperatuur buiten']..spatie..'*C' }
commandArray[4]={['OpenURL'] = baseurlESPEasy..'oled,5,1,Gas'..spatie..dubbelepunt..otherdevices_svalues['Gas vandaag']..spatie..'m3' }
commandArray[5]={['OpenURL'] = baseurlESPEasy..'oled,6,1,'..spatie..dubbelepunt..otherdevices_svalues['Gasverbruik deze week']..spatie..'m3' }
commandArray[6]={['OpenURL'] = baseurlESPEasy..'oled,7,1,HET'..spatie..'WERKT!!!' }
commandArray[7]={['OpenURL'] = baseurlESPEasy..'oledcmd,on' }

return commandArray
pmarcus
Posts: 6
Joined: Wednesday 17 January 2018 22:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10256
Location: Netherlands
Contact:

Re: Display smart meter data on remote (ESP8266) OLED

Post by pmarcus »

Hello Kranendijk,

Thanks for the explanation of your search. Im looking for a long time to build something like this, so i will try to follow your example.
Will let you know if i can get it to work. :roll:

kind regards
Paul.
domotico
Posts: 3
Joined: Friday 26 December 2014 14:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Display smart meter data on remote (ESP8266) OLED

Post by domotico »

Thanks for sharing your experiences
I tried your code after experimenting with some other code from other websites that did not work for me.
But i can't get it to work.
The lines where the sensor values need to be displayed stay dark.
Only the text **domoticz** and het werkt!! Are flashing on the oled display sometimes.
I see in the log that the values are being sent properly to the esp with the display. What could be the problem?? Any idea?
Post Reply

Who is online

Users browsing this forum: Daro1003 and 1 guest