MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. BKeyport
    3. Posts
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    BKeyportB Offline
    • Profile
    • Following 0
    • Followers 2
    • Topics 68
    • Posts 1,325
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: MMM-Tronity

      @sdetweil I know what the plugin states, I’m saying the tronity website isn’t providing documentation outside the login system. ;)

      posted in Troubleshooting
      BKeyportB
      BKeyport
    • RE: MMM-Tronity

      @sdetweil @bradley1982 If google’s translation is even half good from german, the API is available through their login - there’s no documentation outside of the account system.

      As such, I’d recommend reviewing their steps to get API key/Auth token from there, and do that - it appears that’s what’s missing.

      posted in Troubleshooting
      BKeyportB
      BKeyport
    • RE: Not updating at midnight...

      @sdetweil yeah, doing it that way just throws headers with “Undefined” until it triggers. I’m not gonna go down that rabbit hole. It seems to work as is, so I’m gonna release for now.

      posted in Troubleshooting
      BKeyportB
      BKeyport
    • RE: Switchbot API access - MMM-CommandtoNotification

      @sdetweil Actually, I went around it - found one of my old temp units and wired it up and did a bad thing™ according to the python docs now.

      Same effect, across the room.

      posted in Requests
      BKeyportB
      BKeyport
    • RE: Not updating at midnight...

      @sdetweil said in Not updating at midnight...:

      DOM_OBJECTS_CREATED - All dom objects are created. The system is now ready to perform visual changes

      start: function () {
          function scheduleMidnightUpdate() {
              const now = new Date();
              const nextMidnight = new Date(now);
      
              // Set the time to midnight
              nextMidnight.setHours(24, 0, 0, 0);
      
              // Calculate the time remaining until the next midnight
              const timeUntilMidnight = nextMidnight - now;
      
              // Schedule the updateDom method to be called at midnight
              setTimeout(() => {
                  this.updateDom();
      
                  // Reschedule the update for the next midnight
                  scheduleMidnightUpdate.call(this);
              }, timeUntilMidnight);
          }
      },
      
          notificationReceived: function (notification, payload, sender) {
              if (notification === 'CALENDAR_EVENTS') {
                  this.storedEvents = JSON.parse(JSON.stringify(payload))
                  this.updateDom();
              } else if (notification === 'DOM_OBJECTS_CREATED') {
                  // Call the function to start the first schedule
                    scheduleMidnightUpdate.call(this);  
              }
      

      This is the only source I see in the docs of that - a notification. Is that correct?

      Thanks for the patience after the double misunderstanding.

      posted in Troubleshooting
      BKeyportB
      BKeyport
    • RE: Not updating at midnight...

      @sdetweil @MMRIZE so, should I move the initial call somewhere else?

      posted in Troubleshooting
      BKeyportB
      BKeyport
    • RE: MMM-Tronity

      @bradley1982

      Let’s do some basic checks.

      When you cloned the module, did you go to the module directory and run npm install ?

      If not, do that now, and report back.

      Did you get the API keys installed in your config, per the readme?

      There may be a dependency missing from the core that it uses, I’m invoking @sdetweil to take a quick look see, and if so, instruct you how to install it.

      the documentation is very poor, so really, I can’t do much more, and I doubt anyone else can, the module is 2 years old at this point, and may just be zombieware.

      Good luck!

      posted in Troubleshooting
      BKeyportB
      BKeyport
    • RE: Not updating at midnight...

      I think I got it figured out - Based on research elsewhere - if I’m correct: start: function() is only called upon load, correct?

      ASSUMING that’s the case, this seems to work better:

      start: function () {
          function scheduleMidnightUpdate() {
              const now = new Date();
              const nextMidnight = new Date(now);
      
              // Set the time to midnight
              nextMidnight.setHours(24, 0, 0, 0);
      
              // Calculate the time remaining until the next midnight
              const timeUntilMidnight = nextMidnight - now;
      
              // Schedule the updateDom method to be called at midnight
              setTimeout(() => {
                  this.updateDom();
      
                  // Reschedule the update for the next midnight
                  scheduleMidnightUpdate.call(this);
              }, timeUntilMidnight);
          }
      
          // Call the function to start the first schedule
          scheduleMidnightUpdate.call(this);
      },
      

      Now, This seems to work on testing - but it will fail in testing if I change the clock after starting MM.

      Is there anyway y’all can see to improve this, or am I good?

      posted in Troubleshooting
      BKeyportB
      BKeyport
    • RE: Not updating at midnight...

      @MMRIZE @sdetweil

      the reporter posted this to my github:

      I am not a javascript expert, but have some experience in C++ and
      microcontroller programming.
      I have had some problems with other MagicMirror calendar modules not
      updating the day properly and they also seem to implement workarounds and
      have issues with the DOM updating.
      I did a little looking into this and it seems there must be some generic
      issue with the MagicMirror software allowing modules to implement timers
      and date/time functions in realtime.
      

      And Sam - I was telling you that it previously was working and works outside of the MM ecosystem - or at least sets it up to work. that’s what got me pissed off - I had done a slew of debugging and it got down to “have you turned off and on again”

      There’s lots of issues I’ve been having - most of them being internal MM functions, that I tend to work around by native JS code and using remote access via the Web server.

      For example: Logging. Don’t seem to work for me. Gotta log via console, so I pull up the web server and Edge’s dev tools.

      posted in Troubleshooting
      BKeyportB
      BKeyport
    • RE: Not updating at midnight...

      @sdetweil It’s people like you that drive people out of coding. This isn’t fun anymore.

      Is there anyone other than Sam that could explain why this don’t work anymore?

      posted in Troubleshooting
      BKeyportB
      BKeyport
    • RE: Not updating at midnight...

      @sdetweil The problem is that it’s not firing at all - it was working as is… Now it’s not firing, first, last, middle, or any other time.

      posted in Troubleshooting
      BKeyportB
      BKeyport
    • RE: Not updating at midnight...

      I think you see it backwards.

      Look at the reset variable again.

      This line calculates the difference between the current time and midnight of the next day. It does this by creating a new Date object for the next day at 00:00:00.000 (midnight) and subtracting the current time from it.

      The variable timer is then set using the reset variable, so…

      new Date(year, month, nextday, 0, 0, 0, 0).getTime() - date.getTime()

      Assuming it’s currently 6:30pm on August 8th, 2024.

      2024/8/9 0:0:0.0 - 2024/8/8 18:30:0.0
      1723186800 - 1723167000 (Dropping the milliseconds if used)
      = 19800

      then the timer is set using setInterval() to “reset” or 19800 - which would be the next midnight.

      After the first one, it should be calculating so close to midnight, it’s an non-issue.

      posted in Troubleshooting
      BKeyportB
      BKeyport
    • Not updating at midnight...

      I’m having trouble with my module (multimonth) not updating at midnight as expected. It will update on notification as shown, however.

      This used to work - can someone please take a look and see what broke, or if something changed in MagicMirror core that I didn’t pick up on that’s affecting?

      Thanks.

          start: function () {
              date = new Date();
              month = date.getMonth();
              day = date.getDate();
              nextday = day + 1;
              year = date.getFullYear();
              reset = new Date(year, month, nextday, 0, 0, 0, 0).getTime() - date.getTime();
              var timer = setInterval(() => {
                  this.updateDom()
              }, reset)
              this.storedEvents = [];
              this.matchEvents = [];
          },
      
          notificationReceived: function (notification, payload, sender) {
              if (notification === 'CALENDAR_EVENTS') {
                  this.storedEvents = JSON.parse(JSON.stringify(payload))
                  this.updateDom();
              }
          },
      
      posted in Troubleshooting
      BKeyportB
      BKeyport
    • RE: Switchbot API access - MMM-CommandtoNotification

      @sdetweil You might be right - but then again - when you’re already using CommandToNotification for the back end of a module, you might as well continue.

      Even so, the problem still exists - I’m having trouble following the documentation for the API.

      posted in Requests
      BKeyportB
      BKeyport
    • Switchbot API access - MMM-CommandtoNotification

      Folks, I’m not understanding the api at https://github.com/OpenWonderLabs/SwitchBotAPI very well - What I’d like to do is use MMM-CommandtoNotification to get the current tempurature and humidity off my switchbot hub 2, so I can display it on my mirror in another room.

      Could someone help me develop the command/code to do so?

      I flat out think it’s beyond my current ability.

      Thanks!

      posted in Requests
      BKeyportB
      BKeyport
    • RE: Help restyling MMM-ValuesByNotification

      @sdetweil you’re correct. It’s a string. That started fixing it up, just gotta reset a couple of variables I forgot to capture. 😏

      posted in Custom CSS
      BKeyportB
      BKeyport
    • RE: Help restyling MMM-ValuesByNotification

      So, after some more playing around, I’ve come to the determination that the HTML and class setup isn’t good for my use. As a result, I’ve got most of a new module set up for use, however, I’m having issues breaking down the JSON as processed through the notification.

      in short, I’m unable to get the payload on the notification to flow into the array for use. I’ve determined that it’s not flowing through to an array, based on various tests.

      Currently, I have this:

      	notificationReceived: function(notification, payload, sender) {
      		if (notification === 'Weather') {
      			this.storedEvents = JSON.parse(JSON.stringify(payload))
      			this.updateDom();
      
      		}
      	},
      

      Could you provide me something better to strip down the JSON into an array?

      Relevant CommandtoNotification config:

      		{
      						script: "/usr/bin/curl",
      						args: "-X GET -H 'application/json' http://192.168.0.6:80/v1/current_conditions",
      						timeout: 5000,
      						sync: false,
      						notifications: [
      							"Weather",
      						],
      					}
      

      Raw data from command:

      {"data":{"did":"001D0A71573B","ts":1722493593,"conditions":[{"lsid":434637,"data_structure_type":1,"txid":1,"temp": 61.7,"hum":83.1,"dew_point": 56.5,"wet_bulb": 58.3,"heat_index": 62.0,"wind_chill": 61.7,"thw_index": 62.0,"thsw_index":null,"wind_speed_last":0.00,"wind_dir_last":0,"wind_speed_avg_last_1_min":0.00,"wind_dir_scalar_avg_last_1_min":0,"wind_speed_avg_last_2_min":0.00,"wind_dir_scalar_avg_last_2_min":0,"wind_speed_hi_last_2_min":null,"wind_dir_at_hi_speed_last_2_min":null,"wind_speed_avg_last_10_min":0.00,"wind_dir_scalar_avg_last_10_min":226,"wind_speed_hi_last_10_min":1.00,"wind_dir_at_hi_speed_last_10_min":225,"rain_size":1,"rain_rate_last":0,"rain_rate_hi":0,"rainfall_last_15_min":0,"rain_rate_hi_last_15_min":0,"rainfall_last_60_min":0,"rainfall_last_24_hr":0,"rain_storm":0,"rain_storm_start_at":null,"solar_rad":null,"uv_index":null,"rx_state":0,"trans_battery_flag":0,"rainfall_daily":0,"rainfall_monthly":19,"rainfall_year":3902,"rain_storm_last":19,"rain_storm_last_start_at":1722266760,"rain_storm_last_end_at":1722423661},{"lsid":434634,"data_structure_type":4,"temp_in": 82.9,"hum_in":44.5,"dew_point_in": 59.1,"heat_index_in": 82.8},{"lsid":434633,"data_structure_type":3,"bar_sea_level":30.057,"bar_trend": 0.011,"bar_absolute":29.593}]},"error":null}
      

      formatted json:

      {
        "data": {
          "did": "001D0A71573B",
          "ts": 1722493593,
          "conditions": [
            {
              "lsid": 434637,
              "data_structure_type": 1,
              "txid": 1,
              "temp": 61.7,
              "hum": 83.1,
              "dew_point": 56.5,
              "wet_bulb": 58.3,
              "heat_index": 62,
              "wind_chill": 61.7,
              "thw_index": 62,
              "thsw_index": null,
              "wind_speed_last": 0,
              "wind_dir_last": 0,
              "wind_speed_avg_last_1_min": 0,
              "wind_dir_scalar_avg_last_1_min": 0,
              "wind_speed_avg_last_2_min": 0,
              "wind_dir_scalar_avg_last_2_min": 0,
              "wind_speed_hi_last_2_min": null,
              "wind_dir_at_hi_speed_last_2_min": null,
              "wind_speed_avg_last_10_min": 0,
              "wind_dir_scalar_avg_last_10_min": 226,
              "wind_speed_hi_last_10_min": 1,
              "wind_dir_at_hi_speed_last_10_min": 225,
              "rain_size": 1,
              "rain_rate_last": 0,
              "rain_rate_hi": 0,
              "rainfall_last_15_min": 0,
              "rain_rate_hi_last_15_min": 0,
              "rainfall_last_60_min": 0,
              "rainfall_last_24_hr": 0,
              "rain_storm": 0,
              "rain_storm_start_at": null,
              "solar_rad": null,
              "uv_index": null,
              "rx_state": 0,
              "trans_battery_flag": 0,
              "rainfall_daily": 0,
              "rainfall_monthly": 19,
              "rainfall_year": 3902,
              "rain_storm_last": 19,
              "rain_storm_last_start_at": 1722266760,
              "rain_storm_last_end_at": 1722423661
            },
            {
              "lsid": 434634,
              "data_structure_type": 4,
              "temp_in": 82.9,
              "hum_in": 44.5,
              "dew_point_in": 59.1,
              "heat_index_in": 82.8
            },
            {
              "lsid": 434633,
              "data_structure_type": 3,
              "bar_sea_level": 30.057,
              "bar_trend": 0.011,
              "bar_absolute": 29.593
            }
          ]
        },
        "error": null
      }
      

      I already know what the path is to the various array elements (from ValuesByNotification’s config:

      {
      										valueTitle: "Temperature Outdoors",
      										valueUnit: "°",
      										jsonpath: "data.conditions[0].temp",
      										//valueFormat: "Number(${value}).toFixed(2)",
      										//classes: "",
      									},
      

      Should be a path something like this.storedEvents.data.conditions[0].temp

      Thanks!

      posted in Custom CSS
      BKeyportB
      BKeyport
    • RE: Help restyling MMM-ValuesByNotification

      I’ve officially given up.

      I can get it to start to look right outside the magicmirror environment, and even with unsetting everything styled within the ValuesByNotification app, I can’t get it to duplicate within Magic Mirror.

      This is with copying Main.css into a test environment, along with the other modules’ CSS files, and using the output HTML from MagicMirror.

      Works great in test, but the moment I try to make it go live, it’s doing random things.

      I hate CSS. I really do.

      posted in Custom CSS
      BKeyportB
      BKeyport
    • RE: MagicMirror on second Monitor

      @sdetweil Ahh, ok, I thought it was completely dead. Good to know.

      posted in Troubleshooting
      BKeyportB
      BKeyport
    • RE: MagicMirror on second Monitor

      @sdetweil With the displays showing “HDMI-A-1” etc, it’s in Wayland, xrandr doesn’t function under that. This is part of why I suggested going back to X11.

      posted in Troubleshooting
      BKeyportB
      BKeyport
    • 1
    • 2
    • 7
    • 8
    • 9
    • 10
    • 11
    • 66
    • 67
    • 9 / 67