Announcement

Collapse
No announcement yet.

Decimal numbers

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Decimal numbers

    I'm playing with mqtt on my hs3 project.
    Sonoff (tasmota) and mqtt is a great solution.
    Now I'm testing a NODEMCU with tasmota firmware with connected 2 1-wire sensor.
    I don't know if i related to decimal separation, i Italy I use "," not the dot. The payload on mqtt plugin is for example "22.8", but on hs3 devices list show up "228".
    I added "$$PAYLOAD:/1" in the Expression tab and now in the HS3 devices list I can see "22,8" (with comma); but if I want to graph the value I see 228-229-232-229. I can see only integer.
    Are there any other setting in the mqtt plugin?
    I'm checking also on tasmota firmware if are there some local setting (comma instead of dot).
    Thanks
    Cris

  • #2
    You are using 2 1-wire sensors ?

    In user_config.h

    // -- One wire sensors ----------------------------
    // WARNING: Select none for default one DS18B20 sensor or enable one of the following two options for multiple sensors
    //#define USE_DS18x20 // Optional for more than one DS18x20 sensors with id sort, single scan and read retry (+1k3 code)
    //#define USE_DS18x20_LEGACY // Optional for more than one DS18x20 sensors with dynamic scan using library OneWire (+1k5 code)

    #define USE_DS18x20 - Uncomment this one :-)
    HS 2.2.0.11

    Comment


    • #3
      Originally posted by petez69 View Post
      You are using 2 1-wire sensors ?

      #define USE_DS18x20 - Uncomment this one :-)
      Yes, already done!
      I already using nodemcu with 2 1-wire sensors connected.
      Nodemcu is sending payload temperatures.
      My problem is related to localization:
      Nodemcu/tasmota send for example "28.3" (with dot as decimal separation). My HS3 system as a italian localization (use comma, no dot for decimal). On mqtt plugin I see payload "28.3", on HS3 devices list I see 283.
      Adding "$$PAYLOAD:/1" in the mqtt setup plugin Expression tab, I solve the devices list issue and I see "28,3" (with comma). It's ok, but if I want to graph the temperature, all data are integer, no comma or dot for decimal separation.

      Comment


      • #4
        Ok :-)

        Leave that one for Michael !! Good luck !
        HS 2.2.0.11

        Comment


        • #5
          The chart is based upon raw messages saved to the database. When the HS devices are populated they are filtered through the regular (text) and numeric expressions. I had not considered using filters for the chart data. I will look into it.

          As a note, the regular expression rather than the numeric expression may be a preferred method to handle localization. There is an example in the mcsMQTT manual of using regular expression to change the period to a comma.

          Comment


          • #6
            I included the Numeric expression with $$PAYLOAD: substitution and the Regular expression processing on the chart display. This should match the chart and the HS device numbers. It is 3.4.7.0 that has been submitted to updater and is available earlier at http://mcsSprinklers.com/mcsMQTT_3_4_7_0.zip

            Comment

            Working...
            X