mykle1 / mmm-bmw-cc Goto Github PK
View Code? Open in Web Editor NEWBugger My Weather using the free ClimaCell api
License: MIT License
Bugger My Weather using the free ClimaCell api
License: MIT License
Hello,
I noticed this module didn't display correctly out of the box. Note that instead of displaying the day "Fri", it says "undefined".
Also, the last day of the forecast "Thu" is missing the icon.
I did a little troubleshooting and here are my insights:
The variable 'today' has the wrong scope:
// if the data date is the same as today then today's forecast says "today" See line 120
if (moment(forecast[0].observation_time.value).format('ddd') == moment().format('ddd')){
var today = "Today";
}
Since the variable is created inside the IF statement, its scope only exists inside the IF statement. So that is why the screen displays "undefined" because the variable isn't accessible outside the IF statement. I simply defined it outside the IF statement to get it to display.
var today = moment(forecast[0].observation_time.value).format('ddd') ;
// if the data date is the same as today then today's forecast says "today" See line 120
if (moment(forecast[0].observation_time.value).format('ddd') == moment().format('ddd')){
today = "Today";
}
That should solve the first item.
For the second item, I added some debugging to print the icon path so I could see what was breaking.
You can see that the weather API returned mostly_clear
, but the icon is named mostlyclear.png
in the folder. So you just need to update the icon name to mostly_clear.png
. Mine worked after doing that. I don't know if other icons have similar naming issues or not, but I'll try to remember to report them if I come across any others. I looked at the names in the icon folder, and it does seem inconsistent when there is a "_" and when it's omitted. I'm not sure if the actual weather API is this way, or perhaps you can just look in the icon folder and know which ones need updating.
Last question, I noticed that this module seems to break my touchscreen when using MMM-page-indicator. Normally, I have MMM-page-indicator on the bottom bar, and it works fine on the bottom bar until I enable MMM-BMW-CC on the bottom_bar. Once MMM-BMW-CC is enabled, the touchscreen functionality stops working, and I can no longer touch the "circles" to change pages. The page display indicators show up as expected, but I can no longer touch them. The temporary workaround is I moved the MMM-page-indicator to the upper left hand corner (as you can see in the screenshots) and touch works there, but it's almost like MMM-BMW-CC has an invisible hit area that covers up the page controls, and they can't be used anymore. Any thoughts about how the module might break touchscreen control?
Another fascinating thing: on my second page, I have MMM-Climacell-Hourly on the bottom-bar with MMM-page-indicator on the bottom-bar, and they work flawlessly together. The touch works fine, and MMM-Climacell-Hourly doesn't interfere with the ability to touch to select a page. Is there a significant difference in how climacell and bmw achieve their output? For some reason, there seems to be a difference for touchscreen controls since BMW breaks touchscreen and climacell does not.
EDIT: Upon testing this again when getting the data and screenshots for this post, BMW and MMM-page-indicator are now working together nicely with both in the bottom bar. So I am not sure what the difference is, but I will continue to monitor.
EDIT2: Well sometimes touch control does stop working. Maybe I am too quick to blame the module and it's something else. I have found that if I execute (touch) page controls to change pages before BMW finishes loading everything, touch works fine, even after returning to the homepage and letting it sit. If I let the BMW module fully load up, sometimes touch will continue working, and other times, it's just completely dead. So I'm not sure 100% if it's an issue with the module or the mirror in general, but it seems to only happen if MMM-page-indicator AND something else are in the bottom_bar together. And climacell and bmw are the only modules i've tested in the bottom_bar.
Code does not work any more the links changed when they changed the name.
Original link
https://www.climacell.co/weather-api/pricing/
New link
https://www.tomorrow.io/pricing/
Below image is what it does with the on the Mirror.
Thanks for building a great module. Attempted for the last two weeks to get MMM-BMW-CC to work with new Climacell API keys, however nothing seems to work. Also, Climacell no longer sends a confirmation email to verify the account.
Here is the error message:
2021-01-04 22:09:22.021] [LOG] Whoops! There was an uncaught exception...
[2021-01-04 22:09:22.021] [ERROR] TypeError: result.slice is not a function
at Request._callback (/home/pi/MagicMirror/modules/MMM-BMW-CC/node_helper.js:44:33)
at Request.self.callback (/home/pi/MagicMirror/modules/node_modules/request/request.js:185:22)
at Request.emit (events.js:200:13)
at Request. (/home/pi/MagicMirror/modules/node_modules/request/request.js:1161:10)
at Request.emit (events.js:200:13)
at IncomingMessage. (/home/pi/MagicMirror/modules/node_modules/request/request.js:1083:12)
at Object.onceWrapper (events.js:288:20)
at IncomingMessage.emit (events.js:205:15)
at endReadableNT (_stream_readable.js:1154:12)
at processTicksAndRejections (internal/process/task_queues.js:84:9)
Got the follwing issue when running the MBW-CC module.
[2020-12-16 07:36:31.093] [ERROR] Whoops! There was an uncaught exception...
[2020-12-16 07:36:31.095] [ERROR] TypeError: result.slice is not a function
at Request._callback (/home/pi/MagicMirror/modules/MMM-BMW-CC/node_helper.js:44:33)
at Request.self.callback (/home/pi/MagicMirror/node_modules/request/request.js:185:22)
at Request.emit (events.js:198:13)
at Request. (/home/pi/MagicMirror/node_modules/request/request.js:1154:10)
at Request.emit (events.js:198:13)
at IncomingMessage. (/home/pi/MagicMirror/node_modules/request/request.js:1076:12)
at Object.onceWrapper (events.js:286:20)
at IncomingMessage.emit (events.js:203:15)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
Following settings were used:
{
disabled: false,
module: "MMM-BMW-CC",
position: "bottom_bar", // designed for bottom_bar(best) thirds should be good too
config: {
apiKey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxx", // Get at https://www.climacell.co/weather-api/pricing/
ownTitle: "Current Conditions",
tempUnits: "C", // us = F or si = C
lat: '50.000000', // Your latitude
lon: '8.000000', // Your longitude
css: "2", // 1-6
playSounds: "no",
useHeader: false, // true if you want a header
header: "Your header",
maxWidth: "100%",
updateInterval: 5 * 60 * 1000,
}
},
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.