CFenner / MMM-Netatmo

A module for the MagicMirror to display information about your rooms climate from your Netatmo system.
MIT License
37 stars 33 forks source link

correct display of wind data #19

Closed mwuethri74 closed 2 years ago

mwuethri74 commented 8 years ago

Hi

The data from the windsensor is not displayed at all. There is only a {1}. I think, that the problem is, that the wind data is either WIndAngle or WindStrength. There is no data called "Wind". I tried to change add WindAngle and WindStrength to netatmo.js and the names to de.json. But still nothing is displayed.

Where do I add new data in general?

Thank you. Michael

CFenner commented 8 years ago

Hi,

in line 150 each data is read from the netatmo data.

If you know how to handle the debugger, it would be nice if you could set a breakpoint at line 105, copy the content of data variable and post it to this ticket. I haven't testet the wind sensor, but I would like to get it work.

mwuethri74 commented 8 years ago

Hi Christopher

Unfortunately I have never used the debugger (I am not very much into programming). Would you have a link, where I can read how to do it?

One time you write line 150 and once you write 105. Which one is the correct number?

Thank you. Michael

CFenner commented 8 years ago

Line 105 is where the whole json data arrives. line 150 is where the differente values are printed.

I don't have a link for you, but maybe I can describe how to proceed. Which browser do you use?

mwuethri74 commented 8 years ago

up to now I only started it with the command: npm start (so I dont know which browser is used). This is how Michael describes it on the MagicMirror2 Github page.

