Skip to content

Commit

Permalink
allow use of input boolean for lock state
Browse files Browse the repository at this point in the history
  • Loading branch information
joelhawksley committed Jul 23, 2024
1 parent 1e7c918 commit 31ce36c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/apis/home_assistant_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def unlocked_doors
out = []

Timeframe::Application.config.local["home_assistant"]["exterior_door_locks"].map do |entity_id|
if data.find { _1[:entity_id] == entity_id }&.fetch(:state) == "unlocked"
if ["unlocked", "off"].include?(data.find { _1[:entity_id] == entity_id }&.fetch(:state))
out << entity_id.split(".").last.split("_door").first.humanize
end
end
Expand Down
8 changes: 5 additions & 3 deletions test/models/display_content_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ class DisplayContenttTest < Minitest::Test
include ActiveSupport::Testing::TimeHelpers

def test_no_data
result = DisplayContent.new.call
travel_to DateTime.new(2023, 8, 27, 18, 15, 0, "-0600") do
result = DisplayContent.new.call

assert_nil(result[:current_temperature])
assert_equal(result[:day_groups].count, 5)
assert_nil(result[:current_temperature])
assert_equal(result[:day_groups].count, 5)
end
end

def test_hide_events_after_cutoff
Expand Down

0 comments on commit 31ce36c

Please sign in to comment.