amaximus / transmission-card Goto Github PK
View Code? Open in Web Editor NEWCustom Transmission card for Home Assistant/Lovelace
License: MIT License
Custom Transmission card for Home Assistant/Lovelace
License: MIT License
Nice card!
Any chance you could/ would add the transmission switches "turtle mode and pause" to the card?
Also the feedback that is presented on the torrent in the web ui would be cool to.
Great work!
Hello,
I am using your card and works and looks well. Thank you for your great job.
However, where are you going with it? From a simple useful card to command center for torrents?
The problem that I have with this, is on android home assistant app, card is larger then the screen. Now I can sift all my cards left and right because of this last field that you added (total / active / completed / started). This happens when you switch through them.
I used the options to hide stuff for now it's fine, just consider it please.
Another thing with this toggle is when you press to switch to a new view for example from total to active there is a considerable delay.
I would like to translate the card to Brazilian Portuguese, could you add i18n support?
The card seems to be working fine, listing torrents and everything else. But when I try to add a torrent, I get an error on Chrome's developer console:
Uncaught TypeError: Cannot read properties of undefined (reading 'state')
at TransmissionCard._getConfigEntry (transmission-card.js?hacstag=3150444660130:118:72)
at TransmissionCard._addTorrent (transmission-card.js?hacstag=3150444660130:113:78)
at F.handleEvent (styles.ts:372:1)
Any ideas? I use Home Assistant Core.
Hi
I want to report a little issue on code :(
This card works with an predefined entity, called sensor.transmission_ectect
If I want change the name of transmission entity, or I want to add another transmission device with another name, this card does't work :(
Line 10: if (typeof hass.states[**'sensor.transmission_'** + ttype + '_torrents'] != "undefined") {
I want help you but I don't know so good JS, but i think that u can take the name of entity from an option called entity
(for example sensor.transmission_active_torrents
) or other sensor.transmissionname
and report into if with a simple variable :)
Thank u so much for your work 👍
Please if you can add a field where the current ratio is shown for every torrent.
In my opinion this is all that is missing to be perfect.
I was struggling for some time trying to understand why my card couldn't read information from the sensor, even though I could add torrents using the text field on the card. The sensors worked just fine, but the card couldn't see them.
Searching on transmission-card.js
for "no sensor" (the only information I was able to get from the card), I ended up discovering that the card expects a sensor named transmission_download_speed
. What I didn't notice was that my Portuguese installation of hass translated the sensor names when I installed the transmission integration. So, almost all of the transmission sensors were written in Portuguese, which obviously causes issues with the card. So I looked for the original sensor names on the official page of the transmission's integration and changed them, and everything worked just fine.
I know the problem was on my side, but from an user's point of view, it can be hard to notice this kind of thing. Adding the possibility to set the name of all sensors separately on the card configuration could be a solution, but doesn't sound very practical. If this information (that the sensor names must be the same as the official English names) was displayed on the readme.md
I think it would help a lot during the troubleshooting process.
The sensor names are changed with the following (merged and included to release from HA 2023.8.0b0) pull requests: https://github.com/home-assistant/core/pull/96761/files and https://github.com/home-assistant/core/pull/84664/files
I've got entities named:
You may have to implement some IF conditions to keep backward compatibility but support HA > 2023.08.0.
Since Home Assistant 2022.12.7 I started getting this warning
The name key in Transmission services is being removed
Update any automations or scripts that use this service and replace the name key with the entry_id key.
Nice card!
It would be nice to be able to also show/hide:
And also be able to customize these colors to fit the card in any lovelace-theme:
Cheers!
I love the Transmission Card, You would be a hero if you can do the same for SABNZB?
Or allow the cards to be modified with different entities.
Regards
Here is some prototype code. Though it doesn't work since the second function is asynchronous and the Hass object is out of its scope. Currently lacking braincells to come up with a solution. The first function is called using an onclick event from a button, that could be positioned on the right side of the input field.
_addTorrentViaFileButton(event) {
var x = document.createElement("INPUT");
x.setAttribute("type", "file");
x.addEventListener("change", this._addTorrentViaFile);
x.click();
};
async _addTorrentViaFile(event) {
let base64string = await new Promise((resolve) => {
let file = event.currentTarget.files[0];
const fileReader = new FileReader();
fileReader.readAsDataURL(file);
fileReader.onload = () => {
resolve(fileReader.result);
};
});
this.hass.callService('transmission', 'add_torrent', { entry_id: `${this._getConfigEntry()}`, torrent: base64string });
};
Perhaps one way of doing it would be changing the value of the input field to the calculated base64 value and then using this to emulate the Enter keyboard event
https://stackoverflow.com/questions/3276794/jquery-or-pure-js-simulate-enter-key-pressed-for-testing
Hi
Please can you check this piece of code?
_getTorrents(hass) { var res = []; if (typeof hass.states['sensor.transmission_total_torrents'] != "undefined") { const data1 = hass.states['sensor.transmission_total_torrents'].attributes['torrent_info']; Object.keys(data1).forEach(function (key) { res.push({ name: key, id: data1[key].id, percent: parseInt(data1[key].percent_done, 10), state: data1[key].status, added_date: data1[key].added_date, }); }); } return res; }
When transmission is closed or unreachable this will cause to not render lovelace view
Thank you very much
I don't know if you show this but I am doing this only to put you in contact with @JPHutchins. Just have a look at this maybe it is interesting for you. Thanks in advance.
It would be nice to be able to hide the torrent list, I currently have a card set up to add magnet links and show the up and down speeds but would like to not have the torrent list keep changing the size of the card.
Hi,
Thanks for the great work!
Could you add some functions like:
show/hide turtle mode button
show/hide start/stop button
torrents list options (seems sensor.transmission_total_torrents is default) like sensor.transmission_active_torrents
I have just created the card, but it says "no torrents' under every setting. However, if I check my transmission sensors, they are all showing active torrents etc.
Is there something I'm missing during config?
Hi there, I would ask your help to define the destination folder of the torrent while adding. E.g. I'm usually adding files to Plex, and "Movies" and "Tv Series" folders are differently scraped. That's why I would sort the different files to the proper folders.
Thanks in advance for your help
Card appears as "undefined" if there are no torrents downloaded in the client.
Thanks for this card, this is much better than the makeshift card I created using Markdown and templates. I had issues setting up the Transmission card initially and noticed my Lovelace dashboard would fail to load. I guessed that the issue had something to do with my messed up Transmission sensor names (I had to re-add the integration, and it created duplicate sensors called 'switch.transmission_turtle_mode_2', etc. I renamed the sensors back to their default naming and the Transmission card works now!
Would it be possible to add in some error handling to check the sensor names, so that it doesn't crash the entire Lovelace dashboard?
How can I use this card for two different integration of transmission?
is it possible to show latest -> oldest torrents instead of the current sorting?
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.