Skip to content

Commit 549d33b

Browse files
committed
remove redundant state check
1 parent afe73bf commit 549d33b

File tree

3 files changed

+0
-36
lines changed

3 files changed

+0
-36
lines changed

app/apis/home_assistant_api.rb

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,6 @@ def feels_like_temperature
100100
"#{entity[:state].to_i}°"
101101
end
102102

103-
def unavailable_door_sensors
104-
out = []
105-
106-
@config["home_assistant"]["exterior_door_sensors"].each do |entity_id|
107-
if data.find { _1[:entity_id] == entity_id }&.fetch(:state) == "unavailable"
108-
out << entity_id.split(".").last.gsub("_opening", "").humanize
109-
end
110-
end
111-
112-
out.uniq
113-
end
114-
115103
def roborock_errors
116104
out = []
117105

app/models/display_content.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ def call(
2727
out[:status_icons_with_labels] << [problem[:icon], problem[:message]]
2828
end
2929

30-
home_assistant_api.unavailable_door_sensors.each do |door_sensor_name|
31-
out[:status_icons_with_labels] << ["triangle-exclamation", door_sensor_name]
32-
end
33-
3430
home_assistant_api.unlocked_doors.each do |door_name|
3531
out[:status_icons_with_labels] << ["lock-open", door_name]
3632
end

test/apis/home_assistant_api_test.rb

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -133,26 +133,6 @@ def test_unlocked_doors
133133
end
134134
end
135135

136-
def test_unavailable_door_sensors
137-
config = {
138-
"home_assistant" => {
139-
"exterior_door_sensors" => ["alley_door_sensor"]
140-
}
141-
}
142-
143-
data = [
144-
{
145-
entity_id: "alley_door_sensor",
146-
state: "unavailable"
147-
}
148-
]
149-
150-
api = HomeAssistantApi.new(config)
151-
api.stub :data, data do
152-
assert_equal(api.unavailable_door_sensors, ["Alley door sensor"])
153-
end
154-
end
155-
156136
def test_low_batteries
157137
data = [
158138
{

0 commit comments

Comments
 (0)