Git Product home page Git Product logo

Comments (10)

soif avatar soif commented on May 25, 2024

(grrr GH closed the Pull-Request and I cant reopen it) so here again, to @pepijng :

  1. About units
    We need to make this "Water proof". I mean , that we have to always parse the correct value and store it as a valid float, whatever the language used. (The template already take care to reformat it according to the user defined locale). So what I dont understand, is why you get for example "CounterToday" : "15.000 kWh""
    If I follow you, this must be (float) 150000.0 KW, right? SO why the fuck is Domoticz return it as this?
    Is "." the Dutch way to format thousands? And addionnally, are there any decimals possibly displayed?
    I mean:
    in US format I would display:
    15,000.5 KWH = (float) 15000.5
    In french I would display
    15 000,5 KWH = (float) 15000.5
    In Dutch
    15.000(?)5 KWH = (float) 15000.5 ?????????????
    Yes?

So Domoticz returns a localised value in the API (absolutely dumb!) ?

  1. about your second question, Checkout the develop branch : The dashboard should already display the Device unit.

from phpmydomo.

soif avatar soif commented on May 25, 2024

BTW : there are 2 words still needing a NL translation!

from phpmydomo.

pepijng avatar pepijng commented on May 25, 2024

I will update the translation. See the attached output from Domoticz and PMD
screen shot 2013-12-16 at 16 07 21
screen shot 2013-12-16 at 16 07 30

There still is a decimal issue, the "." is used for decimals not for separating the thousands.

from phpmydomo.

soif avatar soif commented on May 25, 2024

Please answer my previous question about unit, if you can.

Else, please provide me the corresponding dump of this sensors (uncomment the $this->debug(devices) in the api_client), to help me to understand how units are handled in the API.

We need to fix this decimal/thousand issue before releasng the next version. ;-)

from phpmydomo.

pepijng avatar pepijng commented on May 25, 2024

[sensor_counter_2_today] => Array
(
[address] => 2
[name] => Gasmeter
[battery_level] => 255
[signal_level] => 12
[raw] => Array
(
[BatteryLevel] => 255
[Counter] => 3378.367
[CounterToday] => 5.473 m3
[CustomImage] => 0
[Data] => 3378367
[Favorite] => 1
[HardwareID] => 1
[HardwareName] => P1 Smart Meter
[HaveTimeout] =>
[ID] => 1
[LastUpdate] => 2013-12-16 22:50:21
[Name] => Gasmeter
[Notifications] => false
[SignalLevel] => 12
[SubType] => Gas
[SwitchTypeVal] => 1
[Timers] => false
[Type] => P1 Smart Meter
[TypeImg] => counter
[Unit] => 2
[Used] => 1
[idx] => 2
)

        [class] => sensor
        [type] => counter
        [value] => 5473.3
        [unit] => m3
        [uid] => sensor_counter_2_today
        [img_type] => counter
    )

[sensor_consum_2_now] => Array
    (
        [address] => 2
        [name] => Gasmeter
        [battery_level] => 255
        [signal_level] => 12
        [raw] => Array
            (
                [BatteryLevel] => 255
                [Counter] => 3378.367
                [CounterToday] => 5.473 m3
                [CustomImage] => 0
                [Data] => 3378367
                [Favorite] => 1
                [HardwareID] => 1
                [HardwareName] => P1 Smart Meter
                [HaveTimeout] => 
                [ID] => 1
                [LastUpdate] => 2013-12-16 22:50:21
                [Name] => Gasmeter
                [Notifications] => false
                [SignalLevel] => 12
                [SubType] => Gas
                [SwitchTypeVal] => 1
                [Timers] => false
                [Type] => P1 Smart Meter
                [TypeImg] => counter
                [Unit] => 2
                [Used] => 1
                [idx] => 2
            )

        [class] => sensor
        [type] => consum
        [value] => 0
        [unit] => m3
        [uid] => sensor_consum_2_now
        [img_type] => consum
    )

[sensor_counter_2] => Array
    (
        [address] => 2
        [name] => Gasmeter
        [battery_level] => 255
        [signal_level] => 12
        [raw] => Array
            (
                [BatteryLevel] => 255
                [Counter] => 3378.367
                [CounterToday] => 5.473 m3
                [CustomImage] => 0
                [Data] => 3378367
                [Favorite] => 1
                [HardwareID] => 1
                [HardwareName] => P1 Smart Meter
                [HaveTimeout] => 
                [ID] => 1
                [LastUpdate] => 2013-12-16 22:50:21
                [Name] => Gasmeter
                [Notifications] => false
                [SignalLevel] => 12
                [SubType] => Gas
                [SwitchTypeVal] => 1
                [Timers] => false
                [Type] => P1 Smart Meter
                [TypeImg] => counter
                [Unit] => 2
                [Used] => 1
                [idx] => 2
            )

        [class] => sensor
        [type] => counter
        [value] => 3378.367
        [unit] => m3
        [uid] => sensor_counter_2
        [img_type] => counter
    )

