Closed marcodipasqua closed 4 months ago
Hi @oyvindwe,
Thank you for your great work! :) I tested it and I totally forgot to update strings.json. Is it really needed?
BTW, I also wanted to set icons for the Presets but it does not work. Any suggestions?
I tested it and I totally forgot to update strings.json. Is it really needed?
At least in HA core, en.json
is generated from strings.json
, so I prefer to update both for custom components.
BTW, I also wanted to set icons for the Presets but it does not work. Any suggestions?
Yes, I was just about to comment about that. "mdi:icon": "mdi:sprout"
will actually be sent to the ConnectLife API when you select that preset. There is no way to set icons for presets programatically, but it may work to set them in icons.json
, se issue #25 - I have not tested this yet, but I can give it a try
I got it, I will update strings.json as well.
The other icons perfectly works, do you think they should be moved to icons.json anyway?
As you can see, I added a lot of Presets but I am not sure if this is a good approach. Your feedback?
I got it, I will update strings.json as well.
👍
The other icons perfectly works, do you think they should be moved to icons.json anyway?
For the generic entities as sensor, number, etc. I prefer to add the icons with the property mapping, as we then can have different icons if a field is reused across different device types. For climate preset and fan mode etc. I think it's reasonable to set them in icons.json
. So far I have not found any documentation on how, only this thread that states it is up to the integration to do it.
E.g. this does not work for me:
{
"entity": {
"climate": {
"connectlife" : {
"state_attributes": {
"preset_mode": {
"ai": "mdi:sprout"
}
}
}
}
}
}
As you can see, I added a lot of Presets but I am not sure if this is a good approach. Your feedback?
I think it's reasonable to add presets you think other users with the same device are likely to use. You could probably achieve the same with an automation that sets multiple switches and selects, but the presets have the advantage that they only trigger one request to the ConnectLife API.
I got icons to work! I will make a separate PR with this:
{
"entity": {
"climate": {
"connectlife": {
"state_attributes": {
"preset_mode": {
"state": {
"ai": "mdi:head-cog",
"off": "mdi:power"
}
},
"swing_mode": {
"state": {
"both_sides": "mdi:arrow-left-right",
"forward": "mdi:arrow-down",
"left": "mdi:arrow-left",
"right": "mdi:arrow-right",
"swing": "mdi:arrow-oscillating"
}
}
}
}
}
}
}
Thank you very much! Have you tested this? It seems that you are lacking updates to
strings.json
- did you forget to include it in the commit perhaps?