Sorry, but I am really not into this things. So my answers may be on a very low level... ;-(

CFenner commented 8 years ago

Ok, but you should be able to call the mirror from your laptop. Just type the PI ip and the port in the browser.

CFenner commented 8 years ago

You could also try to display the wind explicitly, try to add this to the config:

dataOrder: [
  "WindAngle",
  "WindStrength"
]
mwuethri74 commented 8 years ago

Ok. I will try this when I have some spare time. Tonight I am quite busy. I will come back to you as soon as I know something new.

mwuethri74 commented 8 years ago

ok. I managed to get it to my laptop and I opened it in firefox. Here I also found the debugging tools and I was able to set a breakpoint. But unfortunately I am not able to find the data variable. Where should it be? Is it in an subdirectory I have to open?

sowthepole commented 8 years ago

I'm having the same problem.

When you say to add this to the config, are you saying to add it to config.js? If so I have several iterations and all of them seem to break the config file.

Could you elaborate on where in the config that snip should reside?

mwuethri74 commented 8 years ago

Here is how it looks. Where can I find data??? bildschirmfoto 2016-05-08 um 21 56 18

CFenner commented 8 years ago

Ok, if the green pointer is in a line between 102 and 113 you should find the data object in the right panel "Variablen".

CFenner commented 8 years ago

@sowthepole: Yes, config.js. It's a part of the netatmo module config. So something like this:

{
  module: 'netatmo',
  position: 'left',
  config: {
    dataOrder: [
      "WindAngle",
      "WindStrength"
    ]
  }
}
CFenner commented 8 years ago

@mwuethri74:

You could also look in the network tab, there should be a call to api.netatmo.com and the result should look like this:

{
    "body": {
        "devices": [{
            "_id": "",
            "cipher_id": "",
            "last_status_store": 1462739536,
            "modules": [{
                "_id": "",
                "type": "NAModule1",
                "last_message": 1462739531,
                "last_seen": 1462739499,
                "dashboard_data": {
                    "time_utc": 1462739499,
                    "Temperature": 22.1,
                    "temp_trend": "down",
                    "Humidity": 38,
                    "date_max_temp": 1462696952,
                    "date_min_temp": 1462679472,
                    "min_temp": 17.7,
                    "max_temp": 33.7
                },
                "data_type": ["Temperature", "Humidity"],
                "module_name": "Au\u00dfenmodul",
                "last_setup": 1419385847,
                "battery_vp": 4960,
                "battery_percent": 57,
                "rf_status": 63,
                "firmware": 43
            }, {
                "_id": "",
                "type": "NAModule4",
                "last_message": 1462739531,
                "last_seen": 1462739506,
                "dashboard_data": {
                    "time_utc": 1462739506,
                    "Temperature": 24.5,
                    "temp_trend": "stable",
                    "Humidity": 35,
                    "CO2": 605,
                    "date_max_temp": 1462698477,
                    "date_min_temp": 1462658648,
                    "min_temp": 23.3,
                    "max_temp": 27.6
                },
                "data_type": ["Temperature", "CO2", "Humidity"],
                "module_name": "Schlafzimmer",
                "last_setup": 1448382569,
                "battery_vp": 5613,
                "battery_percent": 79,
                "rf_status": 79,
                "firmware": 43
            }, {
                "_id": "",
                "type": "NAModule4",
                "last_message": 1462739531,
                "last_seen": 1462739487,
                "dashboard_data": {
                    "time_utc": 1462739487,
                    "Temperature": 25,
                    "temp_trend": "stable",
                    "Humidity": 38,
                    "CO2": 486,
                    "date_max_temp": 1462701808,
                    "date_min_temp": 1462663158,
                    "min_temp": 24,
                    "max_temp": 26.3
                },
                "data_type": ["Temperature", "CO2", "Humidity"],
                "module_name": "Bad",
                "last_setup": 1455652742,
                "battery_vp": 5779,
                "battery_percent": 88,
                "rf_status": 48,
                "firmware": 43
            }
            ],
            "place": {
                "altitude": 94,
                "city": "Mannheim",
                "country": "DE",
                "timezone": "Europe\/Berlin",
                "location": []
            },
            "station_name": "Netatmo Mannheim",
            "type": "NAMain",
            "dashboard_data": {
                "AbsolutePressure": 997.4,
                "time_utc": 1462739522,
                "Noise": 35,
                "Temperature": 24.8,
                "temp_trend": "stable",
                "Humidity": 37,
                "Pressure": 1008.5,
                "pressure_trend": "stable",
                "CO2": 580,
                "date_max_temp": 1462698796,
                "date_min_temp": 1462668014,
                "min_temp": 23.7,
                "max_temp": 26.1
            },
            "data_type": ["Temperature", "CO2", "Humidity", "Noise", "Pressure"],
            "co2_calibrating": false,
            "date_setup": 1419385866,
            "last_setup": 1419385866,
            "module_name": "Wohnzimmer",
            "firmware": 119,
            "last_upgrade": 1440163997,
            "wifi_status": 40
        }
        ],
        "user": {
            "mail": "christopher",
            "administrative": {
                "country": "DE",
                "reg_locale": "de-DE",
                "lang": "de-DE",
                "unit": 0,
                "windunit": 4,
                "pressureunit": 0,
                "feel_like_algo": 0
            }
        }
    },
    "status": "ok",
    "time_exec": 0.034049987792969,
    "time_server": 1462739715
}

And Interesting would be, how the wind module is displayed here.

sowthepole commented 8 years ago

@CFenner

Thank you, yes that's what I tried. When I do so, no data is displayed for any of my stations.

CFenner commented 8 years ago

Ok, could you post your station data as described above? Make sure to eliminate all sensitive data.

sowthepole commented 8 years ago

Really sorry for the formatting of this, I cant seem to get the debugger to output anything but a single line. Though you can see there is wind data.

Also here is my config.js section for netatmo. I've explicitly set moduleOrder & dataOrder. Everythign shows with the exception of the wind. When I didnt have explicitly set, it had a {1}, when I set as you see now, the wind is simply blank.

{
    module: 'netatmo',
    position: 'top_right',
    config: {
        moduleOrder: ["Indoor", "Outdoor", "Rain Gauge", "Wind Gauge"],
        dataOrder: ["Noise", "Pressure", "CO2", "Humidity", "Temperature", "Rain", "WindAngle", "WindStrength", "GustAngle", "GustStrength"],
        clientId: '',
        clientSecret: '',
        refreshToken: ''
    }
}
{
    "body": {
        "devices": [{
            "_id": "",
            "cipher_id": "",
            "last_status_store": 1462745980,
            "modules": [{
                "_id": "",
                "type": "NAModule1",
                "last_message": 1462745975,
                "last_seen": 1462745949,
                "dashboard_data": {
                    "time_utc": 1462745949,
                    "Temperature": 15.4,
                    "temp_trend": "down",
                    "Humidity": 36,
                    "date_max_temp": 1462741078,
                    "date_min_temp": 1462710677,
                    "min_temp": 2.2,
                    "max_temp": 19.7
                },
                "data_type": ["Temperature", "Humidity"],
                "module_name": "Outdoor",
                "last_setup": 1460662809,
                "battery_vp": 6150,
                "battery_percent": 100,
                "rf_status": 70,
                "firmware": 43
            }, {
                "_id": "",
                "type": "NAModule3",
                "last_message": 1462745975,
                "last_seen": 1462745975,
                "dashboard_data": {
                    "time_utc": 1462745962,
                    "Rain": 0,
                    "sum_rain_24": 0,
                    "sum_rain_1": 0
                },
                "data_type": ["Rain"],
                "module_name": "Rain Gauge",
                "last_setup": 1460663617,
                "battery_vp": 6226,
                "battery_percent": 100,
                "rf_status": 56,
                "firmware": 8
            }, {
                "_id": "",
                "type": "NAModule2",
                "last_message": 1462745975,
                "last_seen": 1462745975,
                "dashboard_data": {
                    "WindAngle": 221,
                    "WindStrength": 2,
                    "GustAngle": 208,
                    "GustStrength": 4,
                    "time_utc": 1462745962,
                    "WindHistoric": [{
                        "WindStrength": 5,
                        "WindAngle": 43,
                        "time_utc": 1462742585
                    }, {
                        "WindStrength": 5,
                        "WindAngle": 174,
                        "time_utc": 1462742886
                    }, {
                        "WindStrength": 10,
                        "WindAngle": 315,
                        "time_utc": 1462743136
                    }, {
                        "WindStrength": 2,
                        "WindAngle": 270,
                        "time_utc": 1462743437
                    }, {
                        "WindStrength": 2,
                        "WindAngle": 338,
                        "time_utc": 1462743738
                    }, {
                        "WindStrength": 8,
                        "WindAngle": 350,
                        "time_utc": 1462744039
                    }, {
                        "WindStrength": 2,
                        "WindAngle": 219,
                        "time_utc": 1462744340
                    }, {
                        "WindStrength": 2,
                        "WindAngle": 196,
                        "time_utc": 1462744642
                    }, {
                        "WindStrength": 6,
                        "WindAngle": 148,
                        "time_utc": 1462744757
                    }, {
                        "WindStrength": 7,
                        "WindAngle": 51,
                        "time_utc": 1462745058
                    }, {
                        "WindStrength": 9,
                        "WindAngle": 177,
                        "time_utc": 1462745359
                    }, {
                        "WindStrength": 4,
                        "WindAngle": 187,
                        "time_utc": 1462745661
                    }, {
                        "WindStrength": 2,
                        "WindAngle": 221,
                        "time_utc": 1462745962
                    }],
                    "date_max_wind_str": 1462742283,
                    "date_max_temp": 1462687491,
                    "date_min_temp": 1462687491,
                    "min_temp": 0,
                    "max_temp": 0,
                    "max_wind_angle": 44,
                    "max_wind_str": 20
                },
                "data_type": ["Wind"],
                "module_name": "Wind Gauge",
                "last_setup": 1460663149,
                "battery_vp": 6130,
                "battery_percent": 100,
                "rf_status": 63,
                "firmware": 14
            }],
            "place": {
                "altitude": 1797.0131057604,
                "city": "",
                "": "US",
                "timezone": "",
                "location": [-104.797903, 39.523649]
            },
            "station_name": "",
            "type": "NAMain",
            "dashboard_data": {
                "AbsolutePressure": 803.4,
                "time_utc": 1462745966,
                "Noise": 45,
                "Temperature": 20,
                "temp_trend": "up",
                "Humidity": 43,
                "Pressure": 998.6,
                "pressure_trend": "down",
                "CO2": 469,
                "date_max_temp": 1462731171,
                "date_min_temp": 1462709180,
                "min_temp": 18.1,
                "max_temp": 20.3
            },
            "data_type": ["Temperature", "CO2", "Humidity", "Noise", "Pressure"],
            "co2_calibrating": false,
            "date_setup": 1460662828,
            "last_setup": 1460662828,
            "module_name": "Indoor",
            "firmware": 119,
            "last_upgrade": 1462638093,
            "wifi_status": 42,
            "friend_users": [""]
        }],
        "user": {
            "mail": "",
            "administrative": {
                "country": "US",
                "reg_locale": "en-US",
                "lang": "en-GB",
                "unit": 1,
                "windunit": 1,
                "pressureunit": 0,
                "feel_like_algo": 1
            }
        }
    },
    "status": "ok",
    "time_exec": 0.035109043121338,
    "time_server": 1462746567
}
CFenner commented 8 years ago

Use jsbeautifier.org and Markdown Styling :)

