Closed rupertwilson closed 4 years ago
Hi Rupert! Hmmm, the only way getDay can break is if dteLoop is not set with a valid date, and the only way that can happen is if one of the ajax requests pulling the electric or gas data doesn't return a valid date. I've added some additional validation around those dates, so it shouldn't now break on the getDay function, but it may still refuse to work properly if the API requests are failing to retrieve a date, so please double check that you've got the full correct API URLs in config.js:
elecApiUrl: 'https://api.octopus.energy/v1/electricity-meter-points/[ELECTRIC-MPAN]/meters/[METER_SERIAL]/consumption/?group_by=day', gasApiUrl: 'https://api.octopus.energy/v1/gas-meter-points/[GAS-MPRN]/meters/[GAS-SERIAL]/consumption/?group_by=day',
I think all you need to do to update is: cd MagicMirror/modules/MMM-OctoMon git pull
Please let me know how you get on!
Many thanks Christopher, yes that works perfectly now. I realised that one thing I didn't mention was that I only have a Smets2 electricity meter and I still have to read my gas manually so I guess the API only returns data close to the day I submit a reading and Kraken gets updated. I've also realised that simply leaving gasApiUrl: '', empty ignores the readings completely.
Thanks for your time, and 👍 for the great MM module 😃
Rupert
You're welcome! It's my understanding (someone please correct me if i'm wrong) that the electricity meter may well report back half hourly readings via it's built in mobile phone signal, but those readings are sent to a single third party 'data collector' organisation, who then pass the meter readings back to the appropriate 'billing company' (ie Octopus) on some other schedule, likely daily, but i've seen gaps between updates of three or four days before now. It's a great shame, because I was hoping to see the actual half hourly updates come through the Octopus API, but sadly that's not the case. :(
I've encountered an error with a fresh install. I've successfully tested the URLs via a terminal window so the API key, Meter IDs are correct. However when I run the module I just get the message "Querying Server". Ctrl+Shirt+I and display console reveals the following issue.
MMM-OctoMon.js:61 getElecData() readyState=2 MMM-OctoMon.js:61 getElecData() readyState=3 MMM-OctoMon.js:61 getElecData() readyState=4 MMM-OctoMon.js:63 getElecData() status=200 MMM-OctoMon.js:316 processElecData() MMM-OctoMon.js:145 getDom() MMM-OctoMon.js:240 Uncaught (in promise) TypeError: Cannot read property 'getDay' of undefined at Class.getDom (MMM-OctoMon.js:240) at main.js:111 at new Promise ()
at updateDom (main.js:110)
at Object.updateDom (main.js:542)
at Class.updateDom (module.js:357)
at Class.processElecData (MMM-OctoMon.js:320)
at XMLHttpRequest.elecDataRequest.onreadystatechange (MMM-OctoMon.js:65)
Thanks, Rupert