[sensor_counter_1_today] => Array
    (
        [address] => 1
        [name] => Electriciteitsmeter
        [battery_level] => 255
        [signal_level] => 12
        [raw] => Array
            (
                [BatteryLevel] => 255
                [Counter] => 14416.000
                [CounterDeliv] => 0.000
                [CounterDelivToday] => 0.000 kWh
                [CounterToday] => 13.000 kWh
                [CustomImage] => 0
                [Data] => 8572000;5844000;0;0;1100;0
                [Favorite] => 1
                [HardwareID] => 1
                [HardwareName] => P1 Smart Meter
                [HaveTimeout] => 
                [ID] => 1
                [LastUpdate] => 2013-12-16 22:50:21
                [Name] => Electriciteitsmeter
                [Notifications] => false
                [SignalLevel] => 12
                [SubType] => Energy
                [SwitchTypeVal] => 0
                [Timers] => false
                [Type] => P1 Smart Meter
                [TypeImg] => counter
                [Unit] => 1
                [Usage] => 1100 Watt
                [UsageDeliv] => 0 Watt
                [Used] => 1
                [idx] => 1
            )

        [class] => sensor
        [type] => counter
        [value] => 13000
        [unit] => kWh
        [uid] => sensor_counter_1_today
        [img_type] => counter
    )

[sensor_consum_1_now] => Array
    (
        [address] => 1
        [name] => Electriciteitsmeter
        [battery_level] => 255
        [signal_level] => 12
        [raw] => Array
            (
                [BatteryLevel] => 255
                [Counter] => 14416.000
                [CounterDeliv] => 0.000
                [CounterDelivToday] => 0.000 kWh
                [CounterToday] => 13.000 kWh
                [CustomImage] => 0
                [Data] => 8572000;5844000;0;0;1100;0
                [Favorite] => 1
                [HardwareID] => 1
                [HardwareName] => P1 Smart Meter
                [HaveTimeout] => 
                [ID] => 1
                [LastUpdate] => 2013-12-16 22:50:21
                [Name] => Electriciteitsmeter
                [Notifications] => false
                [SignalLevel] => 12
                [SubType] => Energy
                [SwitchTypeVal] => 0
                [Timers] => false
                [Type] => P1 Smart Meter
                [TypeImg] => counter
                [Unit] => 1
                [Usage] => 1100 Watt
                [UsageDeliv] => 0 Watt
                [Used] => 1
                [idx] => 1
            )

        [class] => sensor
        [type] => consum
        [value] => 1100
        [unit] => W
        [uid] => sensor_consum_1_now
        [img_type] => consum
    )

[sensor_counter_1] => Array
    (
        [address] => 1
        [name] => Electriciteitsmeter
        [battery_level] => 255
        [signal_level] => 12
        [raw] => Array
            (
                [BatteryLevel] => 255
                [Counter] => 14416.000
                [CounterDeliv] => 0.000
                [CounterDelivToday] => 0.000 kWh
                [CounterToday] => 13.000 kWh
                [CustomImage] => 0
                [Data] => 8572000;5844000;0;0;1100;0
                [Favorite] => 1
                [HardwareID] => 1
                [HardwareName] => P1 Smart Meter
                [HaveTimeout] => 
                [ID] => 1
                [LastUpdate] => 2013-12-16 22:50:21
                [Name] => Electriciteitsmeter
                [Notifications] => false
                [SignalLevel] => 12
                [SubType] => Energy
                [SwitchTypeVal] => 0
                [Timers] => false
                [Type] => P1 Smart Meter
                [TypeImg] => counter
                [Unit] => 1
                [Usage] => 1100 Watt
                [UsageDeliv] => 0 Watt
                [Used] => 1
                [idx] => 1
            )

        [class] => sensor
        [type] => counter
        [value] => 14416
        [unit] => kWh
        [uid] => sensor_counter_1
        [img_type] => counter
    )

from phpmydomo.

pepijng avatar pepijng commented on May 25, 2024

The Dutch format uses a . as separator for thousands and , as separator for the decimals. But this is not what the Domoticz API produces.

[Counter] => 14416.000 = 14.416,000 kWH (dutch), 14,416.000 (US)

Translation:
$lang['types']['consum'] ="Verbuik";
$lang['types']['counter'] ="Meter";

from phpmydomo.

soif avatar soif commented on May 25, 2024

ok so :

    1. 'Counter' is a valid float with 3 decimals (14400.000 = 14,416.000 US = 14.416,000 kWH dutch )
    1. 'Usage' is an integer with units (1100 Watt = 1,100 US = 1.100 dutch). Can you make sure there are NEVER decimals, ie 1100.5 ?
    1. 'Usage' does not apply to Gas, only to Energy ?
    1. 'CounterToday' is a float with units (5.473 m3 = 5.473 US = 5,473 dutch)

Please confirm each point.

from phpmydomo.

soif avatar soif commented on May 25, 2024

Latest develop branch fixed this assuming YES to the 4 previous questions.Check it out and confirm all points, please.
Thank you 4 your Help! ;-)

from phpmydomo.

pepijng avatar pepijng commented on May 25, 2024
  1. Yes
  2. Yes
  3. Yes
  4. Yes

So it looks great for me!

from phpmydomo.

soif avatar soif commented on May 25, 2024

Great, THANK YOU.
We're going to release 0.134. ;-)

BTW if you have dimmers, would you please answer #1 : I'm waiting for feedback on this before releasing v0.134.

from phpmydomo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.