Read the statement by Michael Teeuw here.
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.
-
-
@BKeyport Hi, can you make a screenshot of the things styled outside MagicMirror so we can see how it should look exactly?
Maybe you will need some additional classes in your module config to make it possible to select the different elements jn CSS. -
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!
-
@BKeyport if you use the developers window sources tab, you can put a stop on the line after receivenotification
and examine the payload by putting the cursor over the word notification
is it a string, or is it an object already
your parse(stringify(… ))
assumes it is an object already,
my guess is curl returned a string -
@sdetweil you’re correct. It’s a string. That started fixing it up, just gotta reset a couple of variables I forgot to capture. 😏
-
@BKeyport awesome