ESPEasy Help + OLED SSD1306 + DHT + Rules

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
PandCall
Normal user
Posts: 44
Joined: 22 Sep 2022, 20:04

ESPEasy Help + OLED SSD1306 + DHT + Rules

#1 Post by PandCall » 22 Sep 2022, 20:35

First thing to know, I display the temperature and humidity perfectly on the display.
I use only two lines to have a readable size.
But I try to replace one of the lines temporarily with the command

oledframedcmd,<line>,<text>

in one of my rules.
It works perfectly, for example

oledframedcmd,1,122 %

Displays 122% correctly on the first line of the display.

What I can't do is to make the Temperature variable return
T: [DHT22#Temperature] °C

What I am trying to do is to display Temperature + Humidity and temporarily use line 1 or 2 to display another information but it does not stay there and it returns to the initial display.

Do you have an idea of what to do to be able to either do a Reset of the display, to restart the display of the Temperature/Humidity?
Regards

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

Re: ESPEasy Help + OLED SSD1306 + DHT + Rules

#2 Post by TD-er » 22 Sep 2022, 20:40

The Framed OLED plugin does allow for several "pages".
The task will switch to a new "page" when there are non-empty lines with a line nr larger than what can fit on a single page.

The "interval" setting determines how long a "page" will be shown.

About the degree symbol (not sure if that's also a problem you're facing) You can use {D} to make the degree symbol.

PandCall
Normal user
Posts: 44
Joined: 22 Sep 2022, 20:04

Re: ESPEasy Help + OLED SSD1306 + DHT + Rules

#3 Post by PandCall » 22 Sep 2022, 20:55

A first autoreply
My command
oledframedcmd,1, "T: [DHT22#Temperature] °C"
changes the display correctly
But no more automatic refresh of the temperature on line 1.

PandCall
Normal user
Posts: 44
Joined: 22 Sep 2022, 20:04

Re: ESPEasy Help + OLED SSD1306 + DHT + Rules

#4 Post by PandCall » 22 Sep 2022, 21:06

Thanks TD-er
Ok I understand the workarround

oledframedcmd,4,122

then a delay
Then
oledframedcmd,4
Without message, only the first page is displayed.
This is not a stupid method, if there is no other.
Thanks for the tip.

I don't have a problem with the degree symbol at the moment, but I'll keep your comment in a corner.
Regards

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

Re: ESPEasy Help + OLED SSD1306 + DHT + Rules

#5 Post by Ath » 22 Sep 2022, 21:39

PandCall wrote: 22 Sep 2022, 21:06 then a delay
I hope you're not using the delay command, as that will block all execution of ESPEasy for the duration.
The page rotation delay is determined by the Interval setting on the display configuration. If you set that to 5 (seconds) that should be a reasonable refresh rate (default is 60, that's rather long).

Edit:
The alternative to delay is the use of a timer, so to set a message:

Code: Select all

on setmessage* do
  oledframedcmd,4,"%eventvalue1%"
  oledframedcmd,frame,2 // switch to the new message
  timerset,1,60 // Clear message after 60 seconds using timer 1 (of 256)
endon

on rules#timer=1 do
  oledframedcmd,4
endon
You can set the message from the Tools tab, by sending event,setmessage="text to display"
The text must be wrapped in quotes if it contains spaces or commas.
Last edited by Ath on 22 Sep 2022, 23:32, edited 2 times in total.
/Ton (PayPal.me)

PandCall
Normal user
Posts: 44
Joined: 22 Sep 2022, 20:04

Re: ESPEasy Help + OLED SSD1306 + DHT + Rules

#6 Post by PandCall » 22 Sep 2022, 21:43

no, Delay was just to indicate

I run the command
I wait for some time
then I restart the command to return to the initial state of the display.
:D

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

Re: ESPEasy Help + OLED SSD1306 + DHT + Rules

#7 Post by Ath » 22 Sep 2022, 21:51

I edited my previous reply while you replied to that :o :lol:
/Ton (PayPal.me)

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

Re: ESPEasy Help + OLED SSD1306 + DHT + Rules

#8 Post by TD-er » 22 Sep 2022, 22:08

Glad you didn't use the delay command in the rules.
I still need to get rid of that, or maybe set off some alarms, change the web UI background into flickering red etc. :)
As Ton suggested, you better use some timers to trigger time based or periodical events.
Maybe even looptimer as that one will automatically set the next timer based on when the previous one should have been executed, thus not introducing drift over time.

PandCall
Normal user
Posts: 44
Joined: 22 Sep 2022, 20:04

Re: ESPEasy Help + OLED SSD1306 + DHT + Rules

#9 Post by PandCall » 22 Sep 2022, 22:12

Thanks for the example in the answer, it will help me to go faster.
But yes, that's the idea.
Display a one-time message for a moment, then go back to normal.

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

Re: ESPEasy Help + OLED SSD1306 + DHT + Rules

#10 Post by Ath » 22 Sep 2022, 22:27

After setting the message you can also use the command 'oledframedcmd,frame,2' to activate the second page/frame immediately. Then choosing a somewhat longer Interval is more useful, so the message will be displayed for some time. Once the message is cleared by the timer it will resume at the initial page.
/Ton (PayPal.me)

PandCall
Normal user
Posts: 44
Joined: 22 Sep 2022, 20:04

Re: ESPEasy Help + OLED SSD1306 + DHT + Rules

#11 Post by PandCall » 22 Sep 2022, 22:43

@Ath, not sure about your method, I just tested and nothing happens.
In the configuration of my OLED, I have only 2 lines configured, the third information is dynamic,
she comes according to several criteria, state of a sensor, MQTT information, others in the Rules.

User avatar
chromo23
Normal user
Posts: 821
Joined: 10 Sep 2020, 16:02
Location: germany

Re: ESPEasy Help + OLED SSD1306 + DHT + Rules

#12 Post by chromo23 » 22 Sep 2022, 22:59

TD-er wrote: 22 Sep 2022, 22:08 I still need to get rid of that, or maybe set off some alarms, change the web UI background into flickering red etc. :)
You are working on that to happen right now. :D
In case you forgot:
warning (1).gif
warning (1).gif (144.16 KiB) Viewed 2898 times

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

Re: ESPEasy Help + OLED SSD1306 + DHT + Rules

#13 Post by Ath » 22 Sep 2022, 23:34

PandCall wrote: 22 Sep 2022, 22:43 @Ath, not sure about your method, I just tested and nothing happens.
updated the code above to show what I mean
/Ton (PayPal.me)

PandCall
Normal user
Posts: 44
Joined: 22 Sep 2022, 20:04

Re: ESPEasy Help + OLED SSD1306 + DHT + Rules

#14 Post by PandCall » 28 Sep 2022, 09:11

I keep all your suggestions in a corner, my code for the moment works (without this option).
I'm busy at the moment with the 3D design of the project and it takes a lot of time.
But as soon as everything is in the box, I will work on this part of the code for the display.
Thanks for all your feedback which is very precious.
Regards

Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests