File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -79,9 +79,7 @@ def package_present?
79
79
def unavailable_door_sensors
80
80
out = [ ]
81
81
82
- ( Timeframe ::Application . config . local [ "home_assistant" ] [ "exterior_door_sensors" ] +
83
- Timeframe ::Application . config . local [ "home_assistant" ] [ "exterior_door_locks" ]
84
- ) . each do |entity_id |
82
+ Timeframe ::Application . config . local [ "home_assistant" ] [ "exterior_door_sensors" ] . each do |entity_id |
85
83
if data . find { _1 [ :entity_id ] == entity_id } &.fetch ( :state ) == "unavailable"
86
84
out << entity_id . split ( "." ) . last . gsub ( "_opening" , "" ) . humanize
87
85
end
@@ -136,7 +134,7 @@ def unlocked_doors
136
134
out = [ ]
137
135
138
136
Timeframe ::Application . config . local [ "home_assistant" ] [ "exterior_door_locks" ] . map do |entity_id |
139
- if [ "unlocked" , "off" ] . include? ( data . find { _1 [ :entity_id ] == entity_id } &.fetch ( :state ) )
137
+ if data . find { _1 [ :entity_id ] == entity_id } &.fetch ( :state ) == "off"
140
138
out << entity_id . split ( "." ) . last . split ( "_door" ) . first . humanize
141
139
end
142
140
end
Original file line number Diff line number Diff line change @@ -214,7 +214,7 @@ def test_unlocked_doors_ignores_open_doors
214
214
} ,
215
215
{
216
216
entity_id : Timeframe ::Application . config . local [ "home_assistant" ] [ "exterior_door_locks" ] [ 0 ] ,
217
- state : "unlocked "
217
+ state : "off "
218
218
}
219
219
]
220
220
@@ -228,7 +228,7 @@ def test_unlocked_doors
228
228
data = [
229
229
{
230
230
entity_id : Timeframe ::Application . config . local [ "home_assistant" ] [ "exterior_door_locks" ] [ 0 ] ,
231
- state : "unlocked "
231
+ state : "off "
232
232
}
233
233
]
234
234
@@ -241,14 +241,14 @@ def test_unlocked_doors
241
241
def test_unavailable_door_sensors
242
242
data = [
243
243
{
244
- entity_id : Timeframe ::Application . config . local [ "home_assistant" ] [ "exterior_door_locks " ] [ 0 ] ,
244
+ entity_id : Timeframe ::Application . config . local [ "home_assistant" ] [ "exterior_door_sensors " ] [ 0 ] ,
245
245
state : "unavailable"
246
246
}
247
247
]
248
248
249
249
api = HomeAssistantApi . new
250
250
api . stub :data , data do
251
- assert_equal ( api . unavailable_door_sensors , [ "Patio door lock " ] )
251
+ assert_equal ( api . unavailable_door_sensors , [ "Alley door sensor " ] )
252
252
end
253
253
end
254
254
You can’t perform that action at this time.
0 commit comments