Skip to content

Commit 304d6ad

Browse files
authored
Add section outlining entity creation guidelines (#47)
1 parent 6206303 commit 304d6ad

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/contributing/code.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,19 @@ In general, we try to avoid use of external libraries.
8585
well-known `set_timeout` method is also available; this can be a handy alternative to implementing a state
8686
machine.
8787

88+
#### Components/platforms and entities
89+
90+
- Components/platforms should pass data from hardware directly through to the respective entities presented in the
91+
front end (Home Assistant, MQTT, web, etc.). If the raw data requires grooming, this should be left to the user to do
92+
by way of the various types of filters available
93+
([sensor](https://esphome.io/components/sensor/#sensor-filters),
94+
[binary sensor](https://esphome.io/components/binary_sensor/#binary-sensor-filters),
95+
[text sensor](https://esphome.io/components/text_sensor/#text-sensor-filters)).
96+
- Components/platforms should facilitate the creation of entities only when there is a corresponding hardware feature
97+
which the entity may control. Put another way, in general, do not introduce platforms which allow tuning
98+
component/platform behavior when there is no corresponding feature implemented in the hardware the
99+
component/platform is for.
100+
88101
#### General
89102

90103
- All entities must be *optional* in the configuration.

0 commit comments

Comments
 (0)