-
-
Notifications
You must be signed in to change notification settings - Fork 55
How to add template for new brand
I am receiving a lot of request to add different chargers, which is nice, because that is really the intention!!
However, since I have an Easee-charger and the card was initially developed to support this type, I am depending on help to add support for other chargers. The card itself is (almost) 100% customizable, so you can basically adapt it to any need by changing the YAML-code yourself. For most common needs, there is really no need for me to adapt the code - however, not everyone is loving (read: understand how to do) custom adaptions to YAML-code. This is why I came up with the brand-idea. If you're happy with YAML-code, the solution is already there waiting for you to excel your skills and adapt the card. Please take a look at the advanced example in readme and adopt it to your needs. Since you already know some level of "coding", consider using your skills to propose a template for your brand so that other, less skilled users can benefit from it too (read below how)! Share your knowledge, it's open source! :)
By selecting a brand in the UI-configurator, the idea is that a template in the background does all the magic and configures the card according to your charger (or other stuff). This is what I've called a template. When you change brand the code will adapt to the brand template chosen. However, it is not possible for me to to spend several hours to read the API of each charger and adapt it, also I have no way to test if it is working or not.
Best practice to add a brand template:
- Take a look at the original template for Easee-charger. This one I know is working and I'm using it myself.
- If you understand the content of the Easee-template referenced above, all you need to do is modify the content to fit your charger, rename the file to your charger name and to a pull request to have this implemented. To assist this work, there is (of course) a template for templates which you can use to get you started. There are also some comments in this file which might exaplain what you're looking for.
- It will take some time and dedication to do it, which is also why it is impossible for me to do it.
- Even if you, in your final setup, want a lot of super custom data which does not belong to the charger (or whatever device) integration, please do NOT include this in the template. The template is supposed to work for everyone which has the integration installed, so your own customizations stays as yours.
If the files seems too complicated, try to read again. It isn't really. But if you're still stuck, please open an issue and describe your doubts. I'll try to help out as best as I can. If everything here is greek, the best option is probably to find and join up with someone else with the same charger as you that may also have some coding-skills. It doesn't take a lot of it, and I'm willing to help and adjust as needed. Don't be afraid to ask, but I really need a place to start for each charger.
In the unlikely event that I have some time to spare, I may consider adding some templates myself, but the minimum I need is a complete overview of ALL default entity names from the charger integration. I also need an overview of services that are available and which service data they accept. The more structured your information is, the better the chances are that I'll spend time on it. In any case, you or your fellow charger-friends must be the ones to test it, since I have now way doing that.
I hope this didn't come out too harsh, that is really not the intention. I'd love for lot's of charger brands to be added, but I'm not in a position where I can spend too much time on it. Thanks for understanding, cheers and happy charging! :)
PS! Other "brands" than chargers may be considered too if you provide a screenshot of your art!
The template for templates is basically code which transforms into YAML. If you compare the code with what appears in your YAML-code, I believ you'll see the correlation.
-
Once a main entity is chosen in UI-config, it will use the main entity and just take away the variable domainbase. This is because most integrations using a naming style like "DEVICENAME_realentityname", so the code will detect DEVICENAME and use that to name all other entities in the card. That's why the
edt.ENTITYPREFIX
is in the code. The rest is basically just naming your entities. -
For service data it becomes a bit more complicated, but the concept is the same. Choose if the service call is by entity_id or device_id and apply the correct service data as you would do in HA. Hopefully, by looking at the examples, you'll see how to do it. Otherwise, please ask.