Closed pmchaumien closed 3 years ago
Hey, that's great to hear!
On the Heroku side, the server is already set up to recognise devices
, if you provide it, so you shouldn't need to edit the code at all.
On the LaMetric app creator, add a text parameter to your app that corresponds to the devices
parameter:
Then in the LaMetric app, you should see this parameter as a text field on the settings screen. You can set it here:
(Note: It's called 'Speakers' for me as I gave the devices
parameter a more user-friendly name)
Then for that field, enter a comma-separated list of devices to match. So, if you only want your LaMetric to display songs playing on "Kitchen Echo" and "Living Room Echo", you'd enter Kitchen Echo,Living Room Echo
.
Hope this helps!
Thanks you, i will try 💯
i made some code modification before your answer
index.js
if (nowPlaying['is_playing'] && nowPlaying.item && nowPlaying.item.name && nowPlaying.item.artists) {
const track = nowPlaying.item.name;
const artists = nowPlaying.item.artists.map(artist => artist.name).join(', ');
const device = nowPlaying.device.name;
responseText = `${track} - ${artists}`;
if (allowedDevices && !allowedDevices.includes(nowPlaying.device.name)) {
responseText = `${track} - ${artists} - ${device}`;
}
}
console.log(responseText);
and in the lametric app i put a checkbox with devices option but now
"lametric" show all the time the active device... even more when the checkbox is on false....
I'm a newbee with javascript and i'm little lost know... in fact I want to be able to activate the option when I want to see the active device
devices
shouldn't be a checkbox, it should be a text field
ok Shaun, i will try it 👍
Thanks you Shaun, it's functional
Ah that's great to hear, enjoy!
Hello Shaun
Thanks for your app, it’s great… I managed to deploy it on heroku and it works great, I receive the information from my spotify account on my LAmetric... I'm over the moon.... But can you explain me how to include the option to know which device is used... I don't understand how to do it. I don't know if it's in the index.js code or just in the Lametric application creator. can you help me?
Thanks by advance
Pierre-Marie