You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-2Lines changed: 12 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -180,12 +180,22 @@ states.sensor // returns an object containing all the entities states of the 'se
180
180
>[!TIP]
181
181
>Avoid using `states['sensor.slaapkamer_temperatuur'].state` or `states.sensor.slaapkamer_temperatuur.state`. Use `states('sensor.slaapkamer_temperatuur')` instead, which will return `undefined` if the device id doesn‘t exist or the entity isn’t ready yet (the former will throw an error). If you still want to use them it is advisable to use the [Optional chaining operator], e.g. `states['sensor.slaapkamer_temperatuur']?.state` or `states.sensor?.slaapkamer_temperatuur?.state`.
182
182
183
+
#### state_translated
184
+
185
+
Method to return a translated state of an entity using a language that is currently configured in the general settings. If the entity id doesn‘t exist it returns `undefined`.
186
+
187
+
```javascript
188
+
states('device_tracker.paulus'); // not_home
189
+
state_translated('device_tracker.paulus') // Away
190
+
```
191
+
183
192
#### is_state
184
193
185
-
Method to check if the state of an entity is equal to a certain value. It returns a `boolean`. If the entity id doesn‘t exist it returns `false`.
194
+
Method to check if the state of an entity is equal to a certain value or it is contained inside a list of values. It returns a `boolean`. If the entity id doesn‘t exist it returns `false`.
186
195
187
196
```javascript
188
-
is_state('device_tracker.paulus', 'not_home')
197
+
is_state('device_tracker.paulus', 'not_home') // check for a single value
198
+
is_state('device_tracker.paulus', ['not_home', 'work']) // check for a list of values
0 commit comments