Comments (13)
So when talking about setting the entity id in your new integration, you mean manually setting it with self.entity_id = ...
?
If that's the case: Integrations are discouraged from manually setting entity IDs and so it's their responsibility to do it the right way. All integrations should preferably only set a name
and the entity id will automatically be generated for you.
I mean there does exist a validator inside homeassistant.core
called valid_entity_id
which could be extended to check for lowercase characters. Then that check could be implemented in the entity base. Honestly though, I think especially when talking about python code (and not automations/templates) the developer should take care of validation themselves if they do decide to manually set entity IDs.
from architecture.
I thought name was how we set friendly name now? friendly name is not going to be compatible with entity_id restrictions, at least not always ...
from architecture.
I think that we should just convert any given entity_id
attribute to lowercase when adding it to hass.
from architecture.
I think either casting it lowercase or raising an exception if it's invalid (not lowercase) are both fine. Doing neither leads to eventual confusion :)
from architecture.
We already validate it when it is added to Home Assistant: https://github.com/home-assistant/home-assistant/blob/c14e41f4310a010633bc0eaad22a2a07e05adbdb/homeassistant/helpers/entity_platform.py#L298-L299
If that check doesn't work properly, we should update the regex that valid_entity_id
uses: https://github.com/home-assistant/home-assistant/blob/c14e41f4310a010633bc0eaad22a2a07e05adbdb/homeassistant/core.py#L51-L52
PR welcome.
from architecture.
I'm pretty sure that \w
will allow uppercase in addition to lowercase, etc, unless Python handles that differently. I'm guessing something along the lines of r"^([a-z0-9_]+)\.([a-z0-9_]+)$"
(untested, just off the top of my head) would get the intended result?
from architecture.
yeah, and we should add some test to make sure that we don't allow uppercase.
from architecture.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
from architecture.
Looks like this hasn't been fixed yet (from looking at the current code on master and dev branches). If I can remember to find the time to double check my proposed fix and test it I'll submit a PR.
from architecture.
I submitted a PR to fix this, which exposed a test that used uppercase in a mock service call, which should probably be also patched accordingly to be in lower case, but the PR was rejected without giving a clear reason why.
from architecture.
We should start a https://github.com/home-assistant/architecture
Anyway, that looks good, but that change a lot and break also a lot installation. It looks small but is a big thing. We are not robust anymore and the entry level grow up for new users.
I think better is to use vol.Lower() on the vololutpus schema and all based on that schema.
from architecture.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
from architecture.
This is no longer an issue current day. 🎉
from architecture.
Related Issues (20)
- Splitting tests files in smaller files in components/modules tests HOT 1
- Feature Request HOT 1
- Add favorite position to Cover entity HOT 10
- Add feature light distribution control to LightEntity
- Add new CURRENT_HVAC constants HOT 1
- Add Home Appliance entity
- Officially allow enities to set their entity ID not based on their names HOT 2
- Custom Device Class for Binary Sensors HOT 9
- Installed homeassistant supervised on my Linux machine; can't get it to run. HOT 1
- Expand enqueue options media player HOT 2
- Extend Rest API - unique_id HOT 3
- Add "status" as an attribute to CalendarEvents HOT 5
- Add list of (upcoming) calendar events to templating HOT 1
- Creating automations on the fly HOT 1
- Optional health check HOT 2
- Open letter for improving Home Assistant's Authentication system HOT 7
- Add device_class Heater HOT 2
- Area Units HOT 3
- New Device class for Reactive Energy (varh) HOT 1
- "Lost" device HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from architecture.