CFenner commented 8 years ago

I see.. the raid data is ok, should be rendered as expected, but might need a measuring unit. The wind data is off the road. Normally a module says its measuring type (Rain, Temperature, etc.) and has an array with the values where the measuring type is the key. But not for wind, there we have Wind in the type array but WindStrength, WindAngle, GustStrength and GustAngle as values. This will tage some time, I'll try to do it the next days.

What do you prefer to see here, strength and angle and also gusts?

mwuethri74 commented 8 years ago

That is probably why my approach did not work... I tried to handle the wind data the same as the other data... For my WindStrength and WindAngle would be fine, I do not really need the gusts (but if they are avaliable, that would be fine as well). It would be nice, if the WindAngle would be in N/NW/W/SW/S/SO/O/NO. That would be great.

Thank you for your effort. Michael

CFenner commented 8 years ago

I think I enable gusts with an option. What do you think about icons for the directions? Maybe also as option.

sowthepole commented 8 years ago

@CFenner

Thank you for the links. I knew there had to be something to assist with formatting, I just couldn't find it. Bookmarked.

Personally, I will use both wind and gust. I would also use icons if they were available, I think it would look much more sleek, though having options would be useful.

Perhaps a format like [Angle] xx/yy to keep the constraints of the wind window in mind, where angle is either an icon or letter scheme, and xx is wind and yy is gust. I'll leave it to you, just thought I would suggest.

