mirror of
https://github.com/bastienwirtz/homer.git
synced 2024-11-07 08:44:00 +01:00
parent
e6adfd7bb7
commit
95fde896e0
@ -36,6 +36,7 @@ within Homer:
|
||||
- [PiAlert](#pialert)
|
||||
- [Immich](#immich)
|
||||
- [OpenHAB](#openhab)
|
||||
- [Jellystat](#jellystat)
|
||||
- [Home Assistant](#home-assistant)
|
||||
|
||||
If you experiencing any issue, please have a look to the [troubleshooting](troubleshooting.md) page.
|
||||
@ -465,6 +466,22 @@ You need to set the type to OpenHAB, provide an api key and enable cors on OpenH
|
||||
To create an API token on OpenHAB, follow the [official documentation here](https://www.openhab.org/docs/configuration/apitokens.html).
|
||||
To enable cors on OpenHAB, edit your services/runtime.cfg and uncomment or add this line: `org.openhab.cors:enable=true`
|
||||
|
||||
## Jellystat
|
||||
|
||||
The Jellystat serice display the number of concurrent streams on your jellyfin server.
|
||||
The Jellystat server must be running behind a reverse proxy to add some cors headers:
|
||||
- Access-Control-Allow-Origin: ${your_domain}
|
||||
- Access-Control-Allow-Headers: Authorization
|
||||
|
||||
```yaml
|
||||
- name: "Jellystat"
|
||||
logo: "assets/tools/jellystat.png"
|
||||
url: "http://192.168.1.154:3000"
|
||||
type: "Jellystat"
|
||||
apikey: "<---insert-api-key-here--->"
|
||||
```
|
||||
You can create an API key in the dashboard of you jellystat server: settings/API Keys -> Add Key
|
||||
|
||||
## Home Assistant
|
||||
|
||||
You need to set the type to HomeAssistant, provide an api key and enable cors on Home Assistant.
|
||||
@ -479,4 +496,4 @@ You need to set the type to HomeAssistant, provide an api key and enable cors on
|
||||
separator: " " # optional, how to separate items
|
||||
```
|
||||
To create an API token on HomeAssistant, follow the [official documentation here](https://developers.home-assistant.io/docs/auth_api/#long-lived-access-token).
|
||||
To enable cors on HomeAssistant, edit your `configuration.yml` and add the IP of Homer to `https: cors_allowed_origins`
|
||||
To enable cors on HomeAssistant, edit your `configuration.yml` and add the IP of Homer to `https: cors_allowed_origins`
|
||||
|
98
src/components/services/Jellystat.vue
Normal file
98
src/components/services/Jellystat.vue
Normal file
@ -0,0 +1,98 @@
|
||||
<template>
|
||||
<Generic :item="item">
|
||||
<template #indicator>
|
||||
<div class="notifs">
|
||||
<strong
|
||||
v-if="streams > 0"
|
||||
class="notif playing"
|
||||
:title="`${streams} active stream${streams > 1 ? 's' : ''}`"
|
||||
>
|
||||
{{ streams }}
|
||||
</strong>
|
||||
<i
|
||||
v-if="error"
|
||||
class="notif error fa-solid fa-triangle-exclamation"
|
||||
title="Unable to fetch current status"
|
||||
></i>
|
||||
</div>
|
||||
</template>
|
||||
</Generic>
|
||||
</template>
|
||||
<script>
|
||||
import service from "@/mixins/service.js";
|
||||
import Generic from "./Generic.vue";
|
||||
|
||||
export default {
|
||||
name: "Jellyfin",
|
||||
mixins: [service],
|
||||
props: {
|
||||
item: Object,
|
||||
},
|
||||
components: {
|
||||
Generic,
|
||||
},
|
||||
data: () => ({
|
||||
stats: null,
|
||||
error: false,
|
||||
}),
|
||||
computed: {
|
||||
streams: function () {
|
||||
if (!this.stats) {
|
||||
return "";
|
||||
}
|
||||
let nb_streams = 0;
|
||||
for (let stream of this.stats) {
|
||||
if ("NowPlayingItem" in stream) nb_streams++;
|
||||
}
|
||||
return nb_streams;
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.fetchStatus();
|
||||
},
|
||||
methods: {
|
||||
fetchStatus: async function () {
|
||||
const headers = {
|
||||
Authorization: `bearer ${this.item.apikey}`,
|
||||
};
|
||||
try {
|
||||
const response = await this.fetch("/proxy/getSessions", { headers });
|
||||
this.error = false;
|
||||
this.stats = response;
|
||||
} catch (e) {
|
||||
this.error = true;
|
||||
console.error(e);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.notifs {
|
||||
position: absolute;
|
||||
color: white;
|
||||
font-family: sans-serif;
|
||||
top: 0.3em;
|
||||
right: 0.5em;
|
||||
|
||||
.notif {
|
||||
display: inline-block;
|
||||
padding: 0.2em 0.35em;
|
||||
border-radius: 0.25em;
|
||||
position: relative;
|
||||
margin-left: 0.3em;
|
||||
font-size: 0.8em;
|
||||
|
||||
&.playing {
|
||||
background-color: #28a9a3;
|
||||
}
|
||||
|
||||
&.error {
|
||||
border-radius: 50%;
|
||||
aspect-ratio: 1;
|
||||
background-color: #e51111;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user