ottopaulsen / MMM-MQTT

MQTT Client module for MagicMirror2
MIT License
57 stars 29 forks source link

decimals on the module #35

Closed pationair closed 4 years ago

pationair commented 4 years ago

Sorry for my Bad English...

I habe a Problem Since an Update that an Channel could not be correct displayed...

My Number came with a "," could it be, that your module only accept a "." as separation since a update?

I hope on the picture you can See what I mean...

2020-04-06 06 51 16

ottopaulsen commented 4 years ago

Hi

Could you please attach that part of your config?

Otto

pationair commented 4 years ago

Hi,

as link @ Pastebin https://pastebin.com/KVjcWCYk or

{ topic: 'JeelinkMQTT/BadezimmerLuftfeuchte', // Topic to look for label: 'Badezimmer', // Displayed in front of value suffix: '%', // Displayed after the value
decimals: 0, // Round numbers to this number of decimals sortOrder: 20, // Can be used to sort entries in the same table maxAgeSeconds: 120, // Reduce intensity if value is older divide: 100, // Divide numeric values. Alternatively use multiply colors: [ // Value dependent colors { upTo: 10, value: "red", label: "red", suffix: "red" }, { upTo: 55, value: "green", label: "green", suffix: "green" }, { upTo: 65, value: "blue", label: "blue", suffix: "blue" }, // The last one is used for higher values too ], },

Thanks

ottopaulsen commented 4 years ago

So the problem is that the Badezimmer value is missing? Would be interesting to see how the message coming from the Badezimmer is looking. Can you show that too? I see that you divide the value by 100. Why? And is the number of decimals 0 or 6 (as you first wrote)?

Otto

pationair commented 4 years ago

Hi,

it try sometimes until the Stats where updated after restart.

it was only a try with the divide option by myself...

The Number of decimals is 0...6 was a mistake!!!

The stat came from my Sensor like shown at the picture...

ottopaulsen commented 4 years ago

So is it ok now?

pationair commented 4 years ago

No...

The 6 was a mistake i had write...

The problem is current...

ottopaulsen commented 4 years ago

Hi, sorry for late response. In order to help, I need to see what the messages on the MQTT looks like. Could you show examples on both the working messages and the non-working messages?

If you are using Mosquitto on a respberry pi, you can use the following command, adapted your config:

mosquitto_sub -h 10.0.0.15 -p 1883 -u username -P password -v -t "#"

Replace your IP, username and password, and port if necessary.

The # gives you everything. You can add more of the path to get less.

Just paste the response in here, deleting any messages you don't want/need to show. Use tripple ` above and below to get code formatting. It is easier to read.

pationair commented 4 years ago

Hey I Use MQTT.fx too Display my MQTT-Messages ![MQTT Badezimmer](https://user-images.githubusercontent.com/42006652/79365932-a07c5900-7f4b-11ea-9207-5fa68914e090.png I hope you can see the Message

ottopaulsen commented 4 years ago

Great. I can see it. So the problem may be that comma is used as decimal separator in the message. How is it in the messages that are working?

Otto

pationair commented 4 years ago

The 6 stats are from the same Type of Sensor Badezimmer, Gästebad, Kinderzimmer, Küche, Schlafzimmer and Wohnzimmer...these 6 dont work correctly...the Sensors are linked too a Jeelink stick and send these Message to my Openhab2 System

The 1 stat called Fortschritt, is a progress state from my 3d printer, this message came like displayed, whithout any Numbers after a comma

ottopaulsen commented 4 years ago

Hi

I have made a config for your decimal problem. Please update the module and try this out. You can now set what is the decimal point in the message using the config parameter decimalSignInMessage.

Example:

                    {
                        topic: 'smoky/2/inside/temperature',
                        label: 'Temp ute',
                        decimals: 1,
                        decimalSignInMessage: ",",
                        sortOrder: 20,
                        maxAgeSeconds: 60
                    },

Please let me know the result.

Regards, Otto

pationair commented 4 years ago

Hi, Really very nice Thank You!!!! 20200424_043204