MagicMirror² v2.12.0 is available! For more information about this release, check out this topic.

icon + compliments_plus + How to communicate with default weather module ?



  • https://github.com/hangorazvan/compliments_plus

    Hi, I love that module but I thought that is beyond on default compliment module.

    I want to use that module to alert weather warns to clients working with current default weather module

    Also I have .svg icon set for each situation. The only thing I want to show image and text depending on current weather.

    For ınstance if it is rainy , the module will show image + rainy text

    How can achieve this ?

    I see these code , but unable to undesrtand who is sending notification.

    notificationReceived: function(notification, payload, sender) { if (notification === “Weather data”) { this.setCurrentWeatherType(payload.data); } },



  • How can I connect the Compliments Module with the Weather Module for weather-controlled display of compliments?
    I know there’s a line currentWeatherType: ""in compliments.js but I don’t know what I have to insert in there.


  • Module Developer

    @emrah_asl
    The module is already communicate with currentweather and display the weather condition. Regarding svg icon is not implemented yet to display symbols or any weather icons but I will try to do.



  • @hango the answer to your question in the issue

    I see these code , but unable to undesrtand who is sending notification.
    
    notificationReceived: function(notification, payload, sender) { if (notification === "Weather data") { this.setCurrentWeatherType(payload.data); } },
    

    any module can send this notification. IF the weather module RECEIVES this notification, it expects an object in the payload with an element called ‘data’

    { data:some-value}

    where I guess some_value would be the compliments tags, ‘sunny’, … etc


  • Module Developer

    @sdetweil the answer was for @emrah_asl on github issues in my module, not my question, thx anyway



  • Guys, thanks for assisting me but I think the problem in my weather.js, because I guess it is not sending any notification to client side.

    love that module, but unable to find node_helper.js inside of default/weather directory.

    I would like to send notification to client side into this compliment in order to listen and put appropriate text for current weather.

    this compliment module have this

    notificationReceived: function(notification, payload, sender) {
    if (notification === “CURRENTWEATHER_DATA”) {
    console.log(“251”, payload.data);
    this.setCurrentWeatherType(payload.data);
    }

    But I dont get how to send data from my weather module.

    Sorry for mixed up



  • @emrah_asl don’t need node_helper, and can’t use node_helper. it can only handle socketNotifcations

    this.sendNotification(type, data)
    from modulename.js


  • Module Developer

    @emrah_asl please check the new updates of my module
    https://github.com/hangorazvan/compliments_plus



  • Hi, thanks for assisting me.

    The problem is I’M not using original weather module, so unable to send notification .

    I’m using this one :

    https://github.com/MatthiPi/MMM-DefaultWeatherAnimated

    {
    module: "weather", //change to weather
    position: "top_right",
    config: {
    // See 'Configuration options' for more information.
    type: 'current',
    weatherEndpoint: '/weather',
    units: 'metric',
    apiKey: 'X',
    locationID: Y
    }
    },
    
    But unable to figure out how to send notification to current weather objects into this compliment_modules.
    
    (where should I write , this code in this module ?) when I try in provider.js, console says "sender should be module"
    
    this.sendNotification("CURRENTWEATHER_DATA", {foo: "bar"});
    
    MY COMPLIMENT_PLUS Modul compliment_plus.js
    
    notificationReceived: function(notification, payload, sender) {
    if (notification === "CURRENTWEATHER_DATA") {
    console.log("251", payload.data);
    this.setCurrentWeatherType(payload.data);
    }
    },
    

  • Module Developer

    On the first look your weather module is overwriting the original one and do not send notification, maybe the developer it will try to add sendNotification

    Try to put

    this.sendNotification("CURRENTWEATHER_DATA", { data: data });
    

    in openweathermap,js from providers folder at the end of fetchCurrentWeather or in weather.js after

    this.weatherProvider.fetchCurrentWeather();
    

Log in to reply