Skip to content

Commit 38b9cd8

Browse files
committed
use template sensors for roborock statuses
1 parent 549d33b commit 38b9cd8

File tree

3 files changed

+0
-84
lines changed

3 files changed

+0
-84
lines changed

app/apis/home_assistant_api.rb

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

103-
def roborock_errors
104-
out = []
105-
106-
entity = data.find { _1[:entity_id] == @config["home_assistant"]["roborock_dock_error"] }
107-
108-
if entity.present? && entity[:state] != "ok"
109-
out << entity[:state].humanize
110-
end
111-
112-
entity = data.find { _1[:entity_id] == @config["home_assistant"]["roborock_vacuum_error"] }
113-
114-
if entity.present? && entity[:state] != "none"
115-
out << entity[:state].humanize
116-
end
117-
118-
out.uniq
119-
end
120-
121103
def open_doors
122104
out = []
123105

app/models/display_content.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ def call(
3535
out[:status_icons_with_labels] << ["door-open", door_name]
3636
end
3737

38-
home_assistant_api.roborock_errors.each do |error|
39-
out[:status_icons_with_labels] << ["robot", error]
40-
end
41-
4238
home_assistant_api.low_batteries.each do |low_battery|
4339
out[:status_icons_with_labels] << ["battery-quarter", low_battery]
4440
end

test/apis/home_assistant_api_test.rb

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -163,68 +163,6 @@ def test_low_batteries
163163
end
164164
end
165165

166-
def test_roborock_errors
167-
config = {
168-
"home_assistant" => {
169-
"roborock_dock_error" => "roborock_dock_error",
170-
"roborock_vacuum_error" => "roborock_vacuum_error"
171-
}
172-
}
173-
174-
api = HomeAssistantApi.new(config)
175-
api.stub :data, {} do
176-
assert_equal(api.roborock_errors, [])
177-
end
178-
179-
data = [
180-
{
181-
entity_id: "roborock_dock_error",
182-
state: "ok"
183-
}
184-
]
185-
186-
api = HomeAssistantApi.new(config)
187-
api.stub :data, data do
188-
assert_equal(api.roborock_errors, [])
189-
end
190-
191-
data = [
192-
{
193-
entity_id: "roborock_dock_error",
194-
state: "water_empty"
195-
}
196-
]
197-
198-
api = HomeAssistantApi.new(config)
199-
api.stub :data, data do
200-
assert_equal(api.roborock_errors, ["Water empty"])
201-
end
202-
203-
data = [
204-
{
205-
entity_id: "roborock_vacuum_error",
206-
state: "none"
207-
}
208-
]
209-
210-
api = HomeAssistantApi.new(config)
211-
api.stub :data, data do
212-
assert_equal(api.roborock_errors, [])
213-
end
214-
215-
data = [
216-
{
217-
entity_id: "roborock_vacuum_error",
218-
state: "bumper_stuck"
219-
}
220-
]
221-
222-
api = HomeAssistantApi.new(config)
223-
api.stub :data, data do
224-
assert_equal(api.roborock_errors, ["Bumper stuck"])
225-
end
226-
end
227-
228166
def test_now_playing_no_data
229167
config = {
230168
"home_assistant" => {

0 commit comments

Comments
 (0)