Not sure about etiquette here, but should I open a new issue to ask about changing to imperial units instead of Celsius? I've tried a few different options, yet nothing has succeeded. I'll open another case if so, thanks.

Great module by the way, love it.

CFenner commented 8 years ago

@sowthepole there is a segment at the end of the data: sowthepole:

        "user": {
            "mail": "",
            "administrative": {
                "country": "US",
                "reg_locale": "en-US",
                "lang": "en-GB",
                "unit": 1,
                "windunit": 1,
                "pressureunit": 0,
                "feel_like_algo": 1
            }
        }

CFenner:

        "user": {
            "mail": "",
            "administrative": {
                "country": "DE",
                "reg_locale": "de-DE",
                "lang": "de-DE",
                "unit": 0,
                "windunit": 4,
                "pressureunit": 0,
                "feel_like_algo": 0
            }
        }

So the information which units to use is there, I just need to handle it ;) feel free to open a separate issue.

mwuethri74 commented 8 years ago

Hi Christopher Did you got on on this issue?

Thank you for your effort.

Michael

schelhaas commented 7 years ago

netatmo Hello everyone, I played around with this issue a little bit and found a solution for my MagicMirror which might be of interest. I was not able to get the wind data shown as well, even though the array had all data needed. Since the data is available but the "inArray" function could not "find" it I changed the line 156 in the netatmo.js from: if ($.inArray(dataType, oModule.data_type) > -1) { to if (oModule.dashboard_data[dataType] != undefined){

Then I added some lines to the "de.json"-file in the "l10n" folder and get my German translation.

Maybe it is not the best way to do it, but it works.

Greetings,

Matthias

housepunk commented 6 years ago

I still get no Wind values, using the newest Version.

jannodeluxe commented 4 years ago

is there any progress on this issue?

mwuethri74 commented 4 years ago

No, not from my side.

CFenner commented 2 years ago

Wind data should be displayed correctly by now.

Bildschirmfoto 2022-01-29 um 09 53 25