MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord

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

    Troubleshooting
    3
    10
    272
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      emrah_asl last edited by emrah_asl

      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); } },

      1 Reply Last reply Reply Quote 0
      • E
        emrah_asl last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • hango
          hango Module Developer last edited by hango

          @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.

          https://github.com/hangorazvan

          S 1 Reply Last reply Reply Quote 1
          • S
            sdetweil @hango last edited by

            @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

            Sam

            Create a working config
            How to add modules

            hango 1 Reply Last reply Reply Quote 1
            • hango
              hango Module Developer @sdetweil last edited by hango

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

              https://github.com/hangorazvan

              1 Reply Last reply Reply Quote 0
              • E
                emrah_asl last edited by emrah_asl

                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

                S hango 2 Replies Last reply Reply Quote 0
                • S
                  sdetweil @emrah_asl last edited by sdetweil

                  @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

                  Sam

                  Create a working config
                  How to add modules

                  1 Reply Last reply Reply Quote 0
                  • hango
                    hango Module Developer @emrah_asl last edited by

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

                    https://github.com/hangorazvan

                    1 Reply Last reply Reply Quote 0
                    • E
                      emrah_asl last edited by

                      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);
                      }
                      },
                      
                      1 Reply Last reply Reply Quote 0
                      • hango
                        hango Module Developer last edited by hango

                        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();
                        

                        https://github.com/hangorazvan

                        1 Reply Last reply Reply Quote 0
                        • 1 / 1
                        • First post
                          Last post
                        Enjoying MagicMirror? Please consider a donation!
                        MagicMirror created by Michael Teeuw.
                        Forum managed by Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy