tuxdiver / mmm-rest Goto Github PK
View Code? Open in Web Editor NEWMagicMirror² addon for fetching REST data and displaying it on the mirror
License: MIT License
MagicMirror² addon for fetching REST data and displaying it on the mirror
License: MIT License
I have one more change that I've worked on, which builds in the ability to transform numerical data before displaying it. E.g., to convert units from, say, watts to kilowatts. Will create a PR you can accept or reject.
this is my config.
But i can't see any output on the mirror
{
module: 'MMM-Rest',
position: 'top_right',
config: {
debug: false,
sections: [
{
format: '%.1f<span class="wi wi-celsius"></span>',
url: 'http://openhab:8080/rest/items/mqtt_temp_LivingRoom/state',
},
{
format: '%d%%',
url: 'http://openhab:8080/rest/items/mqtt_humi_LivingRoom/state',
},
{
format: '%.1f<span class="wi wi-celsius"></span>',
url: 'http://openhab:8080/rest/items/mqtt_temp_Bathroom/state',
},
{
format: '%d%%',
url: 'http://openhab:8080/rest/items/mqtt_humi_Bathroom/state',
},
],
output: [
['Wohnzimmer','@1','@2'],
['Bad','@3','@4']
]
}
},
I solved the multiple instances issues by passing a unique id through the update notifications. I can either create a PR for you to add this into your module, or I can create a new fork module called "Rest2". Your call.
First of thank you for your build it is awesome. I was wanting to see if there is anyway to add an audible sound when the temperature reaches one of the ranges that have been set in the config.js. Thanks in advance.
Is this still working for OpenHAB? I suspect this was built and last updated before OH added authorization, and I'm not getting reliable connections without passing an authorization header. I'm curiously getting only sporadic values returned, with most of my entries showing "..." most of the time. Though which entries show "..." changes.
Hi,
is it possible to display strings and to "translate" them?
e.g. OpenHAB gives me "OPEN" or "CLOSED" via rest api, but mmm-rest displays "NaN". It would be great, if the addon could handle simple word replacement (e.g. "OPEN" => "geöffnet")
I made another change, which addresses how cells are aligned. As I understand the current code, if the cell contains an '@' section id variable, it will align the cell to the right, otherwise it will align the cell to the left. This works well when the row is of the format [description, variable]. But if the use case calls for [variable, description] (e.g., "5 bananas"), or [variable, variable] (my use case because the description changes based on some factors), the alignment isn't right. I THINK it makes more sense have left columns aligned left, and right columns aligned right, so I've made a change to do that here:
https://github.com/dathbe/MMM-Rest/tree/patch-1
I will create a PR if you think this is an improvement.
The configured URL resolves correctly using curl and gives back the required info (temperatur from an aquarium).
{
module: 'MMM-Rest',
position: 'bottom_right', // This can be any of the regions.
config: {
debug: true,
sections: [
{
suffix: 'ºC',
digits: 1,
url: 'http://192.168.1.4:8000/devices/temp2/sensor/temperature/c'
},
],
output: [
['Temperatura Acuario','@1']
],
}
},
So I'd like to display my sensor values from home-assistant or node-red (I get them via MQTT btw) on a magic mirror....
I have several questions, first, can I display multiple values or just 3 like in the example?
Second, how do I need to construct the url so that this module will pick it up and display it? Is it a http post request or what is it?
So does this code just display the numbers or string that it gets at the end of this field -> ?text=
I've made a two other, sort of vaguely related changes in another branch:
This is particularly useful because OpenHAB now encourages users to specify units when using a number, so most of my "numbers" are actually strings containing digits and a string unit.
If the user prefers to stick with %s (the only viable option available with the current module), there will be no change in behavior.
As with (1), sticking with %s will result in no changed behavior.
These seem really different, but they are both about handling different data types in a smarter manner. I was working on them both at the same time, so I only have a single branch with both changes. But if you like one but not the other, I can back one change out.
If you like either or both, let me know and I'll create another PR.
Is it possible to add a second MMM-Rest module in a config? I'm struggling to make it work, and I think it has to do with the fact that, in the second module, when you declare the output
in the second instance as, say @1
, it looks to the sections
from the first instance for the data. But using @2
(one beyond the number in the first instance) results in null.
Update: I've gotten it to work (I think) by duplicating the ENTIRE mappings
and sections
sections in the second instance, and changing only the output
. But this is obviously pretty cluttered and requires careful tracking to make sure they stay consistent. So if there's a more elegant solution, I'd love to know.
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.