INT/ Float / Number of Decimals for variables to display on 7 segment etc.??

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

INT/ Float / Number of Decimals for variables to display on 7 segment etc.??

#1 Post by Oetsch » 08 Nov 2020, 08:53

Hi

for a freezer I now started to implement the application and I´m using the level control of espeasy. To make it work for a freezer, I converted the negative temperature by formula to positive. But I also use a smal TM1637 7 segment display to visualize the temp locally at the freezer. Therefor I used a rule.

Code: Select all

On TempGefrierschrank1#Temperature do
  Let 1,[TempGefrierschrank1#Temperature]
   Let 2,-1*[var#1]       // convert pos to negative
  7dn,[var#2]
  Publish %sysname%/TempGefrierschrank1/Temperature2,[var#2]
EndOn
Question I have is how to define the decimals which are shown by the display and where are this numbers defined?

[TempGefrierschrank1#Temperature] is float and has 2 descimals defined from the temperature device configuration.
[var#1] is also float %v1% would be INT, right?
So [var#2] is also float but no decimals are shown by the display.

Log says:

Code: Select all

Copied: "659893: DS   : Temperature: -17.06 (28-ff-44-db-64-15-2-bf)
659905: EVENT: TempGefrierschrank1#Temperature=17.06
659934: ACT  : Let 1,17.06
659938: ACT  : Let 2,-1*17.06
659941: ACT  : 7dn,-17.06
659944: 7DGT : Show Number=-17
659953: ACT  : Publish ESP_Gefrierschrank/TempGefrierschrank1/Temperature2,-17.06
Display is showing: -17
Is it possible to show 1 decimal?

Thx

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

Re: INT/ Float / Number of Decimals for variables to display on 7 segment etc.??

#2 Post by TD-er » 08 Nov 2020, 20:37

You could try to format the values like described here:
https://espeasy.readthedocs.io/en/lates ... red-values

Code: Select all

7dn,"-[TempGefrierschrank1#Temperature#D2.1]"

Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

Re: INT/ Float / Number of Decimals for variables to display on 7 segment etc.??

#3 Post by Oetsch » 09 Nov 2020, 08:35

Hi
thx and tried format/conversion:

Code: Select all

7dn,"-[TempGefrierschrank1#Temperature#D2.1]"

Code: Select all

850320: EVENT: TempGefrierschrank1#Temperature=17.25
850351: ACT : 7dn,'-17.2'
850353: 7DGT : Show Number=-17
Because I was no sure about the "-" setting tried also:

Code: Select all

7dn,[TempGefrierschrank1#Temperature#D2.1]

[code]41038: EVENT: TempGefrierschrank1#Temperature=16.94
41070: ACT : 7dn,16.9
41073: 7DGT : Show Number=16
So no decimal is shown by the display. What I recognized just from results above that the result is just cutted from 16.94 or 16.9 to 16 and not rounded to 17.

Sorry maybe important to know. I´m using a 4 digit TM1637 clock display without dots (ordered wrong and waiting for version with dots).
Is it anyway possible to show decimals (just 3 numbers) without a dot?

Thx

Micha_he
Normal user
Posts: 372
Joined: 07 Feb 2018, 19:14
Location: Helmstedt, Germany

Re: INT/ Float / Number of Decimals for variables to display on 7 segment etc.??

#4 Post by Micha_he » 09 Nov 2020, 08:43

Without the decimal point, you can multiply it with 10 (or 100) to get more digits, or not?

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

Re: INT/ Float / Number of Decimals for variables to display on 7 segment etc.??

#5 Post by TD-er » 09 Nov 2020, 09:02

Hmm just looked at the code of the plugin (very quick look) and there are quite a lot of commands for this plugin.
Maybe you can test them?
Most likely (judging the description) this could work: 7dtext

Others are:
7dn (meant for "number", maybe just int?)
7dt (meant for temperature)
7dst (meant for time)
7dsd (meant for date)

Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

Re: INT/ Float / Number of Decimals for variables to display on 7 segment etc.??

#6 Post by Oetsch » 09 Nov 2020, 09:53

Thx, so this is done by the plugin.
Testing at the moment.
It is 4 digit Clock display

7dtext:

Code: Select all

4606361: EVENT: TempGefrierschrank1#Temperature=17.19
4606369: ACT : 7dtext,17.19
4606371: 7DGT : Show Text=17.19
Digit 1: 1
Digit 2: 7
Clockpoints: off
Digit 3: off
Digit 4: 1

7dt:

Code: Select all

4850629: DS : Temperature: -17.44 (28-ff-44-db-64-15-2-bf)
4850631: EVENT: TempGefrierschrank1#Temperature=17.44
4850661: ACT : 7dt,17.44
4850664: 7DGT : Show Temperature=17.44
Digit 1: 1
Digit 2: 7
Clockpoints: on
Digit 3: 4
Digit 4: Degree symbol

So just testet without - convertion which means a need of a additional digit or have to see how to arrange. Nevertheless I have to wait for the delivery of the right display to make the display understandable for everybody but big thanks and now i know to format as I like.

Edit:

For this clock display I will temporarly go on with:

Code: Select all

On TempGefrierschrank1#Temperature do
  7dn,"-[TempGefrierschrank1#Temperature#D2]"
EndOn
Not having a decimal but the rounding is done right and the "-" is shown. So best compromise for me for now. Thx!

Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests