Page 1 of 1
Display smart meter data on remote (ESP8266) OLED
Posted: Monday 27 January 2020 22:45
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
So basically: info in Domoticz devices -> wifi -> info displayed on ESP8266+OLED.
Seems easy, isn't it?
Re: Display smart meter data on remote (ESP8266) OLED
Posted: Saturday 01 February 2020 10:42
by Kranendijk
Still thinking and thinking, haven’t found a clue to any solution till now unfortunately. Maybe my idea is sheer impossible?
Re: Display smart meter data on remote (ESP8266) OLED
Posted: Saturday 01 February 2020 11:00
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.
Re: Display smart meter data on remote (ESP8266) OLED
Posted: Sunday 02 February 2020 18:12
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
Re: Display smart meter data on remote (ESP8266) OLED
Posted: Saturday 08 February 2020 10:33
by Kranendijk
Running in circles, I just seem not to understand how it works
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
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!!
Re: Display smart meter data on remote (ESP8266) OLED
Posted: Saturday 08 February 2020 11:29
by Kranendijk
After some searching I found the httplink functionality in domoticz, have never checked this part of the system
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!
Re: Display smart meter data on remote (ESP8266) OLED
Posted: Sunday 09 February 2020 16:39
by Kranendijk
Got it working! Using below script to update my oled connected to the esp8266, running espeasy
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
Re: Display smart meter data on remote (ESP8266) OLED
Posted: Friday 29 May 2020 23:41
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.
kind regards
Paul.
Re: Display smart meter data on remote (ESP8266) OLED
Posted: Saturday 14 November 2020 21:28
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?